diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 369a42e..4421831 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,41 +1,11 @@ name: Code Style -on: [ push, pull_request ] +on: [ push, pull_request, workflow_dispatch ] jobs: test-php: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install composer dependencies - run: composer install - - - - name: Run composer tests - run: composer test - + uses: Liquipedia/CI-templates/.github/workflows/.php-ci.yml@main test-javascript: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install npm dependencies - run: npm install - - - name: Run npm tests - run: npm run test-script - - test-style: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install npm dependencies - run: npm install - - - name: Run npm tests - run: npm run test-style + uses: Liquipedia/CI-templates/.github/workflows/.javascript-ci.yml@main + test-css: + uses: Liquipedia/CI-templates/.github/workflows/.css-ci.yml@main diff --git a/extension.json b/extension.json index f43a094..f419576 100644 --- a/extension.json +++ b/extension.json @@ -1,6 +1,6 @@ { "name": "Dota2WebApi", - "version": "1.3.0", + "version": "1.3.1", "author": [ "[https://liquipedia.net/starcraft2/User:ChapatiyaqPTSM Chapatiyaq]", "[https://fo-nttax.de FO-nTTaX]", @@ -11,7 +11,7 @@ "license-name": "MIT", "type": "other", "requires": { - "MediaWiki": ">= 1.35.0", + "MediaWiki": ">= 1.35.3", "extensions": { "Dota2DB": "*" } @@ -22,15 +22,16 @@ ] }, "AutoloadNamespaces": { - "Liquipedia\\Dota2WebApi\\": "src/" + "Liquipedia\\Extension\\Dota2WebApi\\": "src/" + }, + "HookHandlers": { + "Main": { + "class": "\\Liquipedia\\Extension\\Dota2WebApi\\Hooks\\MainHookHandler" + } }, "Hooks": { - "EditPage::showEditForm:initial": [ - "Liquipedia\\Dota2WebApi\\Hooks::onEditPageShowEditFormInitial" - ], - "MakeGlobalVariablesScript": [ - "Liquipedia\\Dota2WebApi\\Hooks::onMakeGlobalVariablesScript" - ] + "EditPage::showEditForm:initial": "Main", + "MakeGlobalVariablesScript": "Main" }, "ResourceModules": { "ext.dota2WebApi.toolbar": { @@ -57,5 +58,5 @@ "localBasePath": "", "remoteExtPath": "Dota2WebApi" }, - "manifest_version": 1 + "manifest_version": 2 } \ No newline at end of file diff --git a/src/Hooks.php b/src/Hooks/MainHookHandler.php similarity index 50% rename from src/Hooks.php rename to src/Hooks/MainHookHandler.php index d52ed57..05dc9dd 100644 --- a/src/Hooks.php +++ b/src/Hooks/MainHookHandler.php @@ -1,18 +1,35 @@ addModules( 'ext.dota2WebApi.toolbar' ); + return true; + } /** * @param array &$vars * @param OutputPage $out * @return bool */ - public static function onMakeGlobalVariablesScript( &$vars, OutputPage $out ) { + public function onMakeGlobalVariablesScript( &$vars, $out ): void { $config = $out->getConfig(); $extensionAssetsPath = $config->get( 'ExtensionAssetsPath' ); $extensionPath = $config->get( 'ScriptPath' ) . '/extensions'; @@ -21,17 +38,6 @@ public static function onMakeGlobalVariablesScript( &$vars, OutputPage $out ) { } $dota2WebApiImagePath = $extensionPath . '/Dota2WebApi/resources/images/'; $vars[ 'wgDota2WebApiImagePath' ] = $dota2WebApiImagePath; - return true; - } - - /** - * @param EditPage &$editPage - * @param OutputPage &$output - * @return bool - */ - public static function onEditPageShowEditFormInitial( EditPage &$editPage, OutputPage &$output ) { - $output->addModules( 'ext.dota2WebApi.toolbar' ); - return true; } }