Skip to content

Commit

Permalink
Avoid registering connection providers too early
Browse files Browse the repository at this point in the history
Causes: Premature access to service container
Caused by: https://gerrit.wikimedia.org/r/651539

Drawbacks with the change: Cannot load SMW extensions before
calling enableSemantics. See: #4195
  • Loading branch information
Abijeet authored and JeroenDeDauw committed Jul 12, 2021
1 parent b90066b commit 015e9c4
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ public static function releaseExtensionCheck( &$vars ) {
*/
public static function initExtension( &$vars ) {
Hooks::registerEarly( $vars );

// Register connection providers early to ensure the invocation of SMW
// related extensions such as `wfLoadExtension( 'SemanticCite' );` can
// happen before or after `enableSemantics` so that the check by the
// `ConnectionManager` (#4170) doesn't throw an error when an extension
// access the `Store` during `onExtensionFunction`
self::initConnectionProviders();
}

/**
Expand Down Expand Up @@ -147,6 +140,7 @@ public function init( &$vars, $rootDir ) {
$setupCheck->showErrorAndAbort( $setupCheck->isCli() );
}

$this->initConnectionProviders();
$this->initMessageCallbackHandler();
$this->addDefaultConfigurations( $vars, $rootDir );

Expand Down Expand Up @@ -197,7 +191,7 @@ private function addDefaultConfigurations( &$vars, $rootDir ) {
}
}

private static function initConnectionProviders() {
private function initConnectionProviders() {

$applicationFactory = ApplicationFactory::getInstance();

Expand Down

0 comments on commit 015e9c4

Please sign in to comment.