Moodle 2.8 Scheduled Task question

Moodle 2.8 Scheduled Task question

yazan Clem Smith -
Yanıt sayısı: 4

I am working on creating a new scheduled task that is in a plug-in of its own. Moodle has detected the version.php file and lists it as a plug-in. However, it has not added the scheduled task - and I even increased the version number once to try to get it to find it. When I try to run it from the command line, I get this error:

Task '\local_plugin_name\task\plugin_class_name' not found

One thing that I can see *might* be a problem is that my plugin name has an underscore in it. So, it's "something_else", which makes the plug-in's namespace into "local_something_else". Any suggestions for what to look at or how I might fix this will be quite appreciated!

Clem Smith yanıt olarak

Re: Moodle 2.8 Scheduled Task question

yazan Justin Hunt -
Core developers 'ın resmi Particularly helpful Moodlers 'ın resmi Plugin developers 'ın resmi
I think the name of the file is also important. Underscores are ok.
Look at other classes for how they do it. Two of my own, look like this..

For the ad_hoc task in the poodll filter.

In [Moodle]/filter/poodll/classes/task/adhoc_convert_media.php

namespace filter_poodll\task;
defined('MOODLE_INTERNAL') || die();
class adhoc_convert_media extends \core\task\adhoc_task

For a scheduled task in the waitinglist enrolment plugin (unreleased):
in [Moodle]/enrol/waitinglist/classes/task/waitinglisttask.php

namespace enrol_waitinglist\task;
class waitinglisttask extends \core\task\scheduled_task {

Hope that helps
Justin Hunt yanıt olarak

Re: Moodle 2.8 Scheduled Task question

yazan Clem Smith -

Justin,

Thanks! That did the trick. It was a bad file name. So, I fixed that and then had to bump the version number of my plug-in and now Moodle is able to find it.

Thanks again!

Clem

Clem Smith yanıt olarak

Re: Moodle 2.8 Scheduled Task question

yazan Damyon Wiese -
Core developers 'ın resmi Moodle HQ 'ın resmi Plugin developers 'ın resmi Testers 'ın resmi
Damyon Wiese yanıt olarak

Re: Moodle 2.8 Scheduled Task question

yazan Clem Smith -

Damyon,

Thank you for that link. I've now bookmarked it for ease of reference. I hadn't thought to look that up before I posted on Friday.

Clem