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

Add a callback for after config.php is loaded

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Pick a random plugin and add a test callback:

        // mod/resource/lib.php
        function mod_resource_after_config() {
            error_log("hello world");
        }
        

      2. Purge caches:

        php admin/cli/purge_caches.php
        

      3. Tail the apache error log:

        tail -f /var/log/apache2/error.log
        

        Note: This may be in a different location depending on system.

      4. Load any page in Moodle
        1. Confirm that you see the string "hello world" in the error log
      5. Replace the call to error log with an exception:

        function mod_resource_after_config(){
            throw new Exception('test');
        }
        

      6. Reload the page
        1. Confirm that you there was an error shown on screen, and in the error log
        2. Confirm that the page still loaded as normal 
      Show
      Pick a random plugin and add a test callback: // mod/resource/lib.php function mod_resource_after_config() { error_log("hello world"); } Purge caches: php admin/cli/purge_caches.php Tail the apache error log: tail -f /var/log/apache2/error.log Note: This may be in a different location depending on system. Load any page in Moodle Confirm that you see the string "hello world" in the error log Replace the call to error log with an exception: function mod_resource_after_config(){ throw new Exception('test'); } Reload the page Confirm that you there was an error shown on screen, and in the error log Confirm that the page still loaded as normal  
    • Affected Branches:
      MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE
    • Pull Master Branch:

      Description

      We want a clean entry point to be called on every full bootstrap, which is not reliant on login

      Docs will be here: https://docs.moodle.org/dev/Callbacks

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Nov/19

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 35 minutes
                35m