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

#72 didn't account for installed but not yet upgraded #73

Open
aspark21 opened this issue Dec 19, 2024 · 6 comments
Open

#72 didn't account for installed but not yet upgraded #73

aspark21 opened this issue Dec 19, 2024 · 6 comments

Comments

@aspark21
Copy link

aspark21 commented Dec 19, 2024

#72 didn't account for installed but not yet upgraded

Installed site: Moodle 4.4 & tool_abconfig latest (MOODLE_38_STABLE @ fb793c4 )
Deployed code: Moodle 4.5 & latest tool_abconfig

but following error is encountered if accessing site via web interface before upgrade is performed

Exception - Call to undefined function tool_abconfig\tool_abconfig_after_config()
Debug info:
Error code: generalexceptionmessage
Stack trace:
line 69 of /admin/tool/abconfig/classes/hook_callbacks.php: Error thrown
line ? of unknownfile: call to tool_abconfig\hook_callbacks::after_config()
line 318 of /lib/classes/hook/manager.php: call to call_user_func()
line 1199 of /lib/setup.php: call to core\hook\manager->dispatch()
line 109 of /theme/styles.php: call to require()
@djarran
Copy link
Contributor

djarran commented Dec 20, 2024

Hi @aspark21, I've updated the code in commit 6946957 that should fix this issue, not yet merged.

But I'm having issues replicating this. Here's what I've tried:

  1. install vanilla 4.4 site with tool_abconfig installed and configured
  2. updated code with vanilla 4.5, tool_abconfig still installed and configured, site upgrade not yet ran
  3. browse site

Following these steps, I'm not seeing the error. I'm definitely missing something...

@aspark21
Copy link
Author

That's how I ran into in our test sites, where it only had a minor temporary impact.

But in Staging it seems to have gone a bit more problematic than that (WR449037) - preventing the cli upgrade from running and the site being completely unusable from the web interface,

Admittedly I only did this in sites with full data & 100s of other plugins, not vanilla but I'm not sure what would make it worse

@aspark21
Copy link
Author

Ah, so one way to trigger it is to try to enable maintenance mode via CLI it seems. Unfortunately, that was still occurring with the draft fix.

php admin/cli/maintenance.php --enable
!!! Exception - Call to undefined function tool_abconfig\tool_abconfig_after_config() !!!

@djarran
Copy link
Contributor

djarran commented Jan 8, 2025

I'll be looking into this soon, thanks for finding reproducible steps

@djarran
Copy link
Contributor

djarran commented Jan 9, 2025

Hey @aspark21, I'm still not able to replicate this even with maintenance mode. Here's what I've tried (on commit fb793c4)

  1. install vanilla 4.4 site with tool_abconfig installed and configured
  2. updated code with vanilla 4.5, tool_abconfig still installed and configured, site upgrade not yet ran
  3. browse site - no exceptions, after_config successfully executed
  4. enable maintenance mode
  5. browse site - no exceptions, after_config successfully executed

@dmitriim
Copy link
Member

dmitriim commented Jan 9, 2025

Hi both!

I have experienced similar issues with the plugin on my local dev box working on Moodle 4.5 upgrade for one of our clients. This work involved installing, testing and modifying bunch of different plugins. Some of them got callbacks replaced by hooks same way it happened for tool_abconfig.
What I have observed that at some cases (i can't replicate it reliably yet) newly installed plugins have hooks registration missing, despite upgrade finished without errors. Purging cache, reinstalling plugins and etc didn't really help. The only way I was able to fix it is hacking into hook manager class and bypass using caches here https://github.com/moodle/moodle/blob/main/lib/classes/hook/manager.php#L345 So a list of hook is rebuilt. However. this in some cases broke tool_abconfig in a way it described as part of this issues.

I haven't had a chance to deep dive into this caching issues, but hope this information may help in your investigation.

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

No branches or pull requests

3 participants