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

After uninstalling a plugin, the local lang files are not removed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.6.7, 3.7.3, 3.8, 3.9.1
    • Fix Version/s: None
    • Component/s: Installation, Language
    • Labels:
      None
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE

      Description

      If you modify a lang string of a plugin a new local lang file is created or an existing one is updated. In both cases a local lang file does exist in "<moodledata>/lang/<lang>_local/".

      On the start of editing the lang string, in the database the tables "tool_customlang" and "tool_customlang_components" are filled with infos about all installed plugins.

      Everything is fine so far.

      If you uninstall the plugin now, nothing will be cleaned up. This means that all database entries and also the files remain untouched.

      In some cases a debug message is created:

      Unable to find the filename for the component theme_klass
      - line 269 of \admin\tool\customlang\locallib.php: call to debugging()
      - line 232 of \admin\tool\customlang\locallib.php: call to tool_customlang_utils::dump_strings()
      - line 93 of \admin\tool\customlang\index.php: call to tool_customlang_utils::checkin()

      To reproduce this the following steps must be done:

      • You need access to the database tables of the moodle installation.
      • Enable debugging for developers
      • Install some plugin which defines at least one lang string
      • Go to Site administration / language / language customisation
      • Choose a language e.g. "English"
      • Modify a lang string from the plugin you just installed before.
      • Now you can find all plugins including this plugin in the table "tool_customlang_components" and all original lang identifiers  and strings in the table "tool_customlang".
      • In <moodledata>/lang/en_local/ is a file <pluginname>.php
      • Uninstall the plugin.
      • The database records and the local lang file still exist.
      • Remove the local lang file
      • Modify some other lang string from some other plugin from the English lang strings.
      • After saving the modifications the debug message appears.

      In my opinion, some kind of cleanup should be done. I think there are two possibilities to do that:

      1. The plugin manager removes the garbage for each plugin while it is uninstalled
      2. The plugin itself removes this stuff in a hook function

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              grabs Andreas Grabs
              Participants:
              Component watchers:
              Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, cameron1729, David Mudrák (@mudrd8mz), Helen Foster
              Votes:
              4 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: