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

Add a callback for after config.php is loaded

XMLWordPrintable

    • MOODLE_38_STABLE
    • MOODLE_38_STABLE
    • 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  

      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

            brendanheywood Brendan Heywood
            brendanheywood Brendan Heywood
            Peter Burnett Peter Burnett
            Andrew Lyons Andrew Lyons
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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