-
Bug
-
Resolution: Fixed
-
Blocker
-
3.9.21, 3.11.14, 4.0.8, 4.1.3, 4.2.1
When you queue a removal/installation of a langpack, the page is immediately printed without a redirect after the POST. This means that if the user refreshes the page:
- they get a warning
- we somehow remove the entire lang directory
The removal of all language happens because we accept an array of languages to remove from the POST.
We filter that array using PARAM_LANG
The clean_param() action for PARAM_LANG replaces any invalid lang with an empty string
We were not filtering this out, and through a catastrophe of errors, the code to uninstall a lang wast just appending our empty string to the parent dir, checking if the dir existed, and then removing it.
This patch does not address the stupidity of returning an empty string in this manner - that's probably beyond the scope of this changes as it would equate to a major change in behaviour.
This patch does:
- filter out empty langs
- filter out the default lang
- check in the API call for any similar errors
- add a unit test for the API call for a number of related values
- Discovered while testing
-
MDL-77159 Migrate moodle-core-languninstallconfirm to tool_langimport as ESM
- Closed