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

err_removing_unremovable_folder exception gets invalid parameters

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.1.6, 3.2.3
    • Component/s: Libraries
    • Labels:
    • Testing Instructions:
      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).
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-58114-master-excparams

      Description

      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
      

        Attachments

          Activity

            People

            Assignee:
            mudrd8mz David Mudrák (@mudrd8mz)
            Reporter:
            mudrd8mz David Mudrák (@mudrd8mz)
            Peer reviewer:
            Juan Leyva
            Integrator:
            David Monllaó
            Tester:
            Marcus Green
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              8/May/17