moosh
moosh copied to clipboard
Moodle 4.5 break cache commands
- moosh version: 1.2.1
- moodle version: 4.5.0
- database: 15.8
- php version: 8.3
- operating system: debian (docker)
Actual behaviour
We use moosh to change cachestore between redis and filesystem at runtime. We usually run the following command on our test instance to ensure that it use the filesystem:
moosh --no-user-check cache-edit-mappings --application=default_application --session=default_session
As Moodle 4.5 is out, I tried to install it and the command now fails with the following error:
[07-Oct-2024 16:26:24 Europe/Berlin] PHP Warning: require_once(/var/www/html/cache/locallib.php): Failed to open stream: No such file or directory in /opt/moosh/Moosh/Command/Moodle39/Cache/CacheEditMappings.php on line 39
Warning: require_once(/var/www/html/cache/locallib.php): Failed to open stream: No such file or directory in /opt/moosh/Moosh/Command/Moodle39/Cache/CacheEditMappings.php on line 39
[07-Oct-2024 16:26:24 Europe/Berlin] Default exception handler: Exception - Failed opening required '[dirroot]/cache/locallib.php' (include_path='[dirroot]/lib/pear:.:/usr/local/lib/php') Debug:
Error code: generalexceptionmessage
* line 39 of /opt/moosh/Moosh/Command/Moodle39/Cache/CacheEditMappings.php: Error thrown
* line 363 of /opt/moosh/moosh.php: call to Moosh\Command\Moodle39\Cache\CacheEditMappings->execute()
!!! Exception - Failed opening required '[dirroot]/cache/locallib.php' (include_path='[dirroot]/lib/pear:.:/usr/local/lib/php') !!!
I looked out in the changes of Moodle 4.5 what could be the cause and actually cache/lib.php and cache/locallib.php have been removed during a big refractor: https://tracker.moodle.org/browse/MDL-82158
The merge commit can be found here: https://github.com/moodle/moodle/commit/4f25ac10448fb645c53b98d98d59c5ad71b659cb
It might have broken other Cache command too, but I'm not sure which ones.
Steps to reproduce
- Install moosh on a 4.5 instance
- Run the following command:
moosh --no-user-check cache-edit-mappings --application=default_application --session=default_session