From 31cf38462117c0c73d51c869c5cb78276f0d1e50 Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Sun, 10 May 2026 02:15:01 +0200 Subject: [PATCH 1/9] Drop EOL MW versions from CI matrix --- .github/workflows/ci.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e9276b..e3a1a79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,18 +12,6 @@ jobs: strategy: matrix: include: - - mw: 'REL1_36' - php: 8.0 - experimental: false - - mw: 'REL1_37' - php: 8.0 - experimental: false - - mw: 'REL1_38' - php: 8.0 - experimental: false - - mw: 'REL1_39' - php: 8.0 - experimental: false - mw: 'REL1_41' php: 8.1 experimental: false From f9311b0b0ffa498ddffcf5bc1583e0fcd8d9b3e1 Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Sun, 10 May 2026 02:17:42 +0200 Subject: [PATCH 2/9] Also drop REL1_41 and REL1_42 (same security block) --- .github/workflows/ci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3a1a79..c841aed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,12 +12,6 @@ jobs: strategy: matrix: include: - - mw: 'REL1_41' - php: 8.1 - experimental: false - - mw: 'REL1_42' - php: 8.2 - experimental: false - mw: 'REL1_43' php: 8.3 experimental: false From afb6f9ec96a7861df8dc5b7dbed9a0dcaa8e5ceb Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Sun, 10 May 2026 14:47:40 +0200 Subject: [PATCH 3/9] Bump MW requirement to 1.43 and use composer phpunit on master --- .github/workflows/ci.yml | 14 +++++--------- extension.json | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c841aed..eb65984 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,17 +70,13 @@ jobs: - name: Run update.php run: php maintenance/update.php --quick - - name: Run PHPUnit + - name: Run PHPUnit (MW < master) + if: matrix.mw != 'master' run: php tests/phpunit/phpunit.php -c extensions/AutomatedValues/ - if: matrix.php != 7.4 - - name: Run PHPUnit with code coverage - run: php tests/phpunit/phpunit.php -c extensions/AutomatedValues/ --coverage-clover coverage.xml - if: matrix.php == 7.4 - - - name: Upload code coverage - run: bash <(curl -s https://codecov.io/bash) - if: matrix.php == 7.4 + - name: Run PHPUnit (MW master) + if: matrix.mw == 'master' + run: composer phpunit -- -c extensions/AutomatedValues/ diff --git a/extension.json b/extension.json index a54301d..01a580f 100644 --- a/extension.json +++ b/extension.json @@ -16,7 +16,7 @@ "descriptionmsg": "automated-values-description", "requires": { - "MediaWiki": ">= 1.35.0", + "MediaWiki": ">= 1.43.0", "extensions": { "WikibaseRepository": "*" } From 03f9d6b14312f7f239ff7f3ef0d2aae719910786 Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Sun, 10 May 2026 14:50:08 +0200 Subject: [PATCH 4/9] Fetch phpunit.xml.template before running composer phpunit on master --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb65984..63a1dc4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,12 @@ jobs: - name: Run PHPUnit (MW master) if: matrix.mw == 'master' - run: composer phpunit -- -c extensions/AutomatedValues/ + run: | + # phpunit.xml.template is export-ignored from the GitHub tarball, fetch it separately + if [ ! -f phpunit.xml.template ]; then + wget -q -O phpunit.xml.template "https://raw.githubusercontent.com/wikimedia/mediawiki/${{ matrix.mw }}/phpunit.xml.template" + fi + composer phpunit -- extensions/AutomatedValues/tests/ From caabee7a56a9963bc9d923d38a7f725a9514d5be Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Sun, 10 May 2026 14:54:20 +0200 Subject: [PATCH 5/9] Use namespaced Title class for MW master compatibility --- src/AutomatedValuesFactory.php | 2 +- src/Hooks.php | 2 +- src/SpecialAutomatedValues.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/AutomatedValuesFactory.php b/src/AutomatedValuesFactory.php index c2689b3..e47920a 100644 --- a/src/AutomatedValuesFactory.php +++ b/src/AutomatedValuesFactory.php @@ -11,7 +11,7 @@ use ProfessionalWiki\AutomatedValues\DataAccess\RulesJsonValidator; use ProfessionalWiki\AutomatedValues\DataAccess\RulesLookup; use ProfessionalWiki\AutomatedValues\DataAccess\WikiRulesLookup; -use Title; +use MediaWiki\Title\Title; class AutomatedValuesFactory { diff --git a/src/Hooks.php b/src/Hooks.php index 047c677..cf17e39 100644 --- a/src/Hooks.php +++ b/src/Hooks.php @@ -9,7 +9,7 @@ use MediaWiki\Revision\RevisionAccessException; use OutputPage; use ProfessionalWiki\AutomatedValues\DataAccess\RulesJsonValidator; -use Title; +use MediaWiki\Title\Title; use Wikibase\DataModel\Entity\StatementListProvidingEntity; use Wikibase\Repo\Content\EntityContent; diff --git a/src/SpecialAutomatedValues.php b/src/SpecialAutomatedValues.php index 6916f4f..36ced14 100644 --- a/src/SpecialAutomatedValues.php +++ b/src/SpecialAutomatedValues.php @@ -15,9 +15,9 @@ public function __construct() { public function execute( $subPage ): void { parent::execute( $subPage ); - $title = \Title::newFromText( 'MediaWiki:AutomatedValues' ); + $title = \MediaWiki\Title\Title::newFromText( 'MediaWiki:AutomatedValues' ); - if ( $title instanceof \Title ) { + if ( $title instanceof \MediaWiki\Title\Title ) { $this->getOutput()->redirect( $title->getFullURL() ); } } From ac8606f621d5f5a219b7ff8774a62d4717b1fbb9 Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Sun, 10 May 2026 14:59:33 +0200 Subject: [PATCH 6/9] Use REL1_43 with PHP 8.3 for static analysis jobs --- .github/workflows/ci.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 63a1dc4..247b573 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 7.4 + php-version: 8.3 extensions: mbstring tools: composer, cs2pr @@ -111,7 +111,7 @@ jobs: mediawiki mediawiki/extensions/ mediawiki/vendor/ - key: mw_phpstan + key: mw_phpstan_v2 - name: Cache Composer cache uses: actions/cache@v4 @@ -126,7 +126,7 @@ jobs: - name: Install MediaWiki if: steps.cache-mediawiki.outputs.cache-hit != 'true' working-directory: ~ - run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_39 AutomatedValues + run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_43 AutomatedValues - uses: actions/checkout@v4 with: @@ -159,7 +159,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 7.4 + php-version: 8.3 extensions: mbstring tools: composer, cs2pr @@ -171,7 +171,7 @@ jobs: mediawiki mediawiki/extensions/ mediawiki/vendor/ - key: mw_psalm + key: mw_psalm_v2 - name: Cache Composer cache uses: actions/cache@v4 @@ -186,7 +186,7 @@ jobs: - name: Install MediaWiki if: steps.cache-mediawiki.outputs.cache-hit != 'true' working-directory: ~ - run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_39 AutomatedValues + run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_43 AutomatedValues - uses: actions/checkout@v4 with: @@ -231,7 +231,7 @@ jobs: mediawiki !mediawiki/extensions/ !mediawiki/vendor/ - key: mw_static_analysis + key: mw_static_analysis_v2 - name: Cache Composer cache uses: actions/cache@v4 @@ -239,10 +239,14 @@ jobs: path: ~/.composer/cache key: composer_static_analysis + - uses: actions/checkout@v4 + with: + path: EarlyCopy + - name: Install MediaWiki if: steps.cache-mediawiki.outputs.cache-hit != 'true' working-directory: ~ - run: curl https://gist.githubusercontent.com/JeroenDeDauw/49a3858653ff4b5be7ec849019ede06c/raw/installMediaWiki.sh | bash -s REL1_36 AutomatedValues + run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_43 AutomatedValues - uses: actions/checkout@v4 with: From 79f0ee7bbfab74329f2348c48e55bc86ba1082fb Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Sun, 10 May 2026 15:03:40 +0200 Subject: [PATCH 7/9] Revert "Use REL1_43 with PHP 8.3 for static analysis jobs" This reverts commit ac8606f621d5f5a219b7ff8774a62d4717b1fbb9. --- .github/workflows/ci.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 247b573..63a1dc4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 7.4 extensions: mbstring tools: composer, cs2pr @@ -111,7 +111,7 @@ jobs: mediawiki mediawiki/extensions/ mediawiki/vendor/ - key: mw_phpstan_v2 + key: mw_phpstan - name: Cache Composer cache uses: actions/cache@v4 @@ -126,7 +126,7 @@ jobs: - name: Install MediaWiki if: steps.cache-mediawiki.outputs.cache-hit != 'true' working-directory: ~ - run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_43 AutomatedValues + run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_39 AutomatedValues - uses: actions/checkout@v4 with: @@ -159,7 +159,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 7.4 extensions: mbstring tools: composer, cs2pr @@ -171,7 +171,7 @@ jobs: mediawiki mediawiki/extensions/ mediawiki/vendor/ - key: mw_psalm_v2 + key: mw_psalm - name: Cache Composer cache uses: actions/cache@v4 @@ -186,7 +186,7 @@ jobs: - name: Install MediaWiki if: steps.cache-mediawiki.outputs.cache-hit != 'true' working-directory: ~ - run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_43 AutomatedValues + run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_39 AutomatedValues - uses: actions/checkout@v4 with: @@ -231,7 +231,7 @@ jobs: mediawiki !mediawiki/extensions/ !mediawiki/vendor/ - key: mw_static_analysis_v2 + key: mw_static_analysis - name: Cache Composer cache uses: actions/cache@v4 @@ -239,14 +239,10 @@ jobs: path: ~/.composer/cache key: composer_static_analysis - - uses: actions/checkout@v4 - with: - path: EarlyCopy - - name: Install MediaWiki if: steps.cache-mediawiki.outputs.cache-hit != 'true' working-directory: ~ - run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_43 AutomatedValues + run: curl https://gist.githubusercontent.com/JeroenDeDauw/49a3858653ff4b5be7ec849019ede06c/raw/installMediaWiki.sh | bash -s REL1_36 AutomatedValues - uses: actions/checkout@v4 with: From 6d1563b10166d25a360678935c7868a84cb52c56 Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Sun, 10 May 2026 15:07:06 +0200 Subject: [PATCH 8/9] Revert "Use namespaced Title class for MW master compatibility" This reverts commit caabee7a56a9963bc9d923d38a7f725a9514d5be. --- src/AutomatedValuesFactory.php | 2 +- src/Hooks.php | 2 +- src/SpecialAutomatedValues.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/AutomatedValuesFactory.php b/src/AutomatedValuesFactory.php index e47920a..c2689b3 100644 --- a/src/AutomatedValuesFactory.php +++ b/src/AutomatedValuesFactory.php @@ -11,7 +11,7 @@ use ProfessionalWiki\AutomatedValues\DataAccess\RulesJsonValidator; use ProfessionalWiki\AutomatedValues\DataAccess\RulesLookup; use ProfessionalWiki\AutomatedValues\DataAccess\WikiRulesLookup; -use MediaWiki\Title\Title; +use Title; class AutomatedValuesFactory { diff --git a/src/Hooks.php b/src/Hooks.php index cf17e39..047c677 100644 --- a/src/Hooks.php +++ b/src/Hooks.php @@ -9,7 +9,7 @@ use MediaWiki\Revision\RevisionAccessException; use OutputPage; use ProfessionalWiki\AutomatedValues\DataAccess\RulesJsonValidator; -use MediaWiki\Title\Title; +use Title; use Wikibase\DataModel\Entity\StatementListProvidingEntity; use Wikibase\Repo\Content\EntityContent; diff --git a/src/SpecialAutomatedValues.php b/src/SpecialAutomatedValues.php index 36ced14..6916f4f 100644 --- a/src/SpecialAutomatedValues.php +++ b/src/SpecialAutomatedValues.php @@ -15,9 +15,9 @@ public function __construct() { public function execute( $subPage ): void { parent::execute( $subPage ); - $title = \MediaWiki\Title\Title::newFromText( 'MediaWiki:AutomatedValues' ); + $title = \Title::newFromText( 'MediaWiki:AutomatedValues' ); - if ( $title instanceof \MediaWiki\Title\Title ) { + if ( $title instanceof \Title ) { $this->getOutput()->redirect( $title->getFullURL() ); } } From fa499fe1c67bb094146410fdf9a9d9cccda15414 Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Sun, 10 May 2026 15:25:23 +0200 Subject: [PATCH 9/9] Migrate to namespaced MediaWiki classes for 1.43+ --- .github/workflows/ci.yml | 22 +++++++++++++--------- src/AutomatedValuesFactory.php | 2 +- src/DataAccess/PageContentFetcher.php | 16 ++++++++++------ src/DataAccess/WikiRulesLookup.php | 5 +++-- src/Hooks.php | 8 ++++---- src/SpecialAutomatedValues.php | 7 ++++--- 6 files changed, 35 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 63a1dc4..7a35f7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 7.4 + php-version: 8.3 extensions: mbstring tools: composer, cs2pr @@ -111,7 +111,7 @@ jobs: mediawiki mediawiki/extensions/ mediawiki/vendor/ - key: mw_phpstan + key: mw_phpstan_v3 - name: Cache Composer cache uses: actions/cache@v4 @@ -126,7 +126,7 @@ jobs: - name: Install MediaWiki if: steps.cache-mediawiki.outputs.cache-hit != 'true' working-directory: ~ - run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_39 AutomatedValues + run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_43 AutomatedValues - uses: actions/checkout@v4 with: @@ -159,7 +159,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 7.4 + php-version: 8.3 extensions: mbstring tools: composer, cs2pr @@ -171,7 +171,7 @@ jobs: mediawiki mediawiki/extensions/ mediawiki/vendor/ - key: mw_psalm + key: mw_psalm_v3 - name: Cache Composer cache uses: actions/cache@v4 @@ -186,7 +186,7 @@ jobs: - name: Install MediaWiki if: steps.cache-mediawiki.outputs.cache-hit != 'true' working-directory: ~ - run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_39 AutomatedValues + run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_43 AutomatedValues - uses: actions/checkout@v4 with: @@ -219,7 +219,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 8.3 extensions: mbstring, intl, php-ast tools: composer @@ -231,7 +231,7 @@ jobs: mediawiki !mediawiki/extensions/ !mediawiki/vendor/ - key: mw_static_analysis + key: mw_static_analysis_v3 - name: Cache Composer cache uses: actions/cache@v4 @@ -239,10 +239,14 @@ jobs: path: ~/.composer/cache key: composer_static_analysis + - uses: actions/checkout@v4 + with: + path: EarlyCopy + - name: Install MediaWiki if: steps.cache-mediawiki.outputs.cache-hit != 'true' working-directory: ~ - run: curl https://gist.githubusercontent.com/JeroenDeDauw/49a3858653ff4b5be7ec849019ede06c/raw/installMediaWiki.sh | bash -s REL1_36 AutomatedValues + run: bash EarlyCopy/.github/workflows/installMediaWiki.sh REL1_43 AutomatedValues - uses: actions/checkout@v4 with: diff --git a/src/AutomatedValuesFactory.php b/src/AutomatedValuesFactory.php index c2689b3..e47920a 100644 --- a/src/AutomatedValuesFactory.php +++ b/src/AutomatedValuesFactory.php @@ -11,7 +11,7 @@ use ProfessionalWiki\AutomatedValues\DataAccess\RulesJsonValidator; use ProfessionalWiki\AutomatedValues\DataAccess\RulesLookup; use ProfessionalWiki\AutomatedValues\DataAccess\WikiRulesLookup; -use Title; +use MediaWiki\Title\Title; class AutomatedValuesFactory { diff --git a/src/DataAccess/PageContentFetcher.php b/src/DataAccess/PageContentFetcher.php index 73e00a8..bbb595d 100644 --- a/src/DataAccess/PageContentFetcher.php +++ b/src/DataAccess/PageContentFetcher.php @@ -4,26 +4,30 @@ namespace ProfessionalWiki\AutomatedValues\DataAccess; +use MediaWiki\Content\Content; use MediaWiki\Revision\RevisionLookup; +use MediaWiki\Title\MalformedTitleException; +use MediaWiki\Title\Title; +use MediaWiki\Title\TitleParser; class PageContentFetcher { - private \TitleParser $titleParser; + private TitleParser $titleParser; private RevisionLookup $revisionLookup; - public function __construct( \TitleParser $titleParser, RevisionLookup $revisionLookup ) { + public function __construct( TitleParser $titleParser, RevisionLookup $revisionLookup ) { $this->titleParser = $titleParser; $this->revisionLookup = $revisionLookup; } - public function getPageContent( string $pageTitle ): ?\Content { + public function getPageContent( string $pageTitle ): ?Content { try { - $title = $this->titleParser->parseTitle( $pageTitle ); - } catch ( \MalformedTitleException $e ) { + $linkTarget = $this->titleParser->parseTitle( $pageTitle ); + } catch ( MalformedTitleException $e ) { return null; } - $revision = $this->revisionLookup->getRevisionByTitle( $title ); + $revision = $this->revisionLookup->getRevisionByTitle( Title::newFromLinkTarget( $linkTarget ) ); if ( $revision === null ) { return null; diff --git a/src/DataAccess/WikiRulesLookup.php b/src/DataAccess/WikiRulesLookup.php index 05cc42a..108641d 100644 --- a/src/DataAccess/WikiRulesLookup.php +++ b/src/DataAccess/WikiRulesLookup.php @@ -4,6 +4,7 @@ namespace ProfessionalWiki\AutomatedValues\DataAccess; +use MediaWiki\Content\JsonContent; use ProfessionalWiki\AutomatedValues\Domain\Rules; class WikiRulesLookup implements RulesLookup { @@ -21,14 +22,14 @@ public function __construct( PageContentFetcher $contentFetcher, RulesDeserializ public function getRules(): Rules { $content = $this->contentFetcher->getPageContent( 'MediaWiki:' . $this->pageName ); - if ( $content instanceof \JsonContent ) { + if ( $content instanceof JsonContent ) { return $this->rulesFromJsonContent( $content ); } return new Rules(); } - private function rulesFromJsonContent( \JsonContent $content ): Rules { + private function rulesFromJsonContent( JsonContent $content ): Rules { return $this->deserializer->deserialize( $content->getText() ); } diff --git a/src/Hooks.php b/src/Hooks.php index 047c677..7ac7f4e 100644 --- a/src/Hooks.php +++ b/src/Hooks.php @@ -4,12 +4,12 @@ namespace ProfessionalWiki\AutomatedValues; -use EditPage; +use MediaWiki\EditPage\EditPage; +use MediaWiki\Html\Html; use MediaWiki\Revision\RenderedRevision; use MediaWiki\Revision\RevisionAccessException; -use OutputPage; +use MediaWiki\Title\Title; use ProfessionalWiki\AutomatedValues\DataAccess\RulesJsonValidator; -use Title; use Wikibase\DataModel\Entity\StatementListProvidingEntity; use Wikibase\Repo\Content\EntityContent; @@ -45,7 +45,7 @@ public static function onEditFilter( EditPage $editPage, ?string $text, ?string && !RulesJsonValidator::newInstance()->validate( $text ) ) { // Would be nice to show a more specific error message, but at the moment RulesJsonValidator does not support this. - $error = \Html::errorBox( wfMessage( 'automated-values-config-invalid' )->escaped() ); + $error = Html::errorBox( wfMessage( 'automated-values-config-invalid' )->escaped() ); } } diff --git a/src/SpecialAutomatedValues.php b/src/SpecialAutomatedValues.php index 6916f4f..ce44d5f 100644 --- a/src/SpecialAutomatedValues.php +++ b/src/SpecialAutomatedValues.php @@ -4,7 +4,8 @@ namespace ProfessionalWiki\AutomatedValues; -use SpecialPage; +use MediaWiki\SpecialPage\SpecialPage; +use MediaWiki\Title\Title; class SpecialAutomatedValues extends SpecialPage { @@ -15,9 +16,9 @@ public function __construct() { public function execute( $subPage ): void { parent::execute( $subPage ); - $title = \Title::newFromText( 'MediaWiki:AutomatedValues' ); + $title = Title::newFromText( 'MediaWiki:AutomatedValues' ); - if ( $title instanceof \Title ) { + if ( $title instanceof Title ) { $this->getOutput()->redirect( $title->getFullURL() ); } }