I'm attempting to add a scheduled task to a block plugin I'm working on and have been banging my head against a wall the last couple of days. When I upload/upgrade the plugin I receive the following message about the newly added task:
Failed to load task: \process_integrityadvocate line 270 of \lib\classes\task\manager.php: call to debugging() line 68 of \lib\classes\task\manager.php: call to core\task\manager::scheduled_task_from_record() line 88 of \lib\classes\task\manager.php: call to core\task\manager::load_default_scheduled_tasks_for_component() line 959 of \lib\upgradelib.php: call to core\task\manager::reset_scheduled_tasks_for_component() line 446 of \lib\upgradelib.php: call to upgrade_plugins_blocks() line 1754 of \lib\upgradelib.php: call to upgrade_plugins() line 699 of \admin\index.php: call to upgrade_noncore()
Here is block_integrityadvocate_review.php
class block_integrityadvocate_review extends block_base { public function init() { $this--->title = get_string('integrityadvocate_review', 'block_integrityadvocate_review'); } function applicable_formats() { return array('all' => true); } public function get_content() { // This works fine } }
\db\tasks.php
$tasks = [ [ 'classname' => 'block_integrityadvocate_review\task\process_integrityadvocate', 'blocking' => 0, 'minute' => '*', 'hour' => '*', 'day' => '*', 'month' => '*', 'dayofweek' => '*', ], ];
\classes\tasks\process_integrityadvocate.php
namespace block_integrityadvocate_review\task; class process_integrityadvocate extends \core\task\scheduled_task { public function get_name() { return get_string('process_integrityadvocate', 'block_integrityadvocate_review'); } public function execute() { // perform actions here } }
version.php
$plugin->component = 'block_integrityadvocate_review'; $plugin->version = 2016122905; $plugin->requires = 2014051200;
I'm pretty sure I'm messing something easy up, but for the life of me I can't seem to figure out what it is. Any assistance would be appreciated.