Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-70230

add a new admin setting for scheduled tasks

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Waiting for peer review
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.10
    • Fix Version/s: None
    • Component/s: Administration
    • Testing Instructions:
      Hide
      1. Add a setting admin_setting_scheduled_task_status to a page, for a specific existing scheduled task to a settings.php page. See diff below:
      2. Refresh page (purge caches if needed)
      3. See that the page now shows the status of the specified scheduled task.

       

      Patch example for testing, for where and how it works:

       

      diff --git a/admin/tool/recyclebin/settings.php b/admin/tool/recyclebin/settings.php
      index da19ea75476..2750c289476 100644
      --- a/admin/tool/recyclebin/settings.php
      +++ b/admin/tool/recyclebin/settings.php
      @@ -64,4 +64,10 @@ if ($hassiteconfig) {
               new lang_string('autohide_desc', 'tool_recyclebin'),
               1
           ));
      +
      +    $settings->add(new admin_setting_scheduled_task_status(
      +        'tool_recyclebin/cleanup_category_bin_status', 
      +        '\tool_recyclebin\task\cleanup_category_bin',  
      +        'This is some useful extra description'
      +    ));
       } 

       

      Show
      Add a setting admin_setting_scheduled_task_status to a page, for a specific existing scheduled task to a settings.php page. See diff below: Refresh page (purge caches if needed) See that the page now shows the status of the specified scheduled task.   Patch example for testing, for where and how it works:   diff --git a/admin/tool/recyclebin/settings.php b/admin/tool/recyclebin/settings.php index da19ea75476..2750c289476 100644 --- a/admin/tool/recyclebin/settings.php +++ b/admin/tool/recyclebin/settings.php @@ - 64 , 4 + 64 , 10 @@ if ($hassiteconfig) { new lang_string( 'autohide_desc' , 'tool_recyclebin' ), 1 )); + + $settings->add( new admin_setting_scheduled_task_status( + 'tool_recyclebin/cleanup_category_bin_status' , + '\tool_recyclebin\task\cleanup_category_bin' , + 'This is some useful extra description' + )); }  
    • Affected Branches:
      MOODLE_310_STABLE
    • Pull from Repository:
    • Pull 3.11 Branch:
      MDL-70230-311
    • Pull Master Branch:
      MDL-70230-master

      Description

      Context

      Sometimes admin settings define values that affect the behaviour of scheduled tasks.

      Problem/Idea to improve

       It would be very good to have the status (active, inactive) of the related scheduled task, and a shortcut for the configuration of the shcheduled task.

      Proposal

      Add an admin header-like setting that provides a plain admin setting informing about its status (it's running or not) and a link to its configuration, as a shortcut for updating the task if necessary.

      This admin setting, together with the rest of admin settings related to that, would provide the whole big picture of the task status and settings.

      The class could have this constructor: "admin_setting_scheduled_task(string $name, string $scheduledtaskname[, string $extradescription])" where:

      1. $name is the setting name, as always.
      2. $scheduledtaskname is the name of the scheduled task, as full classpath name.
      3. (optional) $extradescription is a string which can help adding context to the setting page for this given task. This admin setting already provides some lines with the status, the class name and its description. However, we could imagine several tasks settings in a single page, and would help admin users to understand/remember what they do or are related to.

       

        Attachments

          Activity

            People

            Assignee:
            jpahullo Jordi Pujol-Ahulló
            Reporter:
            jpahullo Jordi Pujol-Ahulló
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: