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
757596da
Commit
757596da
authored
Nov 15, 2006
by
Richard Mansfield
Browse files
Merge with
git+ssh://git.catalyst.net.nz/var/git/mahara.git
parents
cd349f0f
efa0b45e
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/cron.php
View file @
757596da
...
@@ -130,6 +130,39 @@ foreach (plugin_types() as $plugintype) {
...
@@ -130,6 +130,39 @@ foreach (plugin_types() as $plugintype) {
}
}
}
}
// and now the core ones (much simpler)
if
(
$jobs
=
get_rows_select
(
'cron'
,
'nextrun >= ? AND nextrun < ?'
,
array
(
db_format_timestamp
(
$now
-
MAXRUNAGE
),
db_format_timestamp
(
$now
))))
{
foreach
(
$jobs
as
$job
)
{
log_debug
(
"Running core cron "
.
$job
[
'callfunction'
]);
$function
=
$job
[
'callfunction'
];
$function
();
$nextrun
=
cron_next_run_time
(
$now
,
$job
);
// update next run time
set_field
(
'cron'
,
'nextrun'
,
db_format_timestamp
(
$nextrun
),
'id'
,
$job
[
'id'
]);
}
}
// and missed ones...
if
(
$jobs
=
get_rows_select
(
'cron'
,
'nextrun < ? OR nextrun IS NULL'
,
array
(
db_format_timestamp
(
$now
-
MAXRUNAGE
))))
{
foreach
(
$jobs
as
$job
)
{
if
(
$job
[
'nextrun'
])
{
log_warn
(
'core cronjob "'
.
$job
[
'callfunction'
]
.
'" didn\'t get run because the nextrun time was too old'
);
}
$nextrun
=
cron_next_run_time
(
$now
,
$job
);
// update next run time
set_field
(
'cron'
,
'nextrun'
,
db_format_timestamp
(
$nextrun
),
'id'
,
$job
[
'id'
]);
}
}
function
cron_next_run_time
(
$lastrun
,
$job
)
{
function
cron_next_run_time
(
$lastrun
,
$job
)
{
$run_date
=
getdate
(
$lastrun
);
$run_date
=
getdate
(
$lastrun
);
...
...
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