We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
lenz\linkfield\listeners\ElementListenerState->flush gets called in a Plugins::EVENT_AFTER_LOAD_PLUGINS event handler. That is before the application is marked as fully initialized and thus every ElementQuery will output a warning, that the application is not fully initialized: https://github.com/craftcms/cms/blob/3caf4c317bb581bc3e063b026eb339a56625a945/src/elements/db/ElementQuery.php#L1224-L1226
lenz\linkfield\listeners\ElementListenerState->flush
Plugins::EVENT_AFTER_LOAD_PLUGINS
ElementQuery
Use the WebApplication::EVENT_INIT event instead (besides its name, it also gets fired in Console request): https://github.com/craftcms/cms/blob/3caf4c317bb581bc3e063b026eb339a56625a945/src/base/ApplicationTrait.php#L1476-L1484
WebApplication::EVENT_INIT
Here's a stack trace of one of these warnings (converted into an exception):
2022-07-05 12:51:57 [console.ERROR] [application] Exception 'LogicException' with message 'Element query executed before Craft is fully initialized.' in /app/app/vendor/craftcms/cms/src/elements/db/ElementQuery.php:1226 Stack trace: #0 /app/app/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare(Object(craft\db\mysql\QueryBuilder)) #1 /app/app/vendor/yiisoft/yii2/db/Query.php(157): yii\db\QueryBuilder->build(Object(craft\elements\db\EntryQuery)) #2 /app/app/vendor/yiisoft/yii2/db/Query.php(287): yii\db\Query->createCommand(Object(craft\db\Connection)) #3 /app/app/vendor/craftcms/cms/src/db/Query.php(180): yii\db\Query->one(NULL) #4 /app/app/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1471): craft\db\Query->one(NULL) #5 /app/app/vendor/sebastianlenz/linkfield/src/listeners/ElementListenerState.php(233): craft\elements\db\ElementQuery->one() #6 /app/app/vendor/sebastianlenz/linkfield/src/listeners/ElementListenerState.php(143): lenz\linkfield\listeners\ElementListenerState->loadNextEntryChangeDate() #7 /app/app/vendor/sebastianlenz/linkfield/src/listeners/ElementListener.php(49): lenz\linkfield\listeners\ElementListenerState->flush() #8 /app/app/vendor/sebastianlenz/linkfield/src/Plugin.php(90): lenz\linkfield\listeners\ElementListener->processStatusChanges() #9 [internal function]: lenz\linkfield\Plugin->onAfterLoadPlugins(Object(yii\base\Event)) #10 /app/app/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Array, Object(yii\base\Event)) #11 /app/app/vendor/yiisoft/yii2/base/Component.php(642): yii\base\Event::trigger('craft\\services\\...', 'afterLoadPlugin...', Object(yii\base\Event)) #12 /app/app/vendor/craftcms/cms/src/services/Plugins.php(275): yii\base\Component->trigger('afterLoadPlugin...') #13 /app/app/vendor/craftcms/cms/src/base/ApplicationTrait.php(1477): craft\services\Plugins->loadPlugins() #14 /app/app/vendor/craftcms/cms/src/console/Application.php(52): craft\console\Application->_postInit() #15 /app/app/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\console\Application->init() #16 /app/app/vendor/yiisoft/yii2/base/Application.php(204): yii\base\BaseObject->__construct(Array) #17 /app/app/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array) #18 [internal function]: yii\console\Application->__construct(Array) #19 /app/app/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass->newInstanceArgs(Array) #20 /app/app/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build('craft\\console\\A...', Array, Array) #21 /app/app/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\\console\\A...', Array, Array) #22 /app/app/vendor/craftcms/cms/src/Craft.php(53): yii\BaseYii::createObject(Array, Array) #23 /app/app/vendor/craftcms/cms/bootstrap/bootstrap.php(239): Craft::createObject(Array) #24 /app/app/vendor/craftcms/cms/bootstrap/console.php(40): require('/app/app/vendor...') #25 /app/app/craft(12): require('/app/app/vendor...') #26 {main} {"memory":20457680}
The text was updated successfully, but these errors were encountered:
@sebastian-lenz will there be a release with this fix? Our logs are full of this error.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
lenz\linkfield\listeners\ElementListenerState->flush
gets called in aPlugins::EVENT_AFTER_LOAD_PLUGINS
event handler. That is before the application is marked as fully initialized and thus everyElementQuery
will output a warning, that the application is not fully initialized:https://github.com/craftcms/cms/blob/3caf4c317bb581bc3e063b026eb339a56625a945/src/elements/db/ElementQuery.php#L1224-L1226
Use the
WebApplication::EVENT_INIT
event instead (besides its name, it also gets fired in Console request):https://github.com/craftcms/cms/blob/3caf4c317bb581bc3e063b026eb339a56625a945/src/base/ApplicationTrait.php#L1476-L1484
Here's a stack trace of one of these warnings (converted into an exception):
The text was updated successfully, but these errors were encountered: