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

Uninstalled plugin breaks the custom lang tool if it had some strings customised

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Test 

      1. Enable debugging for developers
      2. Go to Site administration > Language > Language customisation
      3. Choose a language, e.g. "English"
      4. Click on Open language pack for editing button
      5. In the Filter Strings section, select auth_shibboleth.php and click Show strings button
      6. Modify any lang string (adding text in any Local customisation text area)
      7. Click on the Save changes to the language pack button
      8. Go to Site administration > Plugins > Plugins overview
      9. Uninstall the auth_shibboleth plugin (don't forget to remove the folder auth/shibboleth too)
      10. Repeat steps 2 - 4
      11. In the Filter Strings section, select moodle.php and click the Show strings button
      12. Modify any lang string (adding text in any Local customisation text area)
      13. Click on the Save changes to the language pack button
      14. Confirm no debug message appears.
      Show
      Test  Enable debugging for developers Go to Site administration > Language > Language customisation Choose a language, e.g. "English" Click on Open language pack for editing button In the Filter Strings section, select auth_shibboleth.php and click Show strings button Modify any lang string (adding text in any Local customisation text area) Click on the Save changes to the language pack button Go to Site administration > Plugins > Plugins overview Uninstall the auth_shibboleth plugin (don't forget to remove the folder auth/shibboleth too) Repeat steps 2 - 4 In the Filter Strings section, select moodle.php and click the  Show strings button Modify any lang string (adding text in any Local customisation text area) Click on the Save changes to the language pack button Confirm no debug message appears.
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE, MOODLE_39_STABLE
    • Pull from Repository:
    • Pull 3.9 Branch:
    • Pull 3.10 Branch:
      MDL-67515-310
    • Pull 3.11 Branch:
      MDL-67515-311
    • Pull Master Branch:
      MDL-67515-master

      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:
              vmdef Víctor Déniz Falcón
              Reporter:
              grabs Andreas Grabs
              Peer reviewer:
              David Mudrák (@mudrd8mz) David Mudrák (@mudrd8mz)
              Integrator:
              Sara Arjona (@sarjona) Sara Arjona (@sarjona)
              Tester:
              Janelle Barcega Janelle Barcega
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Matteo Scaramuccia, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, David Mudrák (@mudrd8mz), Helen Foster, Víctor Déniz Falcón
              Votes:
              16 Vote for this issue
              Watchers:
              24 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                8/Mar/21

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 6 hours, 45 minutes
                  6h 45m