Skip to content

Commit

Permalink
Foundation for GND extension
Browse files Browse the repository at this point in the history
By Jeroen De Dauw - https://EntropyWins.wtf

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄░░░░░░░░░
░░░░░░░░▄▀░░░░░░░░░░░░▄░░░░░░░▀▄░░░░░░░
░░░░░░░░█░░▄░░░░▄░░░░░░░░░░░░░░█░░░░░░░
░░░░░░░░█░░░░░░░░░░░░▄█▄▄░░▄░░░█░▄▄▄░░░
░▄▄▄▄▄░░█░░░░░░▀░░░░▀█░░▀▄░░░░░█▀▀░██░░
░██▄▀██▄█░░░▄░░░░░░░██░░░░▀▀▀▀▀░░░░██░░
░░▀██▄▀██░░░░░░░░▀░██▀░░░░░░░░░░░░░▀██░
░░░░▀████░▀░░░░▄░░░██░░░▄█░░░░▄░▄█░░██░
░░░░░░░▀█░░░░▄░░░░░██░░░░▄░░░▄░░▄░░░██░
░░░░░░░▄█▄░░░░░░░░░░░▀▄░░▀▀▀▀▀▀▀▀░░▄▀░░
░░░░░░█▀▀█████████▀▀▀▀████████████▀░░░░
░░░░░░████▀░░███▀░░░░░░▀███░░▀██▀░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░ https://Professional.Wiki ░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  • Loading branch information
JeroenDeDauw committed Dec 18, 2020
0 parents commit cac835e
Show file tree
Hide file tree
Showing 8 changed files with 292 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,69 @@
name: CI

on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]

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

strategy:
matrix:
include:
- mw: 'master'
php: 7.4
- mw: 'REL1_35'
php: 7.4

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:v1

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

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

- uses: actions/checkout@v2
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 }} GND

- uses: actions/checkout@v2
with:
path: mediawiki/extensions/GND

- name: Composer update
run: composer update

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

43 changes: 43 additions & 0 deletions .github/workflows/installMediaWiki.sh
@@ -0,0 +1,43 @@
#! /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 '$wgEnableWikibaseRepo = true;' >> LocalSettings.php
echo '$wgEnableWikibaseClient = false;' >> LocalSettings.php
echo 'require_once __DIR__ . "/extensions/Wikibase/repo/Wikibase.php";' >> LocalSettings.php
echo 'require_once __DIR__ . "/extensions/Wikibase/repo/ExampleSettings.php";' >> LocalSettings.php

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

cat <<EOT >> composer.local.json
{
"require": {
"wikibase/wikibase": "dev-$MW_BRANCH"
},
"extra": {
"merge-plugin": {
"merge-dev": true,
"include": [
"extensions/$EXTENSION_NAME/composer.json"
]
}
}
}
EOT
59 changes: 59 additions & 0 deletions README.md
@@ -0,0 +1,59 @@
# Wikibase EDTF

[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/ProfessionalWiki/GND/CI/master)](https://github.com/ProfessionalWiki/GND/actions?query=workflow%3ACI)
[![Latest Stable Version](https://poser.pugx.org/dnb/mediawiki-gnd/version.png)](https://packagist.org/packages/dnb/mediawiki-gnd)
[![Download count](https://poser.pugx.org/dnb/mediawiki-gnd/d/total.png)](https://packagist.org/packages/dnb/mediawiki-gnd)

[MediaWiki] extension that adds scripts to import GND PICA+ into [Wikibase].

## Platform requirements

* [PHP] 7.4 or later, including PHP 8.0
* [MediaWiki] 1.35
* [Wikibase Repository] REL1_35

See the [release notes](#release-notes) for more information on the different versions of this extension.

## Installation

First install MediaWiki and Wikibase Repository.

The recommended way to install the GND extension is using [Composer] with
[MediaWiki's built-in support for Composer][Composer install].

On the commandline, go to your wikis root directory. Then run these two commands:

```shell script
COMPOSER=composer.local.json composer require --no-update dnb/mediawiki-gnd:*
composer update dnb/mediawiki-gnd --no-dev -o
```

**Enabling the extension**

Then enable the extension by adding the following to the bottom of your wikis `LocalSettings.php` file:

```php
wfLoadExtension( 'WikibaseEdtf' );
```

You can verify the extension was enabled successfully by opening your wikis Special:Version page in your browser.

## Running the tests

* PHP tests: `php tests/phpunit/phpunit.php extensions/GND/tests/`

## Release notes

### Version 0.1.0

Under development

* Initial release for MediaWiki/Wikibase 1.35

[Professional.Wiki]: https://professional.wiki
[Wikibase]: https://wikibase.consulting/what-is-wikibase/
[MediaWiki]: https://www.mediawiki.org
[PHP]: https://www.php.net
[Wikibase Repository]: https://www.mediawiki.org/wiki/Extension:Wikibase_Repository
[Composer]: https://getcomposer.org
[Composer install]: https://professional.wiki/en/articles/installing-mediawiki-extensions-with-composer
33 changes: 33 additions & 0 deletions composer.json
@@ -0,0 +1,33 @@
{
"name": "dnb/mediawiki-gnd",
"type": "mediawiki-extension",
"description": "Adds scripts to import GND items into Wikibase Repository",
"homepage": "https://github.com/ProfessionalWiki/GND",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Professional.Wiki",
"email": "info@professional.wiki",
"homepage": "https://Professional.Wiki",
"role": "Creator"
},
{
"name": "Jeroen De Dauw",
"email": "jeroendedauw@gmail.com",
"homepage": "https://www.EntropyWins.wtf/mediawiki",
"role": "Creator and developer"
}
],
"support": {
"source": "https://github.com/ProfessionalWiki/GND/issues"
},
"require": {
"php": ">=7.4",
"composer/installers": "^1.0.1"
},
"require-dev": {
},
"extra": {
"installer-name": "GND"
}
}
51 changes: 51 additions & 0 deletions extension.json
@@ -0,0 +1,51 @@
{
"name": "GND",
"type": "wikibase",

"version": "0.1.0",

"author": [
"[https://www.EntropyWins.wtf/mediawiki Jeroen De Dauw]",
"[https://professional.wiki/ Professional.Wiki]"
],

"url": "https://github.com/ProfessionalWiki/GND",

"descriptionmsg": "gnd-desc",

"requires": {
"MediaWiki": ">= 1.35.0",
"extensions": {
"WikibaseRepository": "*"
}
},

"MessagesDirs": {
"GND": [
"i18n"
]
},

"AutoloadNamespaces": {
"DNB\\GND\\": "src/",
"DNB\\GND\\Tests\\": "tests/"
},

"callback": "DNB\\GND\\HookHandlers::onExtensionRegistration",

"Hooks": {
},

"config": {
},

"ResourceFileModulePaths": {
"localBasePath": "resources",
"remoteExtPath": "GND/resources"
},

"ResourceModules": {
},

"manifest_version": 2
}
9 changes: 9 additions & 0 deletions i18n/en.json
@@ -0,0 +1,9 @@
{
"@metadata": {
"authors": [
"Jeroen De Dauw"
]
},
"gnd-name": "GND",
"gnd-desc": "Adds scripts to import GND items into Wikibase Repository"
}
13 changes: 13 additions & 0 deletions src/HookHandlers.php
@@ -0,0 +1,13 @@
<?php

declare( strict_types = 1 );

namespace DNB\GND;

final class HookHandlers {

public static function onExtensionRegistration(): void {

}

}
15 changes: 15 additions & 0 deletions tests/Unit/SmokeTest.php
@@ -0,0 +1,15 @@
<?php

declare( strict_types = 1 );

namespace DNB\GND\Tests\Unit;

use PHPUnit\Framework\TestCase;

class SmokeTest extends TestCase {

public function testCanRunTests() {
$this->assertTrue( true );
}

}

0 comments on commit cac835e

Please sign in to comment.