Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
30c93b88
Commit
30c93b88
authored
Aug 17, 2009
by
Richard Mansfield
Browse files
Add param to interaction_forum_new_post to send forum posts with no delay (for testing)
parent
9a3ed6e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/interaction/forum/lib.php
View file @
30c93b88
...
...
@@ -313,12 +313,23 @@ class PluginInteractionForum extends PluginInteraction {
return
$forums
;
}
/**
* cronjob for new forum posts
*/
public
static
function
interaction_forum_new_post
()
{
$currenttime
=
time
();
$minpostdelay
=
$currenttime
-
30
*
60
;
/**
* Process new forum posts.
*
* @param array $postnow An array of post ids to be sent immediately. If null, send all posts older than 30 mins.
*/
public
static
function
interaction_forum_new_post
(
$postnow
=
null
)
{
if
(
is_array
(
$postnow
)
&&
!
empty
(
$postnow
))
{
$values
=
array
();
$postswhere
=
'id IN ('
.
join
(
','
,
$postnow
)
.
')'
;
}
else
{
$currenttime
=
time
();
$minpostdelay
=
$currenttime
-
30
*
60
;
$values
=
array
(
db_format_timestamp
(
$minpostdelay
));
$postswhere
=
'ctime < ?'
;
}
$posts
=
get_records_sql_array
(
'SELECT s.subscriber, s.type, s.key, p.id
FROM (
...
...
@@ -329,18 +340,21 @@ class PluginInteractionForum extends PluginInteraction {
INNER JOIN {interaction_forum_topic} t ON t.forum = sf.forum
) s
INNER JOIN {interaction_forum_topic} t ON (t.deleted != 1 AND t.id = s.topic)
INNER JOIN {interaction_forum_post} p ON (p.sent != 1 AND p.ctime < ? AND p.deleted != 1 AND p.topic = t.id)
INNER JOIN {interaction_forum_post} p ON (
p.sent != 1 AND p.deleted != 1 AND p.topic = t.id
AND p.'
.
$postswhere
.
'
)
INNER JOIN {interaction_instance} f ON (f.id = t.forum AND f.deleted != 1)
INNER JOIN {group} g ON (g.id = f.group AND g.deleted = 0)
INNER JOIN {group_member} gm ON (gm.member = s.subscriber AND gm.group = f.group)
ORDER BY type, p.id'
,
array
(
db_format_timestamp
(
$minpostdelay
))
$values
);
// query gets a new object for every subscription
// this combines all the objects for the same post together with an array for the subscribers
if
(
$posts
)
{
set_field_select
(
'interaction_forum_post'
,
'sent'
,
1
,
'
ctime < ? AND
deleted = 0 AND sent = 0
'
,
array
(
db_format_timestamp
(
$minpostdelay
))
);
'deleted = 0 AND sent = 0
AND '
.
$postswhere
,
$values
);
$count
=
count
(
$posts
);
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
$posts
[
$i
]
->
users
=
array
(
$posts
[
$i
]
->
subscriber
);
...
...
@@ -363,7 +377,8 @@ class PluginInteractionForum extends PluginInteraction {
'subscriptions'
=>
$post
->
subscriptions
,
),
'interaction'
,
'forum'
'forum'
,
(
bool
)
$postnow
);
}
}
...
...
htdocs/lib/activity.php
View file @
30c93b88
...
...
@@ -33,9 +33,9 @@ defined('INTERNAL') || die();
* @param string $activitytype type of activity
* @param mixed $data data
*/
function
activity_occurred
(
$activitytype
,
$data
,
$plugintype
=
null
,
$pluginname
=
null
)
{
function
activity_occurred
(
$activitytype
,
$data
,
$plugintype
=
null
,
$pluginname
=
null
,
$overridedelay
=
false
)
{
$at
=
activity_locate_typerecord
(
$activitytype
,
$plugintype
,
$pluginname
);
if
(
!
empty
(
$at
->
delay
))
{
if
(
!
empty
(
$at
->
delay
)
&&
!
$overridedelay
)
{
$delayed
=
new
StdClass
;
$delayed
->
type
=
$at
->
id
;
$delayed
->
data
=
serialize
(
$data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment