简体   繁体   中英

Local Plugin tasks are not showing up in the schedule tasks list in moodle

I have made a local plugin. It is installed and shows up under plugins as well as created its initial tables etc, but the task is not appearing in task list.

$tasks = array(
    array(
        'classname' => 'tool_mobilechathelper\task\sync_chats',
        'blocking' => 0,
        'minute' => 0,
        'hour' => 22,
        'day' => '*',
        'dayofweek' => '*',
        'month' => '*'
    ),
);

在此处输入图像描述

Try it this way, the time values should be strings not numbers. They have to match the syntax of unix cron, blocking should stay the same though.

$tasks = array(
    array(
        'classname' => 'tool_mobilechathelper\task\sync_chats',
        'blocking' => 0,
        'minute' => '0',
        'hour' => '22',
        'day' => '*',
        'dayofweek' => '*',
        'month' => '*'
    ),
);

Also, make sure to have namespace in your task class,

namespace tool_mobilechathelper\task;

and upgrade your version.php , then run php admin/cli/upgrade.php .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM