Skip to content

Commit f06df8c

Browse files
authored
Improve compatibility with recent MediaWiki versions (#189)
* Fix various issues raised by CI and bump minimum MW requirement to 1.39 * Add tear down step to CI * Test on PHP 8.0 and fix ci * Fix composer * Bump composer cache * Run composer update in CI * Run phpstan and psalm in extension directory * Update alias file and drop old config page redirect * Update all references for the config page * Add null handling to getOptionsFromEntityData * Restore config page redirect * Remove trailing space in ci.yml
1 parent f1bcf11 commit f06df8c

33 files changed

Lines changed: 149 additions & 218 deletions

.github/workflows/ci.yml

Lines changed: 38 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,30 @@ on:
77
jobs:
88
test:
99
name: "PHPUnit: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"
10+
continue-on-error: ${{ matrix.experimental }}
1011

1112
strategy:
13+
fail-fast: false
1214
matrix:
1315
include:
14-
- mw: 'REL1_37'
15-
php: '8.0'
16-
- mw: 'REL1_38'
17-
php: '8.0'
18-
- mw: 'REL1_38'
19-
php: '8.1'
2016
- mw: 'REL1_39'
21-
php: '8.1'
22-
- mw: 'REL1_39'
23-
php: '8.2'
17+
php: 8.0
18+
experimental: false
2419
- mw: 'REL1_40'
25-
php: '8.2'
20+
php: 8.1
21+
experimental: false
22+
- mw: 'REL1_41'
23+
php: 8.2
24+
experimental: false
25+
- mw: 'REL1_42'
26+
php: 8.2
27+
experimental: false
28+
- mw: 'REL1_43'
29+
php: 8.3
30+
experimental: false
31+
- mw: 'master'
32+
php: 8.4
33+
experimental: true
2634

2735
runs-on: ubuntu-latest
2836

@@ -46,13 +54,13 @@ jobs:
4654
mediawiki
4755
!mediawiki/extensions/
4856
!mediawiki/vendor/
49-
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v5
57+
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v8
5058

5159
- name: Cache Composer cache
5260
uses: actions/cache@v4
5361
with:
5462
path: ~/.composer/cache
55-
key: composer-php${{ matrix.php }}
63+
key: composer-php${{ matrix.php }}_v2
5664

5765
- uses: actions/checkout@v4
5866
with:
@@ -67,8 +75,8 @@ jobs:
6775
with:
6876
path: mediawiki/extensions/WikibaseExport
6977

70-
# - name: Composer allow-plugins
71-
# run: composer config --no-plugins allow-plugins.composer/installers true
78+
- name: Composer allow-plugins
79+
run: composer config --no-plugins allow-plugins.composer/installers true
7280

7381
- run: composer update
7482

@@ -91,15 +99,13 @@ jobs:
9199

92100

93101
PHPStan:
94-
name: "PHPStan: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"
102+
name: "Static Analysis: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"
95103

96104
strategy:
97105
matrix:
98106
include:
99-
- mw: 'REL1_37'
100-
php: '8.0'
101-
- mw: 'REL1_38'
102-
php: '8.1'
107+
- mw: 'REL1_43'
108+
php: '8.3'
103109

104110
runs-on: ubuntu-latest
105111

@@ -123,7 +129,7 @@ jobs:
123129
mediawiki
124130
mediawiki/extensions/
125131
mediawiki/vendor/
126-
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v5
132+
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v8
127133

128134
- name: Cache Composer cache
129135
uses: actions/cache@v4
@@ -155,73 +161,9 @@ jobs:
155161
- name: PHPStan
156162
run: cd extensions/WikibaseExport && php vendor/bin/phpstan analyse --error-format=checkstyle --no-progress | cs2pr
157163

158-
159-
160-
161-
Psalm:
162-
name: "Psalm: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"
163-
164-
strategy:
165-
matrix:
166-
include:
167-
- mw: 'REL1_37'
168-
php: '8.0'
169-
- mw: 'REL1_38'
170-
php: '8.1'
171-
172-
runs-on: ubuntu-latest
173-
174-
defaults:
175-
run:
176-
working-directory: mediawiki
177-
178-
steps:
179-
- name: Setup PHP
180-
uses: shivammathur/setup-php@v2
181-
with:
182-
php-version: ${{ matrix.php }}
183-
extensions: mbstring
184-
tools: composer, cs2pr
185-
186-
- name: Cache MediaWiki
187-
id: cache-mediawiki
188-
uses: actions/cache@v4
189-
with:
190-
path: |
191-
mediawiki
192-
mediawiki/extensions/
193-
mediawiki/vendor/
194-
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v5
195-
196-
- name: Cache Composer cache
197-
uses: actions/cache@v4
198-
with:
199-
path: ~/.composer/cache
200-
key: composer_static_analysis
201-
202-
- uses: actions/checkout@v4
203-
with:
204-
path: EarlyCopy
205-
206-
- name: Install MediaWiki
207-
if: steps.cache-mediawiki.outputs.cache-hit != 'true'
208-
working-directory: ~
209-
run: bash EarlyCopy/.github/workflows/installMediaWiki.sh ${{ matrix.mw }} WikibaseExport
210-
211-
- uses: actions/checkout@v4
212-
with:
213-
path: mediawiki/extensions/WikibaseExport
214-
215-
- name: Composer allow-plugins
216-
run: composer config --no-plugins allow-plugins.composer/installers true
217-
218-
- run: composer update
219-
220-
- name: Composer install
221-
run: cd extensions/WikibaseExport && composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
222-
223-
- name: Psalm
224-
run: cd extensions/WikibaseExport && pwd && php vendor/bin/psalm --config=psalm.xml --shepherd --stats
164+
- name: Psalm
165+
run: cd extensions/WikibaseExport && php vendor/bin/psalm --shepherd --stats
166+
if: true
225167

226168

227169

@@ -232,8 +174,8 @@ jobs:
232174
strategy:
233175
matrix:
234176
include:
235-
- mw: 'REL1_39'
236-
php: '8.2'
177+
- mw: 'REL1_43'
178+
php: '8.3'
237179

238180
runs-on: ubuntu-latest
239181

@@ -263,12 +205,16 @@ jobs:
263205
uses: actions/cache@v4
264206
with:
265207
path: ~/.composer/cache
266-
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v5
208+
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v8
209+
210+
- uses: actions/checkout@v4
211+
with:
212+
path: EarlyCopy
267213

268214
- name: Install MediaWiki
269215
if: steps.cache-mediawiki.outputs.cache-hit != 'true'
270216
working-directory: ~
271-
run: curl https://gist.githubusercontent.com/JeroenDeDauw/49a3858653ff4b5be7ec849019ede06c/raw/installMediaWiki.sh | bash -s ${{ matrix.mw }} WikibaseExport
217+
run: bash EarlyCopy/.github/workflows/installMediaWiki.sh ${{ matrix.mw }} WikibaseExport
272218

273219
- uses: actions/checkout@v4
274220
with:
@@ -288,6 +234,6 @@ jobs:
288234
- uses: actions/checkout@v4
289235
- uses: actions/setup-node@v4
290236
with:
291-
node-version: 16
237+
node-version: 22
292238
- run: npm install
293239
- run: npm run test

WikibaseExport.alias.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
/**
3+
* Aliases for special pages
4+
*
5+
* @file
6+
* @ingroup Extensions
7+
*/
8+
9+
$specialPageAliases = [];
10+
11+
/** English (English) */
12+
$specialPageAliases['en'] = [
13+
'WikibaseExport' => [ 'WikibaseExport' ],
14+
'WikibaseExportConfig' => [ 'WikibaseExportConfig' ],
15+
];

WikibaseExport.i18n.alias.php

Lines changed: 0 additions & 7 deletions
This file was deleted.

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"wmde/clock": "^1.0.0"
2525
},
2626
"require-dev": {
27-
"vimeo/psalm": "^4.22.0",
27+
"vimeo/psalm": "^4.30.0",
2828
"phpstan/phpstan": "^1.8.11",
2929
"mediawiki/mediawiki-codesniffer": "^40.0.0"
3030
},
@@ -33,7 +33,8 @@
3333
},
3434
"config": {
3535
"allow-plugins": {
36-
"composer/installers": true
36+
"composer/installers": true,
37+
"dealerdirect/phpcodesniffer-composer-installer": true
3738
}
3839
}
3940
}

extension.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Wikibase Export",
33
"type": "wikibase",
44

5-
"version": "1.0.0",
5+
"version": "2.0.0",
66

77
"author": [
88
"[https://Professional.Wiki/ Professional.Wiki]",
@@ -17,7 +17,7 @@
1717
"descriptionmsg": "wikibase-export-description",
1818

1919
"requires": {
20-
"MediaWiki": ">= 1.37.0",
20+
"MediaWiki": ">= 1.39.0",
2121
"extensions": {
2222
"WikibaseRepository": "*"
2323
}
@@ -112,7 +112,7 @@
112112
},
113113

114114
"ExtensionMessagesFiles": {
115-
"WikibaseExportAlias": "WikibaseExport.i18n.alias.php"
115+
"WikibaseExportAlias": "WikibaseExport.alias.php"
116116
},
117117

118118
"manifest_version": 2

i18n/ar.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"special-wikibase-export": "تصدير قاعدة بيانات الويكي",
1010
"special-wikibase-export-config": "تكوين تصدير قاعدة بيانات الويكي",
1111
"wikibase-export-intro": "أولاً، اختر العناصر التي تحتاج إلى بيانات لها. ثانيًا، اختر نطاق الوقت الذي تحتاج إلى البيانات له. ثالثًا، اختر المتغيرات التي تحتاجها في ملف CSV. أخيرًا، انقر فوق \" $1 \" لاسترجاع ملف CSV.",
12-
"wikibase-export-intro-admin-notice": "باعتبارك مسؤولاً، يمكنك [[Special:WikibaseExportConfig|تكوين هذا النموذج]].",
12+
"wikibase-export-intro-admin-notice": "باعتبارك مسؤولاً، يمكنك [[MediaWiki:WikibaseExport|تكوين هذا النموذج]].",
1313
"wikibase-export-language-heading": "تصدير اللغة",
1414
"wikibase-export-subjects-heading": "الكيانات المراد تصديرها",
1515
"wikibase-export-subjects-placeholder": "كيانات البحث",
@@ -25,7 +25,7 @@
2525
"wikibase-export-download": "تنزيل",
2626
"wikibase-export-config-invalid": "لم يتم حفظ التغييرات التي أجريتها. فهي تحتوي على {{PLURAL:$1|خطأ}} التالية:",
2727
"wikibase-export-config-incomplete": "يحتاج المسؤول إلى تكوين Wikibase Export قبل أن يتمكن من استخدامه.",
28-
"wikibase-export-config-incomplete-link": "يمكنك [[Special:WikibaseExportConfig|تكوين هذا النموذج]].",
28+
"wikibase-export-config-incomplete-link": "يمكنك [[MediaWiki:WikibaseExport|تكوين هذا النموذج]].",
2929
"wikibase-export-config-help-documentation": "يمكنك [[#Documentation|عرض وثائق التكوين]] أسفل منطقة التحرير.",
3030
"wikibase-export-config-help": "وثائق التكوين",
3131
"wikibase-export-config-help-example": "المثال الكامل",

i18n/de.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"special-wikibase-export": "Wikibase-Export",
1212
"special-wikibase-export-config": "Konfiguration für Wikibase-Export",
1313
"wikibase-export-intro": "Vier einfache Schritte zum Datenexport:<br>\n1. {{#FORMAL:Wähl|Wählen Sie}} zunächst die Datenobjekte aus, für die Daten benötigt werden.<br>\n2. {{#FORMAL:Wähl|Wählen Sie}} den Zeitraum aus, für den die Daten benötigt werden.<br>\n3. {{#FORMAL:Wähl|Wählen Sie}} die Variablen aus, die für die CSV-Datei benötigt werden.<br>\n4. {{#FORMAL:Klick|Klicken Sie}} abschließend auf „$1“, um die CSV-Datei abzurufen.",
14-
"wikibase-export-intro-admin-notice": "Als Administrator {{#FORMAL:kannst du|können Sie}} [[Special:WikibaseExportConfig|dieses Formular konfigurieren]]:",
14+
"wikibase-export-intro-admin-notice": "Als Administrator {{#FORMAL:kannst du|können Sie}} [[MediaWiki:WikibaseExport|dieses Formular konfigurieren]]:",
1515
"wikibase-export-language-heading": "Sprache für den Export",
1616
"wikibase-export-subjects-heading": "Zu exportierende Entitäten",
1717
"wikibase-export-subjects-placeholder": "Entitäten suchen",
@@ -27,7 +27,7 @@
2727
"wikibase-export-download": "Herunterladen",
2828
"wikibase-export-config-invalid": "Deine Änderungen wurden nicht gespeichert. Diese enthalten {{PLURAL:$1|den|die}} folgenden {{PLURAL:$1|Fehler}}:",
2929
"wikibase-export-config-incomplete": "Ein Administrator muss den Export von Daten konfigurieren, bevor er verwendet werden kann.",
30-
"wikibase-export-config-incomplete-link": "{{#FORMAL:Du kannst|Sie können}} [[Special:WikibaseExportConfig|dieses Formular konfigurieren]]:",
30+
"wikibase-export-config-incomplete-link": "{{#FORMAL:Du kannst|Sie können}} [[MediaWiki:WikibaseExport|dieses Formular konfigurieren]]:",
3131
"wikibase-export-config-help-documentation": "Du kannst die [[#Documentation|die Konfigurationsdokumentation]] unterhalb des Bearbeitungsbereichs einsehen.",
3232
"wikibase-export-config-help": "Dokumentation zu den Konfigurationsmöglichkeiten",
3333
"wikibase-export-config-help-example": "Vollständiges Beispiel",

i18n/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"special-wikibase-export-config": "Wikibase Export Config",
1313

1414
"wikibase-export-intro": "First, choose the items for which you need data. Second, choose the time range for which you need the data. Third, choose the variables you need in the CSV file. Finally, click \"$1\" to retrieve the CSV file.",
15-
"wikibase-export-intro-admin-notice": "As an administrator, you can [[Special:WikibaseExportConfig|configure this form]].",
15+
"wikibase-export-intro-admin-notice": "As an administrator, you can [[MediaWiki:WikibaseExport|configure this form]].",
1616
"wikibase-export-language-heading": "Export language",
1717
"wikibase-export-subjects-heading": "Entities to export",
1818
"wikibase-export-subjects-placeholder": "Search entities",
@@ -29,7 +29,7 @@
2929

3030
"wikibase-export-config-invalid": "Your changes were not saved. They contain the following {{PLURAL:$1|error|errors}}:",
3131
"wikibase-export-config-incomplete": "An administrator needs to configure Wikibase Export before it can be used.",
32-
"wikibase-export-config-incomplete-link": "You can [[Special:WikibaseExportConfig|configure this form]].",
32+
"wikibase-export-config-incomplete-link": "You can [[MediaWiki:WikibaseExport|configure this form]].",
3333

3434
"wikibase-export-config-help-documentation": "You can [[#Documentation|view the configuration documentation]] below the edit area.",
3535
"wikibase-export-config-help": "Configuration documentation",

i18n/fr.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"special-wikibase-export": "Exportation de Wikibase",
1111
"special-wikibase-export-config": "Configuration d’exportation de Wikibase",
1212
"wikibase-export-intro": "Tout d’abord, choisissez les éléments pour lesquels vous avez besoin de données. Deuxièmement, choisissez la plage de temps pour laquelle vous avez besoin des données. Troisièmement, choisissez les variables dont vous avez besoin dans le fichier CSV. Enfin, cliquez sur « $1 » pour récupérer le fichier CSV.",
13-
"wikibase-export-intro-admin-notice": "En tant qu’administrateur, vous pouvez [[Special:WikibaseExportConfig|configurer ce formulaire]].",
13+
"wikibase-export-intro-admin-notice": "En tant qu’administrateur, vous pouvez [[MediaWiki:WikibaseExport|configurer ce formulaire]].",
1414
"wikibase-export-language-heading": "Langue d’exportation",
1515
"wikibase-export-subjects-heading": "Entités à exporter",
1616
"wikibase-export-subjects-placeholder": "Rechercher des entités",
@@ -26,7 +26,7 @@
2626
"wikibase-export-download": "Télécharger",
2727
"wikibase-export-config-invalid": "Vos modifications n’ont pas été enregistrées. Elles comportent {{PLURAL:$1|l’erreur suivante|les erreurs suivantes}} :",
2828
"wikibase-export-config-incomplete": "Un administrateur doit configurer l’exportation de Wikibase avant qu’elle puisse être utilisée.",
29-
"wikibase-export-config-incomplete-link": "Vous pouvez [[Special:WikibaseExportConfig|configurer ce formulaire]].",
29+
"wikibase-export-config-incomplete-link": "Vous pouvez [[MediaWiki:WikibaseExport|configurer ce formulaire]].",
3030
"wikibase-export-config-help-documentation": "Vous pouvez [[#Documentation|afficher la documentation de la configuration]] sous la zone de modification.",
3131
"wikibase-export-config-help": "Documentation de la configuration",
3232
"wikibase-export-config-help-example": "Exemple complet",

i18n/he.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"special-wikibase-export": "יצוא ויקיבייס",
1010
"special-wikibase-export-config": "הגדרות יצוא ויקיבייס",
1111
"wikibase-export-intro": "אחד: יש לבחור את הפריטים שעבורם נחוצים לך נתונים. שתיים: יש לבחור את טווח הזמן שעבורו נחוצים לך הנתונים. שלוש: יש לבחור את המשתנים שנחוצים לך בקובץ ה־CSV. לסיום: יש ללחוץ על \"$1\" כדי לאחזר את קובץ ה־CSV.",
12-
"wikibase-export-intro-admin-notice": "בתור מפעיל, יש לך אפשרות [[Special:WikibaseExportConfig|להגדיר את הטופס הזה]].",
12+
"wikibase-export-intro-admin-notice": "בתור מפעיל, יש לך אפשרות [[MediaWiki:WikibaseExport|להגדיר את הטופס הזה]].",
1313
"wikibase-export-language-heading": "שפה ליצוא",
1414
"wikibase-export-subjects-heading": "ישויות ליצוא",
1515
"wikibase-export-subjects-placeholder": "חיפוש ישויות",
@@ -25,7 +25,7 @@
2525
"wikibase-export-download": "הורדה",
2626
"wikibase-export-config-invalid": "השינויים שלך לא נשמרו. הם מכילים את {{PLURAL:$1|השגיאה הבאה|השגיאות הבאות}}:",
2727
"wikibase-export-config-incomplete": "מפעיל צריך להגדיר את ההרחבה Wikibase Export לפני שיהיה אפשר להשתמש בה.",
28-
"wikibase-export-config-incomplete-link": "באפשרותך [[Special:WikibaseExportConfig|להגדיר את הטופס הזה]].",
28+
"wikibase-export-config-incomplete-link": "באפשרותך [[MediaWiki:WikibaseExport|להגדיר את הטופס הזה]].",
2929
"wikibase-export-config-help-documentation": "באפשרותך [[#Documentation|להציג את תיעוד התצורה]] מתחת לאזור העריכה.",
3030
"wikibase-export-config-help": "תיעוד תצורה",
3131
"wikibase-export-config-help-example": "דוגמה מלאה",

0 commit comments

Comments
 (0)