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

err_removing_unremovable_folder exception gets invalid parameters

XMLWordPrintable

    • MOODLE_32_STABLE
    • MOODLE_31_STABLE, MOODLE_32_STABLE
    • MDL-58114-master-excparams
    • Hide

      There should be no need to test this, just look at the patch and admit it is corrected now. If you insist on manual testing, here you go:

      1. Install a Moodle plugin via the web interface (so that the web server owns the plugin folder and files).
      2. Attempt to uninstall the plugin from the web interface.
      3. At the screen after the plugin is uninstalled from the DB, Moodle asks whether it should remove the files, too (because it has the write access to all plugin files):

      All data associated with the plugin ... has been deleted from the database. To prevent the plugin re-installing itself, its folder ... must be removed from your server. Do you want to remove the plugin folder now?

      At that moment go to the file system and set chmod / chown in such a way that the web server process is not able to change files.
      4. Go back to the web UI and continue.
      5. TEST: Expected result: The exception is thrown and the $a array has both properties populated with correct values.

      What happened before the patch was that PHP notices were raised and the $a array items were empty (see attached screenshots).

      Show
      There should be no need to test this, just look at the patch and admit it is corrected now. If you insist on manual testing, here you go: 1. Install a Moodle plugin via the web interface (so that the web server owns the plugin folder and files). 2. Attempt to uninstall the plugin from the web interface. 3. At the screen after the plugin is uninstalled from the DB, Moodle asks whether it should remove the files, too (because it has the write access to all plugin files): All data associated with the plugin ... has been deleted from the database. To prevent the plugin re-installing itself, its folder ... must be removed from your server. Do you want to remove the plugin folder now? At that moment go to the file system and set chmod / chown in such a way that the web server process is not able to change files. 4. Go back to the web UI and continue. 5. TEST: Expected result: The exception is thrown and the $a array has both properties populated with correct values. What happened before the patch was that PHP notices were raised and the $a array items were empty (see attached screenshots).

      In the method core_plugin_manager::remove_plugin_folder() the exception is thrown if the plugin folder is not removable. There is a typo - the 4th argument of the moodle_exception constructor must be populated with $plugin values, and not $pluginfo.

      I ran into this when developing a custom script. When the exception was thrown, I got

      Notice: Undefined variable: pluginfo in .../lib/classes/plugin_manager.php on line 1958
      

            mudrd8mz David Mudrák (@mudrd8mz)
            mudrd8mz David Mudrák (@mudrd8mz)
            Juan Leyva Juan Leyva
            David Monllaó David Monllaó
            Marcus Green Marcus Green
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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