本文整理汇总了PHP中core\task\manager::get_all_scheduled_tasks方法的典型用法代码示例。如果您正苦于以下问题:PHP manager::get_all_scheduled_tasks方法的具体用法?PHP manager::get_all_scheduled_tasks怎么用?PHP manager::get_all_scheduled_tasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core\task\manager
的用法示例。
在下文中一共展示了manager::get_all_scheduled_tasks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list
require_once "{$CFG->libdir}/clilib.php";
require_once "{$CFG->libdir}/cronlib.php";
list($options, $unrecognized) = cli_get_params(array('help' => false, 'list' => false, 'execute' => false), array('h' => 'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help'] or !$options['list'] and !$options['execute']) {
$help = "Scheduled cron tasks.\n\nOptions:\n--execute=\\\\some\\\\task Execute scheduled task manually\n--list List all scheduled tasks\n-h, --help Print out this help\n\nExample:\n\$sudo -u www-data /usr/bin/php admin/tool/task/cli/scheduled_task.php --execute=\\\\core\\\\task\\\\session_cleanup_task\n\n";
echo $help;
die;
}
if ($options['list']) {
cli_heading("List of scheduled tasks ({$CFG->wwwroot})");
$shorttime = get_string('strftimedatetimeshort');
$tasks = \core\task\manager::get_all_scheduled_tasks();
foreach ($tasks as $task) {
$class = '\\' . get_class($task);
$schedule = $task->get_minute() . ' ' . $task->get_hour() . ' ' . $task->get_day() . ' ' . $task->get_day_of_week() . ' ' . $task->get_month() . ' ' . $task->get_day_of_week();
$nextrun = $task->get_next_run_time();
$plugininfo = core_plugin_manager::instance()->get_plugin_info($task->get_component());
$plugindisabled = $plugininfo && $plugininfo->is_enabled() === false && !$task->get_run_if_component_disabled();
if ($plugindisabled) {
$nextrun = get_string('plugindisabled', 'tool_task');
} else {
if ($task->get_disabled()) {
$nextrun = get_string('taskdisabled', 'tool_task');
} else {
if ($nextrun > time()) {
$nextrun = userdate($nextrun);
} else {