MDL-77186 core: Move all uses of cronlib to new class

This commit is contained in:
Andrew Nicols
2023-03-13 21:21:13 +08:00
parent 99a67b615f
commit 9ec46c232d
36 changed files with 73 additions and 92 deletions
+2 -3
View File
@@ -27,7 +27,6 @@ define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once("{$CFG->libdir}/clilib.php");
require_once("{$CFG->libdir}/cronlib.php");
list($options, $unrecognized) = cli_get_params(
[
@@ -120,7 +119,7 @@ core_php_time_limit::raise();
raise_memory_limit(MEMORY_EXTRA);
// Emulate normal session - we use admin account by default.
cron_setup_user();
\core\cron::setup_user();
$humantimenow = date('r', time());
$keepalive = (int)$options['keep-alive'];
@@ -128,4 +127,4 @@ $keepalive = (int)$options['keep-alive'];
\core\local\cli\shutdown::script_supports_graceful_exit();
mtrace("Server Time: {$humantimenow}\n");
cron_run_adhoc_tasks(time(), $keepalive, $checklimits);
\core\cron::run_adhoc_tasks(time(), $keepalive, $checklimits);
+4 -5
View File
@@ -30,7 +30,6 @@ define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
require_once($CFG->libdir.'/cronlib.php');
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help'=>false),
@@ -80,10 +79,10 @@ if (!empty($CFG->showcrondebugging)) {
$starttime = microtime();
/// emulate normal session
cron_setup_user();
// Emulate normal session.
\core\cron::setup_user();
/// Start output log
// Start output log.
$timenow = time();
mtrace("Server Time: ".date('r',$timenow)."\n\n");
@@ -96,4 +95,4 @@ backup_cron_automated_helper::run_automated_backup(backup_cron_automated_helper:
mtrace("Automated cron backups completed correctly");
$difftime = microtime_diff($starttime, microtime());
mtrace("Execution took ".$difftime." seconds");
mtrace("Execution took ".$difftime." seconds");
+1 -2
View File
@@ -31,7 +31,6 @@ define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir . '/clilib.php');
require_once($CFG->libdir . '/cronlib.php');
// Now get cli option.
[$options, $unrecognized] = cli_get_params(
@@ -184,4 +183,4 @@ if (!get_config('core', 'cron_enabled') && !$options['force']) {
$keepalive = $options['keep-alive'];
cron_run($keepalive);
\core\cron::run_main_process($keepalive);
-1
View File
@@ -28,7 +28,6 @@ define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir . '/clilib.php');
require_once($CFG->libdir . '/cronlib.php');
list($options, $unrecognized) = cli_get_params(
[
+2 -3
View File
@@ -27,7 +27,6 @@ define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once("$CFG->libdir/clilib.php");
require_once("$CFG->libdir/cronlib.php");
list($options, $unrecognized) = cli_get_params(
[
@@ -142,7 +141,7 @@ if ($execute = $options['execute']) {
raise_memory_limit(MEMORY_EXTRA);
// Emulate normal session - we use admin account by default.
cron_setup_user();
\core\cron::setup_user();
// Execute the task.
\core\local\cli\shutdown::script_supports_graceful_exit();
@@ -164,5 +163,5 @@ if ($execute = $options['execute']) {
$task->set_cron_lock($cronlock);
}
cron_run_inner_scheduled_task($task);
\core\cron::run_inner_scheduled_task($task);
}