gjbarnard / moodle-theme_adaptable

Adaptable theme for Moodle
GNU General Public License v3.0
7 stars 11 forks source link

Exception - Class "theme_adaptable_admin_settingspage" not found #22

Closed alyfilipe closed 5 months ago

alyfilipe commented 5 months ago

Hi,

Our Moodle environment was updated from version 4.1 to 4.3. The theme adaptable version is 400.1.3. When trying to update the plugin to any higher version (including 400.1.5) we received the following error:

Exception - Class "theme_adaptable_admin_settingspage" not found

Thanks

gjb2048 commented 5 months ago

Class does exist https://github.com/gjbarnard/moodle-theme_adaptable/blob/V403.1.2/classes/admin_settingspage.php#L31 - please turn on developer level debugging to get a stack trace.

alyfilipe commented 5 months ago

I finished all the updates, leaving only the adaptable upgrade. Now I enabled debug, and again tried to update. Miraculously it worked without errors. I don't know what it was... But having worked, we can close the issue. Thank you for the quick response and attention.

gjb2048 commented 5 months ago

Dear @alyfilipe,

No problem, glad its sorted. They'll be another update to the theme soon to fix an issue with custom JS.

G

mathbruyen commented 5 months ago

Having the same class not found on one instance running Moodle 4.1.7 after upgrading Adaptable theme from 400.1.5 to 401.1.9. Moodle works fine when adding require_once(dirname(__FILE__) . '/classes/admin_settingspage.php'); somewhere, I'm not familiar with Moodle (auto)loading so I'm not sure what should trigger this. Trying to clear themes cache did not solve the issue.

Enabling stacktraces gives:

Exception : Class "theme_adaptable_admin_settingspage" not found
Debug info:
Error code: generalexceptionmessage
Stack trace:

    line 29 of /theme/adaptable/settings/importexport_settings.php: Error thrown
    line 81 of /theme/adaptable/settings.php: call to require()
    line 59 of /admin/settings/appearance.php: call to include()
    line 8876 of /lib/adminlib.php: call to require()
    line 8759 of /lib/adminlib.php: call to admin_get_root()
    line 28 of /admin/search.php: call to admin_externalpage_setup()

Exception : Class "theme_adaptable_admin_settingspage" not found
Debug info:
Error code: generalexceptionmessage
Stack trace:

    line 29 of /theme/adaptable/settings/importexport_settings.php: Error thrown
    line 81 of /theme/adaptable/settings.php: call to require()
    line 59 of /admin/settings/appearance.php: call to include()
    line 8876 of /lib/adminlib.php: call to require()
    line 4510 of /lib/navigationlib.php: call to admin_get_root()
    line 4373 of /lib/navigationlib.php: call to settings_navigation->load_administration_settings()
    line 838 of /lib/pagelib.php: call to settings_navigation->initialise()
    line 967 of /lib/pagelib.php: call to moodle_page->magic_get_settingsnav()
    line 761 of /lib/classes/navigation/views/secondary.php: call to moodle_page->__get()
    line 236 of /lib/classes/navigation/views/secondary.php: call to core\navigation\views\secondary->load_admin_navigation()
    line 895 of /lib/pagelib.php: call to core\navigation\views\secondary->initialise()
    line 967 of /lib/pagelib.php: call to moodle_page->magic_get_secondarynav()
    line 70 of /theme/boost/layout/drawers.php: call to moodle_page->__get()
    line 1477 of /lib/outputrenderers.php: call to include()
    line 1403 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
    line 2979 of /lib/outputrenderers.php: call to core_renderer->header()
    line 1973 of /lib/setuplib.php: call to core_renderer->fatal_error()
    line 390 of /lib/setuplib.php: call to bootstrap_renderer->__call()
    line ? of unknownfile: call to default_exception_handler()

The upgrade was scripted: created a new docker image with the new plugin which triggers CLI install on startup. Upgrade log:

Le mode de maintenance a été désactivé et le site fonctionne à nouveau normalement
== Mode de maintenance (https://<redacted>) ==
exiting maintenance mode
Cron has been enabled for the site.
re-enabling cron tasks
updating redis-auto-cache store
updating moodle universal cache
uninstalling removed plugins
Mise à jour en ligne de commande de la version 4.1.7 (Build: 20231211) (2022112807) à la version 4.1.7 (Build: 20231211) (2022112807) terminée avec succès.
Nouveau réglage : themesettingadaptable_enablemycourses
Nouveau réglage : themesettingadaptable_marketingvisible
Nouveau réglage : themesettingadaptable_responsivesitetitle
Nouveau réglage : themesettingadaptable_responsiveheadertitle
Nouveau réglage : themesettingadaptable_enablecoursetitle
Nouveau réglage : themesettingadaptable_coursepageheaderhidetitle
Nouveau réglage : themesettingadaptable_headerbgimagetextcolour
Nouveau réglage : themesettingadaptable_slideroption2
Nouveau réglage : themesettingadaptable_slidervisible
Nouveau réglage : themesettingadaptable_enableavailablecourses
Nouveau réglage : themesettingadaptable_gdprbutton
Nouveau réglage : themesettingadaptable_footerlayoutrow3
Nouveau réglage : themesettingadaptable_footerlayoutrow2
Nouveau réglage : themesettingadaptable_footerlayoutrow1
Nouveau réglage : themesettingadaptable_fontsubset
Nouveau réglage : themesettingadaptable_faiv
Nouveau réglage : themesettingadaptable_fav
Nouveau réglage : themesettingadaptable_coursesectionborderradius
Nouveau réglage : themesettingadaptable_coursesectionheaderborderradiustop
Nouveau réglage : themesettingadaptable_coursesectionheaderborderwidth
Nouveau réglage : themesettingadaptable_coursepageblocklayoutlayoutbottomrow2
Nouveau réglage : themesettingadaptable_coursepageblocklayoutlayouttoprow1
Nouveau réglage : themesettingadaptable_courseactivitynavigationenabled
Nouveau réglage : themesettingadaptable_headertextcolor2
Nouveau réglage : themesettingadaptable_buttontexthovercolor
Nouveau réglage : authsettinguserkey_mappingfield
== Réglage des nouvelles valeurs par défaut ==
++ Succès (0,27 secondes) ++
-->local_reminders
++ Succès (0,52 secondes) ++
-->theme_adaptable
++ Succès (0,67 secondes) ++
-->mod_customcert
upgrading database
All scheduled and adhoc tasks finished.
Allocating 1 min for the tasks to finish.
Cron has been disabled for the site.
stopping cron tasks
Votre site est actuellement en mode de maintenance CLI. Aucun accès web n'est autorisé.
== Mode de maintenance (https://<redacted>) ==
enabling maintenance mode
gjb2048 commented 5 months ago

@mathbruyen Not sure, have a hunch, next release will have changes.

gjb2048 commented 5 months ago

@mathbruyen Can't replicate but have improved this area anyway.

mathbruyen commented 5 months ago

Can't use latest release as we are still on Moodle 4.1, but strangely it got autofixed this morning. I wonder if a cache was retaining the list of classes of the plugin, but that would be strange too because I triggered cache purge and it did not fix the issue on Friday.

Since test website is working, I will try deploying to the actual learning site out of working hours and see if that causes the issue there as well (if it crashes, will apply the dirty workaround temporarily).

mathbruyen commented 4 months ago

Test website "magically" got back working after 48h, production websites migrated without any issue. I wonder whether using progressive rollout while migration is in progress and health checks run could be the issue, something like

  1. migration pod created, enables maintenance mode, starts upgrade which clears caches
  2. existing pod receives HTTP ping, which despite maintenance fills the cache with its "old" information
  3. migration pod completes, new pod progressively replace old pods but cache is invalid
gjb2048 commented 4 months ago

Pod?

mathbruyen commented 4 months ago

Sorry using Kubernetes jargon, instance if you wish. During upgrades I first start a temporary process on a new instance to run migration process while old instances are alive (but in maintenance mode). Once migration is done one new instance is created, an old is deleted, and so on until old instances are all deleted.

gjb2048 commented 4 months ago

Ok, so is there anything I need to do Adaptable wise?