You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use the minVersionRequired setting however it doesn't appear to get recognized. I'm testing in an upgrade from Craft 2 to Craft 3. The initial upgrade of the Craft db goes fine. And then, when I hit the upgrade button the second time to trigger the plugin updates
The upgrade appears to hit this line in craft\services\Plugins and return false and the minVersionRequired never gets checked:
if (!Craft::$app->getIsInMaintenanceMode() && $this->hasPluginVersionNumberChanged($plugin) && !$this->doesPluginRequireDatabaseUpdate($plugin)) {
In my test, this conditional's parts resolve to the following values:
Statement
Value
!Craft::$app->getIsInMaintenanceMode()
true
$this->hasPluginVersionNumberChanged($plugin)
true
!$this->doesPluginRequireDatabaseUpdate($plugin)
false
And, in checking the doesPluginRequireDatabaseUpdate statement the plugin in question does return two different schema versions, so $this->doesPluginRequireDatabaseUpdate($plugin) does correctly evaluate to true before it gets negated.
Changing !$this->doesPluginRequireDatabaseUpdate($plugin) (with the Not operator) to $this->doesPluginRequireDatabaseUpdate($plugin) (without the Not operator) resolves the conditional as I'd expect it, as the plugin has a new version and new schema version, and throws the expected HttpException informing the user they need to upgrade to a particular version of the plugin in question before triggering the migrations for the current version of the plugin that is present during the migration.
Steps to reproduce
Prepare a Craft 2 db with a custom plugin
Prepare a Craft 3 install with a newer version of the custom plugin that uses the minVersionRequired setting to match a version of the plugin between what is on the Craft 2 site and the latest version on the Craft 3 site
Trigger the db migration from the Craft 3 /admin URL
Additional info
Craft version: 3.6.x
PHP version: 7.4
Database driver & version: mysql
Plugins & versions: various
The text was updated successfully, but these errors were encountered:
I believe one other scenario could trigger this issue. I'm not sure if the situation matters. But just to note it here.
If the first plugin being updated does not have a minVersionRequired and throws an error, the update process will be halted and Craft will be put into maintenance mode. Then, if the user tries refreshing the page to continue the migration process, Craft::$app->getIsInMaintenanceMode() will return true and this condition for the minVersionRequired check will return false and skip the minVersionRequired check for all plugins that come after the initial plugin or condition that triggered maintenance mode.
Description
I'm trying to use the
minVersionRequired
setting however it doesn't appear to get recognized. I'm testing in an upgrade from Craft 2 to Craft 3. The initial upgrade of the Craft db goes fine. And then, when I hit the upgrade button the second time to trigger the plugin updatesThe upgrade appears to hit this line in
craft\services\Plugins
and return false and theminVersionRequired
never gets checked:In my test, this conditional's parts resolve to the following values:
true
true
false
And, in checking the
doesPluginRequireDatabaseUpdate
statement the plugin in question does return two different schema versions, so$this->doesPluginRequireDatabaseUpdate($plugin)
does correctly evaluate totrue
before it gets negated.Changing
!$this->doesPluginRequireDatabaseUpdate($plugin)
(with the Not operator) to$this->doesPluginRequireDatabaseUpdate($plugin)
(without the Not operator) resolves the conditional as I'd expect it, as the plugin has a new version and new schema version, and throws the expectedHttpException
informing the user they need to upgrade to a particular version of the plugin in question before triggering the migrations for the current version of the plugin that is present during the migration.Steps to reproduce
minVersionRequired
setting to match a version of the plugin between what is on the Craft 2 site and the latest version on the Craft 3 siteAdditional info
The text was updated successfully, but these errors were encountered: