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

Have an admin_setting which exposes a check

XMLWordPrintable

    • MOODLE_401_STABLE
    • MOODLE_404_STABLE
    • mdl67898-check-setting-admintree
    • Hide

      Test normal

      1. Navigate to /admin/settings.php?section=manageantiviruses
      2. Ensure that ClamAV antivirus is disabled (eye with cross icon is shown)
      3. Under "Antivirus status check" confirm it says "N/A No antivirus scanners are currently enabled"
      4. Enable the ClamAV antivirus (click the eye with cross icon and it should become a normal eye icon)
      5. Under "Antivirus status check" confirm it says "OK 1 antivirus scanner(s) enabled, no issues have been detected in the last 20 mins" in a green notification

      Test details showing

      1. Open the file admin/settings/plugin.php, around line 189 where the admin_setting_check has been added for the antivirus() check
      2. Enter true as the last parameter to admin_setting_check on the line from step 1, and save the changes. I.e. you should have this: 

        $temp->add(new admin_setting_check('antivirus/checkantivirus', new \core\check\environment\antivirus(), true)); 

      1. Navigate to /admin/settings.php?section=manageantiviruses and reload the page
      2. Next to the "antivirus | checkantivirus" setting, Confirm there is text below the notification such as "This status checks whether or not there has been a recent error detected based on the threshold set in the main antivirus settings."
      Show
      Test normal Navigate to /admin/settings.php?section=manageantiviruses Ensure that ClamAV antivirus is disabled (eye with cross icon is shown) Under "Antivirus status check" confirm it says "N/A No antivirus scanners are currently enabled" Enable the ClamAV antivirus (click the eye with cross icon and it should become a normal eye icon) Under "Antivirus status check" confirm it says "OK 1 antivirus scanner(s) enabled, no issues have been detected in the last 20 mins" in a green notification Test details showing Open the file admin/settings/plugin.php, around line 189 where the admin_setting_check has been added for the antivirus() check Enter true as the last parameter to admin_setting_check on the line from step 1, and save the changes. I.e. you should have this:  $temp->add( new admin_setting_check( 'antivirus/checkantivirus' , new \core\check\environment\antivirus(), true )); Navigate to /admin/settings.php?section=manageantiviruses and reload the page Next to the "antivirus | checkantivirus" setting, Confirm there is text below the notification such as "This status checks whether or not there has been a recent error detected based on the threshold set in the main antivirus settings."

      Builds on top of MDL-67818

      Lots of plugins define some settings like url + api keys, and then have some sort of conditional inline notification to add a connect check. This would just be some convenience classes so that once you have defined a check you can just expose that in the admin tree directly and remove a chunk of duplication.

      • Expose all checks as a web service so we get ajax for free
      • Create a new admin setting which is passed in the check object
      • Renders minimal generic info which is what gets searched in the admin tree
      • If the check is visible on the loaded admin page either in a search or in a settings page then fire ajax call to load in the details
      • If it passes or fails show a notification
      • link to the action
      • find a simple candidate in core which is easy to test to convert over, eg auth_ldap connection check

            matthewhilton Matthew Hilton
            brendanheywood Brendan Heywood
            Brendan Heywood Brendan Heywood
            Ilya Tregubov Ilya Tregubov
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            2 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 59 minutes
                1h 59m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.