Ad hoc task failed to load

Ad hoc task failed to load

بواسطة - Gabriel José Guedes da Silva
عدد الردود: 2

I've been developing a plugin with an hoc task
I have followed the ad hoc tutorial in https://docs.moodle.org/dev/Task_API

  1. Created file take_over_the_world.php inside /myplugin/classes/tasks
  2. imported using: require_once './classes/tasks/take_over_the_world.php';
  3. Instantiated the task inside the plugin: $domination = new take_over_the_world(); ,etc...

But i can't see my task anywhere, except in "path/to/moodle/admin/cron.php?password=xxx" where i can see the following error: 

++ Failed to load task: \take_over_the_world ++ 

* line 292 of /lib/classes/task/manager.php: call to debugging() 

* line 595 of /lib/classes/task/manager.php: call to core\task\manager::adhoc_task_from_record() 

* line 184 of /lib/cronlib.php: call to core\task\manager::get_next_adhoc_task() 

* line 76 of /lib/cronlib.php: call to cron_run_adhoc_tasks() * line 81 of /admin/cron.php: call to cron_run()

متوسط التقييمات: -
رداً على Gabriel José Guedes da Silva

Re: Ad hoc task failed to load

بواسطة - Davo Smith
صورة Core developers صورة Particularly helpful Moodlers صورة Peer reviewers صورة Plugin developers
It would be easier if we could see some code, but my first guess would be, did you set the namespace at the top of the file to: \local_myplugin\task

(assuming 'myplugin' is a 'local' plugin, you haven't stated).