Skip to content

Commit

Permalink
Merge pull request #53 from ProfessionalWiki/2.0
Browse files Browse the repository at this point in the history
Add CI and PHP 8.1 support
  • Loading branch information
JeroenDeDauw authored Dec 17, 2022
2 parents a0104f7 + 91ba5b4 commit ea82107
Show file tree
Hide file tree
Showing 13 changed files with 195 additions and 445 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: CI

on:
push:
pull_request:

jobs:
test:
name: "PHPUnit: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"

strategy:
matrix:
include:
- mw: 'REL1_35'
php: '8.0'
- mw: 'REL1_38'
php: '8.1'
- mw: 'REL1_39'
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, intl
tools: composer

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

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

- uses: actions/checkout@v3
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 }} SimpleBatchUpload

- uses: actions/checkout@v3
with:
path: mediawiki/extensions/SimpleBatchUpload

- run: composer update

- name: Run update.php
run: php maintenance/update.php --quick

- name: Run PHPUnit
run: php tests/phpunit/phpunit.php -c extensions/SimpleBatchUpload/

- name: Run PHPUnit with code coverage
run: php tests/phpunit/phpunit.php -c extensions/SimpleBatchUpload/ --coverage-clover coverage.xml

- name: Upload code coverage
run: bash <(curl -s https://codecov.io/bash)
if: github.ref == 'refs/heads/master'
35 changes: 35 additions & 0 deletions .github/workflows/installMediaWiki.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#! /bin/bash

MW_BRANCH=$1
EXTENSION_NAME=$2

wget https://github.com/wikimedia/mediawiki/archive/$MW_BRANCH.tar.gz -nv

tar -zxf $MW_BRANCH.tar.gz
mv mediawiki-$MW_BRANCH mediawiki

cd mediawiki

composer install
php maintenance/install.php --dbtype sqlite --dbuser root --dbname mw --dbpath $(pwd) --pass AdminPassword WikiName AdminUser

echo 'error_reporting(E_ALL| E_STRICT);' >> LocalSettings.php
echo 'ini_set("display_errors", 1);' >> LocalSettings.php
echo '$wgShowExceptionDetails = true;' >> LocalSettings.php
echo '$wgShowDBErrorBacktrace = true;' >> LocalSettings.php
echo '$wgDevelopmentWarnings = true;' >> LocalSettings.php

echo 'wfLoadExtension( "'$EXTENSION_NAME'" );' >> LocalSettings.php

cat <<EOT >> composer.local.json
{
"extra": {
"merge-plugin": {
"merge-dev": true,
"include": [
"extensions/$EXTENSION_NAME/composer.json"
]
}
}
}
EOT
69 changes: 0 additions & 69 deletions .scrutinizer.yml

This file was deleted.

13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# SimpleBatchUpload

[![GitHub Workflow Status](https://github.com/ProfessionalWiki/SimpleBatchUpload/actions/workflows/ci.yml/badge.svg)](https://github.com/ProfessionalWiki/SimpleBatchUpload/actions?query=workflow%3ACI)
[![Latest Stable Version](https://poser.pugx.org/mediawiki/simple-batch-upload/v/stable)](https://packagist.org/packages/mediawiki/simple-batch-upload)
[![Packagist download count](https://poser.pugx.org/mediawiki/simple-batch-upload/downloads)](https://packagist.org/packages/mediawiki/simple-batch-upload)
[![Build Status](https://scrutinizer-ci.com/g/ProfessionalWiki/SimpleBatchUpload/badges/build.png?b=master)](https://scrutinizer-ci.com/g/ProfessionalWiki/SimpleBatchUpload/build-status/master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ProfessionalWiki/SimpleBatchUpload/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/ProfessionalWiki/SimpleBatchUpload/?branch=master)

The [SimpleBatchUpload][mw-simple-batch-upload] extension provides basic,
no-frills uploading of multiple files to MediaWiki.
Expand All @@ -13,8 +12,8 @@ It is maintained by [Professional.Wiki](https://professional.wiki/).

## Requirements

- PHP 7.0 or later
- MediaWiki 1.31 or later
- PHP 8.0 or later
- MediaWiki 1.35 or later

## Installation

Expand All @@ -26,7 +25,7 @@ installation directory.
```json
{
"require": {
"mediawiki/simple-batch-upload": "^1.0"
"mediawiki/simple-batch-upload": "^2.0"
}
}
```
Expand All @@ -36,8 +35,7 @@ Then add the following line to your "LocalSettings.php" file:
wfLoadExtension( 'SimpleBatchUpload' );
```

**Note:** To use the extension [`$wgEnableWriteAPI`][$wgEnableWriteAPI] needs to
be enabled and the user needs the [`writeapi`][writeapi] right. Both is the
**Note:** To use the extension the user needs the [`writeapi`][writeapi] right. This is the
default MediaWiki setting for registered users, but it may have been changed
during the configuration of the wiki.

Expand Down Expand Up @@ -105,5 +103,4 @@ on mediawiki.org.
[license]: https://www.gnu.org/copyleft/gpl.html
[mw-simple-batch-upload]: https://www.mediawiki.org/wiki/Extension:SimpleBatchUpload
[composer]: https://getcomposer.org/
[$wgEnableWriteAPI]: https://www.mediawiki.org/wiki/Manual:$wgEnableWriteAPI
[writeapi]: https://www.mediawiki.org/wiki/Manual:User_rights#List_of_permissions
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
"forum": "https://www.mediawiki.org/wiki/Extension_talk:SimpleBatchUpload",
"source": "https://github.com/ProfessionalWiki/SimpleBatchUpload",
"issues": "https://github.com/ProfessionalWiki/SimpleBatchUpload/issues",
"irc": "irc://irc.freenode.org/mediawiki"
"irc": "irc://libera.chat:6667/mediawiki"
},
"require": {
"mediawiki/mediawiki": ">=1.31",
"php": ">=7.0",
"mediawiki/mediawiki": ">=1.35",
"php": ">=8.0",
"composer/installers": "^2|^1.0.1"
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
"dev-master": "2.x-dev"
}
}
}
56 changes: 53 additions & 3 deletions extension.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SimpleBatchUpload",
"version": "1.9.0",
"version": "2.0.0-dev",
"author": [
"[https://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]",
"[https://professional.wiki/ Professional.Wiki]",
Expand All @@ -12,7 +12,7 @@
"license-name": "GPL-2.0-or-later",
"type": "specialpage",
"requires": {
"MediaWiki": ">=1.31"
"MediaWiki": ">=1.35"
},
"MessagesDirs": {
"SimpleBatchUpload": [
Expand All @@ -29,6 +29,56 @@
"AutoloadNamespaces": {
"SimpleBatchUpload\\": "src/"
},
"callback": "SimpleBatchUpload\\SimpleBatchUpload::initCallback",
"TestAutoloadNamespaces": {
"SimpleBatchUpload\\Tests": "tests/phpunit/"
},
"ExtensionMessagesFiles": {
"SimpleBatchUploadAlias": "src/SimpleBatchUpload.alias.php",
"SimpleBatchUploadMagic": "src/SimpleBatchUpload.magic.php"
},
"SpecialPages": {
"BatchUpload": "SimpleBatchUpload\\SpecialBatchUpload"
},
"Hooks": {
"ParserFirstCallInit": "SimpleBatchUpload\\SimpleBatchUpload::registerParserFunction",
"MakeGlobalVariablesScript": "SimpleBatchUpload\\SimpleBatchUpload::onMakeGlobalVariablesScript"
},
"ResourceFileModulePaths": {
"localBasePath": "res",
"remoteExtPath": "SimpleBatchUpload/res"
},
"ResourceModules": {
"ext.SimpleBatchUpload.jquery-file-upload": {
"scripts": [
"jquery.fileupload.js"
],
"styles": [
"jquery.fileupload.css"
],
"position": "top",
"dependencies": [
"jquery.ui"
]
},
"ext.SimpleBatchUpload": {
"scripts": [
"ext.SimpleBatchUpload.js"
],
"styles": [
"ext.SimpleBatchUpload.css"
],
"position": "top",
"dependencies": [
"ext.SimpleBatchUpload.jquery-file-upload",
"mediawiki.Title",
"mediawiki.jqueryMsg",
"mediawiki.api"
],
"messages": [
"simplebatchupload-comment",
"simplebatchupload-max-files-alert"
]
}
},
"manifest_version": 2
}
10 changes: 10 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
## Release Notes

### SimpleBatchUpload 2.0.0

Under development.

* Raised minimum required versions to
* MediaWiki 1.35
* PHP 8.0
* Added PHP 8.1 support (thanks @malberts)
* Fixed deprecation warning in MediaWiki 1.38 (thanks @malberts)

### SimpleBatchUpload 1.9.0

Released on December 14, 2022.
Expand Down
4 changes: 0 additions & 4 deletions res/ext.SimpleBatchUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@

var tokenType = 'csrf';

if ( mw.config.get( 'wgVersion' ) < '1.27.0' ) {
tokenType = 'edit';
}

// invalidate cached token; always request a new one
api.badToken( tokenType );

Expand Down
Loading

0 comments on commit ea82107

Please sign in to comment.