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

Hooks into the file API (backport of MDL-57476)

    XMLWordPrintable

Details

    • MOODLE_32_STABLE, MOODLE_33_STABLE
    • MOODLE_32_STABLE, MOODLE_33_STABLE
    • Hide

      From MDL-57476's testing instructions:

      Breakout your favorite editor. Add these lines to mod/forum/lib.php:

      function forum_after_file_created($file) {
          debugging('forum_create_file');
          var_dump($file);
      }
       
      function forum_after_file_updated($newfile, $oldfile) {
          debugging('forum_update_file');
          if ($newfile->timemodified == $oldfile->timemodified) {
              throw new coding_exception('fail');
          }
          var_dump($newfile, $oldfile);
      }
       
      function forum_after_file_deleted($file) {
          debugging('forum_delete_file');
          var_dump($file);
      }
      

      Drop the attached file_hooks_test.php into the root of your Moodle. Run file_hooks_test.php on the CLI,
      e.g.

      php file_hooks_test.php

      You should see that the three forum hooks are called.

      Show
      From MDL-57476 's testing instructions: Breakout your favorite editor. Add these lines to mod/forum/lib.php: function forum_after_file_created($file) { debugging('forum_create_file'); var_dump($file); }   function forum_after_file_updated($newfile, $oldfile) { debugging('forum_update_file'); if ($newfile->timemodified == $oldfile->timemodified) { throw new coding_exception('fail'); } var_dump($newfile, $oldfile); }   function forum_after_file_deleted($file) { debugging('forum_delete_file'); var_dump($file); } Drop the attached file_hooks_test.php into the root of your Moodle. Run file_hooks_test.php on the CLI, e.g. php file_hooks_test.php You should see that the three forum hooks are called.

    Description

      Please backport MDL-57476 to 3.2 and 3.3

      The file API callbacks are essential for 1 plugin I have worked onĀ and beneficial for the plugin "image optimiser" (filter_imageopt).

      Without the backport there will be a significant barrier to plugin installation / adoption.

      Attachments

        Issue Links

          Activity

            People

              brudinie guy thomas
              brudinie guy thomas
              Jun Pataleta Jun Pataleta
              John Okely John Okely
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Clockify

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