Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cache-edit-mapping and cache-add-redis-store for Moodle 405 #501

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

owngr
Copy link

@owngr owngr commented Oct 10, 2024

Related issue: #500

I'm quite newby with PHP so it might not be the best solution.

cache-edit-mapping

[10-Oct-2024 16:28:36 Europe/Berlin] PHP Warning:  session_set_save_handler(): Session save handler cannot be changed when a session is active in /var/www/html/lib/classes/session/redis.php on line 235

Warning: session_set_save_handler(): Session save handler cannot be changed when a session is active in /var/www/html/lib/classes/session/redis.php on line 235
[10-Oct-2024 16:28:36 Europe/Berlin] Default exception handler: Setting up of redis session failed. Please notify the server administrator. Debug:
Error code: redissessionhandlerproblem
* line 237 of /lib/classes/session/redis.php: core\session\exception thrown
* line 750 of /lib/classes/session/redis.php: call to core\session\redis->init()
* line 688 of /lib/classes/session/redis.php: call to core\session\redis->init_redis_if_required()
* line 996 of /lib/classes/session/manager.php: call to core\session\redis->destroy()
* line 636 of /lib/classes/session/manager.php: call to core\session\manager::destroy()
* line 4078 of /lib/moodlelib.php: call to core\session\manager::login_user()
* line 303 of /opt/moosh/moosh.php: call to complete_user_login()

!!! Setting up of redis session failed. Please notify the server administrator. !!!

Therefore I added the following code in order to avoid a login, I couldn't find a better solution:

public function bootstrapLevel() {
  return self::$BOOTSTRAP_FULL_NO_ADMIN_CHECK;
}

cache-add-redis-store

  • renamed the classes to fit Moodle 405
  • added the following new params disabled by default
    • encryption
    • cafile
    • encryption
  • I had the same issue with the login as cache-edit-mapping and therefore disabled the login

Use 3 digit versions number

I started by naming the folder Moodle45 but still received errors because moosh was using Moodle310 cache-add-redis-store.

Moodle started using 3 digits number version for branch in version.php with Moodle 310.

Therefore, when I tried to use the 45 version it would pickup Moodle 310 as 310 > 45 as you can see here:

 /opt/moosh/moosh.php -v --no-user-check cache-add-redis-store --key-prefix="cache_" "redis" "$MAAS_REDIS_HOST"
Top Moodle dir: /var/www/html
Current working dir: /var/www/html
Relative Moodle dir:
Processing command option 'help''
Processing command option 'password''
Processing command option 'key-prefix''
'key-prefix' option is set on the command line to 'cache_'
Moodle version detected: 405
Command: add-redis-store (cache)
Options:
	help (): ''
	key-prefix (): 'cache_'
Arguments:
	redis redis-master
[10-Oct-2024 12:04:11 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/Moodle310/Cache/CacheAddRedisStore.php on line 37

Warning: require_once(/var/www/html/cache/locallib.php): Failed to open stream: No such file or directory in /opt/moosh/Moosh/Command/Moodle310/Cache/CacheAddRedisStore.php on line 37

The only way to make moosh pickup the right version was to refractor the whole numbering to start using 3 digit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant