diff --git a/SemanticExternalQueryLookup.php b/SemanticExternalQueryLookup.php deleted file mode 100644 index 323263f..0000000 --- a/SemanticExternalQueryLookup.php +++ /dev/null @@ -1,44 +0,0 @@ - $GLOBALS['seqlgExternalRepositoryEndpoints'] - ]; - - $hookRegistry = new HookRegistry( - $options - ); - - $hookRegistry->register(); - } - - /** - * @since 1.0 - * - * @return string|null - */ - public static function getVersion() { - return SEQL_VERSION; - } - -} diff --git a/extension.json b/extension.json index cf88cc8..1c17760 100644 --- a/extension.json +++ b/extension.json @@ -22,11 +22,8 @@ "AutoloadNamespaces": { "SEQL\\": "src/" }, - "AutoloadClasses": { - "SemanticExternalQueryLookup": "SemanticExternalQueryLookup.php" - }, "ExtensionFunctions": [ - "SemanticExternalQueryLookup::onExtensionFunction" + "SEQL\\Setup::onExtensionFunction" ], "config_prefix": "seqlg", "config": { @@ -51,6 +48,5 @@ "description": "An array defines list of namespaces allowed to execute queries against remote sources. Keep empty to allow every namespace." } }, - "load_composer_autoloader": true, "manifest_version": 2 } diff --git a/src/Setup.php b/src/Setup.php new file mode 100644 index 0000000..2dd4b14 --- /dev/null +++ b/src/Setup.php @@ -0,0 +1,31 @@ + $GLOBALS['seqlgExternalRepositoryEndpoints'] + ]; + + $hookRegistry = new HookRegistry( + $options + ); + + $hookRegistry->register(); + } + +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php index efc983d..5a0c94b 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -12,11 +12,13 @@ die( 'The SemanticMediaWiki test autoloader is not available' ); } -if ( !class_exists( 'SemanticExternalQueryLookup' ) || ( $version = SemanticExternalQueryLookup::getVersion() ) === null ) { - die( "\nSemantic External Query Lookup is not available, please check your Composer or LocalSettings.\n" ); +if ( !is_readable( $extensionJson = __DIR__ . '/../extension.json' ) ) { + die( 'The SemanticExternalQueryLookup extension.json is not readable' ); } -print sprintf( "\n%-20s%s\n", "Semantic External Query Lookup: ", SEQL_VERSION ); +$extensionInfo = json_decode( file_get_contents( $extensionJson ), true ); + +print sprintf( "\n%-20s%s\n", "Semantic External Query Lookup: ", $extensionInfo['version'] ?? 'UNKNOWN' ); $autoLoader = require $autoloaderClassPath; $autoLoader->addPsr4( 'SEQL\\Tests\\', __DIR__ . '/phpunit/Unit' );