Skip to content

Commit

Permalink
Improve compatibility with recent MediaWiki versions (#189)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
alistair3149 authored Feb 28, 2025
1 parent f1bcf11 commit f06df8c
Show file tree
Hide file tree
Showing 33 changed files with 149 additions and 218 deletions.
130 changes: 38 additions & 92 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,30 @@ on:
jobs:
test:
name: "PHPUnit: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"
continue-on-error: ${{ matrix.experimental }}

strategy:
fail-fast: false
matrix:
include:
- mw: 'REL1_37'
php: '8.0'
- mw: 'REL1_38'
php: '8.0'
- mw: 'REL1_38'
php: '8.1'
- mw: 'REL1_39'
php: '8.1'
- mw: 'REL1_39'
php: '8.2'
php: 8.0
experimental: false
- mw: 'REL1_40'
php: '8.2'
php: 8.1
experimental: false
- mw: 'REL1_41'
php: 8.2
experimental: false
- mw: 'REL1_42'
php: 8.2
experimental: false
- mw: 'REL1_43'
php: 8.3
experimental: false
- mw: 'master'
php: 8.4
experimental: true

runs-on: ubuntu-latest

Expand All @@ -46,13 +54,13 @@ jobs:
mediawiki
!mediawiki/extensions/
!mediawiki/vendor/
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v5
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v8

- name: Cache Composer cache
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: composer-php${{ matrix.php }}
key: composer-php${{ matrix.php }}_v2

- uses: actions/checkout@v4
with:
Expand All @@ -67,8 +75,8 @@ jobs:
with:
path: mediawiki/extensions/WikibaseExport

# - name: Composer allow-plugins
# run: composer config --no-plugins allow-plugins.composer/installers true
- name: Composer allow-plugins
run: composer config --no-plugins allow-plugins.composer/installers true

- run: composer update

Expand All @@ -91,15 +99,13 @@ jobs:


PHPStan:
name: "PHPStan: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"
name: "Static Analysis: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"

strategy:
matrix:
include:
- mw: 'REL1_37'
php: '8.0'
- mw: 'REL1_38'
php: '8.1'
- mw: 'REL1_43'
php: '8.3'

runs-on: ubuntu-latest

Expand All @@ -123,7 +129,7 @@ jobs:
mediawiki
mediawiki/extensions/
mediawiki/vendor/
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v5
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v8

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




Psalm:
name: "Psalm: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"

strategy:
matrix:
include:
- mw: 'REL1_37'
php: '8.0'
- mw: 'REL1_38'
php: '8.1'

runs-on: ubuntu-latest

defaults:
run:
working-directory: mediawiki

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring
tools: composer, cs2pr

- name: Cache MediaWiki
id: cache-mediawiki
uses: actions/cache@v4
with:
path: |
mediawiki
mediawiki/extensions/
mediawiki/vendor/
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v5

- name: Cache Composer cache
uses: actions/cache@v4
with:
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 ${{ matrix.mw }} WikibaseExport

- uses: actions/checkout@v4
with:
path: mediawiki/extensions/WikibaseExport

- name: Composer allow-plugins
run: composer config --no-plugins allow-plugins.composer/installers true

- run: composer update

- name: Composer install
run: cd extensions/WikibaseExport && composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader

- name: Psalm
run: cd extensions/WikibaseExport && pwd && php vendor/bin/psalm --config=psalm.xml --shepherd --stats
- name: Psalm
run: cd extensions/WikibaseExport && php vendor/bin/psalm --shepherd --stats
if: true



Expand All @@ -232,8 +174,8 @@ jobs:
strategy:
matrix:
include:
- mw: 'REL1_39'
php: '8.2'
- mw: 'REL1_43'
php: '8.3'

runs-on: ubuntu-latest

Expand Down Expand Up @@ -263,12 +205,16 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v5
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v8

- 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 ${{ matrix.mw }} WikibaseExport
run: bash EarlyCopy/.github/workflows/installMediaWiki.sh ${{ matrix.mw }} WikibaseExport

- uses: actions/checkout@v4
with:
Expand All @@ -288,6 +234,6 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 22
- run: npm install
- run: npm run test
15 changes: 15 additions & 0 deletions WikibaseExport.alias.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* Aliases for special pages
*
* @file
* @ingroup Extensions
*/

$specialPageAliases = [];

/** English (English) */
$specialPageAliases['en'] = [
'WikibaseExport' => [ 'WikibaseExport' ],
'WikibaseExportConfig' => [ 'WikibaseExportConfig' ],
];
7 changes: 0 additions & 7 deletions WikibaseExport.i18n.alias.php

This file was deleted.

5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"wmde/clock": "^1.0.0"
},
"require-dev": {
"vimeo/psalm": "^4.22.0",
"vimeo/psalm": "^4.30.0",
"phpstan/phpstan": "^1.8.11",
"mediawiki/mediawiki-codesniffer": "^40.0.0"
},
Expand All @@ -33,7 +33,8 @@
},
"config": {
"allow-plugins": {
"composer/installers": true
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
6 changes: 3 additions & 3 deletions extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Wikibase Export",
"type": "wikibase",

"version": "1.0.0",
"version": "2.0.0",

"author": [
"[https://Professional.Wiki/ Professional.Wiki]",
Expand All @@ -17,7 +17,7 @@
"descriptionmsg": "wikibase-export-description",

"requires": {
"MediaWiki": ">= 1.37.0",
"MediaWiki": ">= 1.39.0",
"extensions": {
"WikibaseRepository": "*"
}
Expand Down Expand Up @@ -112,7 +112,7 @@
},

"ExtensionMessagesFiles": {
"WikibaseExportAlias": "WikibaseExport.i18n.alias.php"
"WikibaseExportAlias": "WikibaseExport.alias.php"
},

"manifest_version": 2
Expand Down
4 changes: 2 additions & 2 deletions i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"special-wikibase-export": "تصدير قاعدة بيانات الويكي",
"special-wikibase-export-config": "تكوين تصدير قاعدة بيانات الويكي",
"wikibase-export-intro": "أولاً، اختر العناصر التي تحتاج إلى بيانات لها. ثانيًا، اختر نطاق الوقت الذي تحتاج إلى البيانات له. ثالثًا، اختر المتغيرات التي تحتاجها في ملف CSV. أخيرًا، انقر فوق \" $1 \" لاسترجاع ملف CSV.",
"wikibase-export-intro-admin-notice": "باعتبارك مسؤولاً، يمكنك [[Special:WikibaseExportConfig|تكوين هذا النموذج]].",
"wikibase-export-intro-admin-notice": "باعتبارك مسؤولاً، يمكنك [[MediaWiki:WikibaseExport|تكوين هذا النموذج]].",
"wikibase-export-language-heading": "تصدير اللغة",
"wikibase-export-subjects-heading": "الكيانات المراد تصديرها",
"wikibase-export-subjects-placeholder": "كيانات البحث",
Expand All @@ -25,7 +25,7 @@
"wikibase-export-download": "تنزيل",
"wikibase-export-config-invalid": "لم يتم حفظ التغييرات التي أجريتها. فهي تحتوي على {{PLURAL:$1|خطأ}} التالية:",
"wikibase-export-config-incomplete": "يحتاج المسؤول إلى تكوين Wikibase Export قبل أن يتمكن من استخدامه.",
"wikibase-export-config-incomplete-link": "يمكنك [[Special:WikibaseExportConfig|تكوين هذا النموذج]].",
"wikibase-export-config-incomplete-link": "يمكنك [[MediaWiki:WikibaseExport|تكوين هذا النموذج]].",
"wikibase-export-config-help-documentation": "يمكنك [[#Documentation|عرض وثائق التكوين]] أسفل منطقة التحرير.",
"wikibase-export-config-help": "وثائق التكوين",
"wikibase-export-config-help-example": "المثال الكامل",
Expand Down
4 changes: 2 additions & 2 deletions i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"special-wikibase-export": "Wikibase-Export",
"special-wikibase-export-config": "Konfiguration für Wikibase-Export",
"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.",
"wikibase-export-intro-admin-notice": "Als Administrator {{#FORMAL:kannst du|können Sie}} [[Special:WikibaseExportConfig|dieses Formular konfigurieren]]:",
"wikibase-export-intro-admin-notice": "Als Administrator {{#FORMAL:kannst du|können Sie}} [[MediaWiki:WikibaseExport|dieses Formular konfigurieren]]:",
"wikibase-export-language-heading": "Sprache für den Export",
"wikibase-export-subjects-heading": "Zu exportierende Entitäten",
"wikibase-export-subjects-placeholder": "Entitäten suchen",
Expand All @@ -27,7 +27,7 @@
"wikibase-export-download": "Herunterladen",
"wikibase-export-config-invalid": "Deine Änderungen wurden nicht gespeichert. Diese enthalten {{PLURAL:$1|den|die}} folgenden {{PLURAL:$1|Fehler}}:",
"wikibase-export-config-incomplete": "Ein Administrator muss den Export von Daten konfigurieren, bevor er verwendet werden kann.",
"wikibase-export-config-incomplete-link": "{{#FORMAL:Du kannst|Sie können}} [[Special:WikibaseExportConfig|dieses Formular konfigurieren]]:",
"wikibase-export-config-incomplete-link": "{{#FORMAL:Du kannst|Sie können}} [[MediaWiki:WikibaseExport|dieses Formular konfigurieren]]:",
"wikibase-export-config-help-documentation": "Du kannst die [[#Documentation|die Konfigurationsdokumentation]] unterhalb des Bearbeitungsbereichs einsehen.",
"wikibase-export-config-help": "Dokumentation zu den Konfigurationsmöglichkeiten",
"wikibase-export-config-help-example": "Vollständiges Beispiel",
Expand Down
4 changes: 2 additions & 2 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"special-wikibase-export-config": "Wikibase Export Config",

"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.",
"wikibase-export-intro-admin-notice": "As an administrator, you can [[Special:WikibaseExportConfig|configure this form]].",
"wikibase-export-intro-admin-notice": "As an administrator, you can [[MediaWiki:WikibaseExport|configure this form]].",
"wikibase-export-language-heading": "Export language",
"wikibase-export-subjects-heading": "Entities to export",
"wikibase-export-subjects-placeholder": "Search entities",
Expand All @@ -29,7 +29,7 @@

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

"wikibase-export-config-help-documentation": "You can [[#Documentation|view the configuration documentation]] below the edit area.",
"wikibase-export-config-help": "Configuration documentation",
Expand Down
4 changes: 2 additions & 2 deletions i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"special-wikibase-export": "Exportation de Wikibase",
"special-wikibase-export-config": "Configuration d’exportation de Wikibase",
"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.",
"wikibase-export-intro-admin-notice": "En tant qu’administrateur, vous pouvez [[Special:WikibaseExportConfig|configurer ce formulaire]].",
"wikibase-export-intro-admin-notice": "En tant qu’administrateur, vous pouvez [[MediaWiki:WikibaseExport|configurer ce formulaire]].",
"wikibase-export-language-heading": "Langue d’exportation",
"wikibase-export-subjects-heading": "Entités à exporter",
"wikibase-export-subjects-placeholder": "Rechercher des entités",
Expand All @@ -26,7 +26,7 @@
"wikibase-export-download": "Télécharger",
"wikibase-export-config-invalid": "Vos modifications n’ont pas été enregistrées. Elles comportent {{PLURAL:$1|l’erreur suivante|les erreurs suivantes}} :",
"wikibase-export-config-incomplete": "Un administrateur doit configurer l’exportation de Wikibase avant qu’elle puisse être utilisée.",
"wikibase-export-config-incomplete-link": "Vous pouvez [[Special:WikibaseExportConfig|configurer ce formulaire]].",
"wikibase-export-config-incomplete-link": "Vous pouvez [[MediaWiki:WikibaseExport|configurer ce formulaire]].",
"wikibase-export-config-help-documentation": "Vous pouvez [[#Documentation|afficher la documentation de la configuration]] sous la zone de modification.",
"wikibase-export-config-help": "Documentation de la configuration",
"wikibase-export-config-help-example": "Exemple complet",
Expand Down
4 changes: 2 additions & 2 deletions i18n/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"special-wikibase-export": "יצוא ויקיבייס",
"special-wikibase-export-config": "הגדרות יצוא ויקיבייס",
"wikibase-export-intro": "אחד: יש לבחור את הפריטים שעבורם נחוצים לך נתונים. שתיים: יש לבחור את טווח הזמן שעבורו נחוצים לך הנתונים. שלוש: יש לבחור את המשתנים שנחוצים לך בקובץ ה־CSV. לסיום: יש ללחוץ על \"$1\" כדי לאחזר את קובץ ה־CSV.",
"wikibase-export-intro-admin-notice": "בתור מפעיל, יש לך אפשרות [[Special:WikibaseExportConfig|להגדיר את הטופס הזה]].",
"wikibase-export-intro-admin-notice": "בתור מפעיל, יש לך אפשרות [[MediaWiki:WikibaseExport|להגדיר את הטופס הזה]].",
"wikibase-export-language-heading": "שפה ליצוא",
"wikibase-export-subjects-heading": "ישויות ליצוא",
"wikibase-export-subjects-placeholder": "חיפוש ישויות",
Expand All @@ -25,7 +25,7 @@
"wikibase-export-download": "הורדה",
"wikibase-export-config-invalid": "השינויים שלך לא נשמרו. הם מכילים את {{PLURAL:$1|השגיאה הבאה|השגיאות הבאות}}:",
"wikibase-export-config-incomplete": "מפעיל צריך להגדיר את ההרחבה Wikibase Export לפני שיהיה אפשר להשתמש בה.",
"wikibase-export-config-incomplete-link": "באפשרותך [[Special:WikibaseExportConfig|להגדיר את הטופס הזה]].",
"wikibase-export-config-incomplete-link": "באפשרותך [[MediaWiki:WikibaseExport|להגדיר את הטופס הזה]].",
"wikibase-export-config-help-documentation": "באפשרותך [[#Documentation|להציג את תיעוד התצורה]] מתחת לאזור העריכה.",
"wikibase-export-config-help": "תיעוד תצורה",
"wikibase-export-config-help-example": "דוגמה מלאה",
Expand Down
4 changes: 2 additions & 2 deletions i18n/ia.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"special-wikibase-export": "Exportation de Wikibase",
"special-wikibase-export-config": "Configuration de exportation de Wikibase",
"wikibase-export-intro": "Primo, elige le elementos pro le quales tu vole datos. Secundo, elige le intervallo de tempore pro le qual tu vole le datos. Tertio, elige le variabiles desirate in le file CSV. Finalmente, clicca sur \"$1\" pro obtener le file CSV.",
"wikibase-export-intro-admin-notice": "Como administrator, tu pote [[Special:WikibaseExportConfig|configurar iste formulario]].",
"wikibase-export-intro-admin-notice": "Como administrator, tu pote [[MediaWiki:WikibaseExport|configurar iste formulario]].",
"wikibase-export-language-heading": "Exportar lingua",
"wikibase-export-subjects-heading": "Entitates a exportar",
"wikibase-export-subjects-placeholder": "Subjectos a cercar",
Expand All @@ -24,7 +24,7 @@
"wikibase-export-download": "Discargar",
"wikibase-export-config-invalid": "Tu cambiamentos non ha essite salveguardate. Illos contine le sequente error{{PLURAL:$1||es}}:",
"wikibase-export-config-incomplete": "Un administrator debe configurar Wikibase Export ante que illo pote esser usate.",
"wikibase-export-config-incomplete-link": "Tu pote [[Special:WikibaseExportConfig|configurar iste formulario]].",
"wikibase-export-config-incomplete-link": "Tu pote [[MediaWiki:WikibaseExport|configurar iste formulario]].",
"wikibase-export-config-help-documentation": "Tu pote [[#Documentation|vider le documentation del configuration]] sub le area de modification.",
"wikibase-export-config-help": "Documentation de configuration",
"wikibase-export-config-help-example": "Exemplo complete",
Expand Down
Loading

0 comments on commit f06df8c

Please sign in to comment.