moodleou / moodle-mod_oublog

Alternative blog module for Moodle 2 (including course blogs)
31 stars 27 forks source link

Plugin causes error during install on Moodle 4.1 #135

Open cwarwicker opened 1 year ago

cwarwicker commented 1 year ago
!!! Cannot be executed during upgrade !!!
!! 
Error code: cannotexecduringupgrade !!
!! Stack trace: * line 1464 of /lib/setuplib.php: moodle_exception thrown
* line 2569 of /lib/modinfolib.php: call to upgrade_ensure_not_running()
* line 590 of /course/lib.php: call to get_fast_modinfo()
* line 633 of /course/lib.php: call to course_create_sections_if_missing()
* line 22 of /mod/oublog/settings.php: call to course_add_cm_to_section()
* line 158 of /lib/classes/plugininfo/mod.php: call to include()
* line 47 of /admin/settings/plugins.php: call to core\plugininfo\mod->load_settings()
* line 8780 of /lib/adminlib.php: call to require()
* line 8810 of /lib/adminlib.php: call to admin_get_root()
* line 281 of /admin/cli/upgrade.php: call to admin_apply_default_settings()
 !!

This is due to the "Dodgy hack to setup the global blog instance (section not created yet on install)." on line 17 of settings.php

sammarshallou commented 1 year ago

Yeah. Um, we're running 4.1 but I guess this doesn't break because we already installed it... Not quite sure why it doesn't break Behat tests etc, perhaps it's ok if you install the whole system together and only fails if you have the system installed but not oublog yet.

The code should probably be changed so that if it needs to do part of creation after install, it does so with an ad-hoc task. (Maybe just do the whole thing as ad-hoc task instead of the weird split it seems to have at the moment.)

I've filed an issue #695254 in our internal tracking system, it's not my team so I don't know when it might get fixed.