-
Notifications
You must be signed in to change notification settings - Fork 642
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
[5.x]: Plugin table not found during site install #15506
Comments
The problem is that your code is latching onto the If you change this condition to: if ($event->isNew && SeoFields::getInstance()?->isInstalled) { It will avoid that error, however you’ll need to test whether that causes other issues downstream. |
Thanks @brandonkelly! Just so I understand how or why this is happening: the event listener gets triggered even though the plug-in is not enabled yet? But the same behaviour doesn't happen for for example element events? Or is this something specific to the install process? |
@janhenckens Sorry, I realized this is an unintended change in behavior in 4.11 and 5.3, due to this change. Just released 4.11.2 and 5.3.3 with a fix, so plugins don’t get instantiated until Craft is actually ready to install them. |
Thanks @brandonkelly! |
@brandonkelly these changes seem to break it for me. The schemaVersion is now always 1.0.0 according to Craft |
@boboldehampsink, this will happen if the plugin doesn’t specify the |
Craft 4.11.4 and 5.3.5 are out with a fix for this. Thanks again for reporting! |
What happened?
Description
In my SEO plugin, I'm listening for
Sites::EVENT_AFTER_SAVE_SITE
to add default values in my now table for the new site. (here)When installing the plugin on its own, that works - but when installing from existing project config files, that contain the plugin, this failed because the table can't be found - (yet?)
Checking the database I see that table doesn't exist yet, and in the plugins table I can see that the plugin isn't actually installed yet - I think.
I tried wrapping my event listeners in
Craft::$app->onInit(function () {});
but the error still happens.What would be the best way to fix this? Thanks!
Craft CMS version
5.3.0.3
PHP version
8.2
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: