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

plugin_misplaced_exception is mostly thrown wrongly

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.4, 2.6.1
    • 2.5.6, 2.6.3
    • Libraries
    • MOODLE_25_STABLE, MOODLE_26_STABLE
    • MOODLE_25_STABLE, MOODLE_26_STABLE
    • w11_MDL-44451_m27_addonloc
    • Hide

      1/ rename module to some nonsense
      2/ execute upgrade and verify the exception info
      3/ fix the module name and rename block and execute + verify
      4/ the same with some report

      note: do not use anything with subplugins or dependencies

      Show
      1/ rename module to some nonsense 2/ execute upgrade and verify the exception info 3/ fix the module name and rename block and execute + verify 4/ the same with some report note: do not use anything with subplugins or dependencies

    Description

      Note, there are three places where this exception is thrown, and they are all wrong in the same way

      Two problems:

      1. They all pass $component as the first argument, when it should be $plugin->component

      2. They call core_component::get_component_directory to get the correct install location, but now that method only returns something for plugins that are correctly installed. For non-installed plugins in returns and empty string.

      Therefore, users see errors like:

      Default exception handler: Plugin "mod_customsql" is installed in incorrect location "$CFG->dirroot/mod/customsql", expected location is "" Debug:

      when it should say:

      Default exception handler: Plugin "report_customsql" is installed in incorrect location "$CFG->dirroot/mod/customsql", expected location is "$CFG->dirroot/report/customsql"

      See, for example https://moodle.org/plugins/view.php?plugin=report_customsql.

      When fixing this, there is scope to improve things by moving some of the duplicated code into the exception constructor.

      Attachments

        Activity

          People

            skodak Petr Skoda
            timhunt Tim Hunt
            Tim Hunt Tim Hunt
            Sam Hemelryk Sam Hemelryk
            Marina Glancy Marina Glancy
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              12/May/14