jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/346041 )

Change subject: Drops OAI-PMH support
......................................................................


Drops OAI-PMH support

Has nearly no usage

Change-Id: I8ad1a3ac4bda865e3580caf4a2e4bb37499e3a80
---
M extension.json
M includes/index/ProofreadIndexEntry.php
D includes/index/ProofreadIndexValue.php
D includes/index/oai/ProofreadIndexOaiError.php
D includes/index/oai/ProofreadIndexOaiRecord.php
D includes/index/oai/ProofreadIndexOaiSets.php
D includes/index/oai/SpecialProofreadIndexOai.php
D includes/index/oai/SpecialProofreadIndexOaiSchema.php
D includes/index/oai/schemas/qdc.xsd
9 files changed, 0 insertions(+), 1,994 deletions(-)

Approvals:
  jenkins-bot: Verified
  Tpt: Looks good to me, approved



diff --git a/extension.json b/extension.json
index 33ca862..5598903 100644
--- a/extension.json
+++ b/extension.json
@@ -18,8 +18,6 @@
                "pagequality"
        ],
        "SpecialPages": {
-               "ProofreadIndexOai": "SpecialProofreadIndexOai",
-               "ProofreadIndexOaiSchema": "SpecialProofreadIndexOaiSchema",
                "IndexPages": "ProofreadPages",
                "PagesWithoutScans": "PagesWithoutScans"
        },
@@ -46,18 +44,6 @@
                "ProofreadPage\\FileProvider": "includes/FileProvider.php",
                "EditProofreadIndexPage": 
"includes/index/EditProofreadIndexPage.php",
                "ProofreadIndexEntry": "includes/index/ProofreadIndexEntry.php",
-               "ProofreadIndexValue": "includes/index/ProofreadIndexValue.php",
-               "ProofreadIndexValueString": 
"includes/index/ProofreadIndexValue.php",
-               "ProofreadIndexValueNumber": 
"includes/index/ProofreadIndexValue.php",
-               "ProofreadIndexValuePage": 
"includes/index/ProofreadIndexValue.php",
-               "ProofreadIndexValueLangcode": 
"includes/index/ProofreadIndexValue.php",
-               "ProofreadIndexValueIdentifier": 
"includes/index/ProofreadIndexValue.php",
-               "ProofreadIndexValueIsbn": 
"includes/index/ProofreadIndexValue.php",
-               "ProofreadIndexValueIssn": 
"includes/index/ProofreadIndexValue.php",
-               "ProofreadIndexValueOclc": 
"includes/index/ProofreadIndexValue.php",
-               "ProofreadIndexValueLccn": 
"includes/index/ProofreadIndexValue.php",
-               "ProofreadIndexValueArc": 
"includes/index/ProofreadIndexValue.php",
-               "ProofreadIndexValueArk": 
"includes/index/ProofreadIndexValue.php",
                "ProofreadIndexPage": "includes/index/ProofreadIndexPage.php",
                "ProofreadIndexDbConnector": 
"includes/index/ProofreadIndexDbConnector.php",
                "ProofreadPage\\Pagination\\PaginationFactory": 
"includes/Pagination/PaginationFactory.php",
@@ -83,11 +69,6 @@
                "ProofreadPage\\Parser\\PagelistTagParser": 
"includes/Parser/PagelistTagParser.php",
                "ProofreadPage\\Parser\\PagesTagParser": 
"includes/Parser/PagesTagParser.php",
                "ProofreadPage\\Parser\\PagequalityTagParser": 
"includes/Parser/PagequalityTagParser.php",
-               "SpecialProofreadIndexOai": 
"includes/index/oai/SpecialProofreadIndexOai.php",
-               "ProofreadIndexOaiRecord": 
"includes/index/oai/ProofreadIndexOaiRecord.php",
-               "ProofreadIndexOaiSets": 
"includes/index/oai/ProofreadIndexOaiSets.php",
-               "ProofreadIndexOaiError": 
"includes/index/oai/ProofreadIndexOaiError.php",
-               "SpecialProofreadIndexOaiSchema": 
"includes/index/oai/SpecialProofreadIndexOaiSchema.php",
                "ProofreadPages": "SpecialProofreadPages.php",
                "PagesWithoutScans": "SpecialPagesWithoutScans.php",
                "ApiQueryProofread": "ApiQueryProofread.php",
diff --git a/includes/index/ProofreadIndexEntry.php 
b/includes/index/ProofreadIndexEntry.php
index a6529d4..0dfb34b 100644
--- a/includes/index/ProofreadIndexEntry.php
+++ b/includes/index/ProofreadIndexEntry.php
@@ -119,35 +119,6 @@
        }
 
        /**
-        * Return typed value. If the value doesn't match the value pattern a 
ProofreadIndexValueString is return.
-        * @param string $value
-        * @return ProofreadIndexValue
-        */
-       protected function getTypedValue( $value ) {
-               try {
-                       $class = 
ProofreadIndexValue::getIndexValueClassNameForType( $this->getType() );
-                       $val = new $class( $value, $this->config );
-               } catch ( MWException $e ) {
-                       $class = 
ProofreadIndexValue::getIndexValueClassNameForType( 'string' );
-                       $val = new $class( $value, $this->config );
-               }
-               return $val;
-       }
-
-       /**
-        * Return the values of the entry as ProofreadIndexValue and splitted 
with the delimiter content
-        * @return array ProofreadIndexValue
-        */
-       public function getTypedValues() {
-               $values = $this->getStringValues();
-
-               foreach ( $values as $id => $value ) {
-                       $values[$id] = $this->getTypedValue( $value );
-               }
-               return $values;
-       }
-
-       /**
         * Return the type of the entry
         * @return string
         */
@@ -240,55 +211,6 @@
                        } else {
                                return false;
                        }
-               }
-       }
-
-       /**
-        * Return the qualified Dublin Core property the entry belongs to with 
the 'dcterms' or 'dc' prefix
-        * @see http://dublincore.org/documents/dcmi-terms/
-        * @return string
-        */
-       public function getQualifiedDublinCoreProperty() {
-               if ( !isset( $this->config['data'] ) || !$this->config['data'] 
) {
-                       return null;
-               }
-
-               switch ( $this->config['data'] ) {
-                       case 'year':
-                               return 'dcterms:issued';
-                       case 'place':
-                               return 'dcterms:spatial';
-                       default:
-                               return $this->getSimpleDublinCoreProperty();
-               }
-       }
-
-       /**
-        * Return the qualified Dublin Core property the entry belongs to with 
the 'dc' prefix
-        * @see http://dublincore.org/documents/dces/
-        * @return string
-        */
-       public function getSimpleDublinCoreProperty() {
-               if ( !isset( $this->config['data'] ) || !$this->config['data'] 
) {
-                       return null;
-               }
-
-               switch ( $this->config['data'] ) {
-                       case 'language':
-                               return 'dc:language';
-                       case 'identifier':
-                               return 'dc:identifier';
-                       case 'title':
-                               return 'dc:title';
-                       case 'author':
-                               return 'dc:creator';
-                       case 'publisher':
-                               return 'dc:publisher';
-                       case 'translator':
-                       case 'illustrator':
-                               return 'dc:contributor';
-                       case 'year':
-                               return 'dc:date';
                }
        }
 }
diff --git a/includes/index/ProofreadIndexValue.php 
b/includes/index/ProofreadIndexValue.php
deleted file mode 100644
index bd0b84b..0000000
--- a/includes/index/ProofreadIndexValue.php
+++ /dev/null
@@ -1,664 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- */
-
-/**
- * A value of an index entry
- */
-abstract class ProofreadIndexValue {
-
-       /**
-        * The config of the entry
-        * @var array
-        */
-       protected $config;
-
-       /**
-        * @param string $value
-        * @param array $config
-        * @throws MWException
-        */
-       public function __construct( $value, $config ) {
-               if ( !$this->isValid( $value ) ) {
-                       throw new MWException( 'Initialisation value ' . $value 
. ' is not valid for type ' . $this->getType() );
-               }
-               $this->setValue( $value );
-               $this->config = $config;
-       }
-
-       /**
-        * Set the value
-        * @param string $value
-        */
-       abstract protected function setValue( $value );
-
-       /**
-        * Return the value of the entry as string
-        * @return string
-        */
-       abstract public function __toString();
-
-       /**
-        * Return the type of the entry
-        * @return string
-        */
-       abstract public function getType();
-
-       /**
-        * Return the "main" type of the entry (all identifiers are regrouped 
under the name identifier)
-        * @return string
-        */
-       public function getMainType() {
-               return $this->getType();
-       }
-
-       /**
-        * Return if $value is valid string
-        * @param string $value
-        * @return bool
-        */
-       public function isValid( $value ) {
-               return true;
-       }
-
-       /**
-        * Return name of the ProofreadIndexValue class for a type
-        * @param string $type
-        * @throws MWException
-        * @return string
-        */
-       public static function getIndexValueClassNameForType( $type ) {
-               switch ( $type ) {
-                       case 'string':
-                               return 'ProofreadIndexValueString';
-                       case 'page':
-                               return 'ProofreadIndexValuePage';
-                       case 'number':
-                               return 'ProofreadIndexValueNumber';
-                       case 'langcode':
-                               return 'ProofreadIndexValueLangcode';
-                       case 'uri':
-                               return 'ProofreadIndexValueUri';
-                       case 'isbn':
-                               return 'ProofreadIndexValueIsbn';
-                       case 'issn':
-                               return 'ProofreadIndexValueIssn';
-                       case 'lccn':
-                               return 'ProofreadIndexValueLccn';
-                       case 'oclc':
-                               return 'ProofreadIndexValueOclc';
-                       case 'arc':
-                               return 'ProofreadIndexValueArc';
-                       case 'ark':
-                               return 'ProofreadIndexValueArk';
-                       default:
-                               throw new MWException( 'Wrong type identifier: 
' . $type );
-               }
-       }
-}
-
-/**
- * A string value of an index entry
- */
-class ProofreadIndexValueString extends ProofreadIndexValue {
-
-       /**
-        * The wiki text value
-        * @var string
-        */
-       protected $wikiValue;
-
-       /**
-        * The value with wikitags removed
-        * @var string
-        */
-       protected $value;
-
-       /**
-        * Set the value
-        * @param string $value
-        */
-       protected function setValue( $value ) {
-               $this->wikiValue = (string) $value;
-       }
-
-       /**
-        * Return the value of the entry as string
-        * @return string
-        */
-       public function __toString() {
-       // TODO improve by removing all tags.
-               if ( $this->value !== null ) {
-                       return $this->value;
-               }
-
-               $value = $this->wikiValue;
-               $value = trim( $value, " '\t\n\r\0\x0B" );
-               if ( preg_match( "/^\[\[([^\|]*)\|?(.*)\]\]$/", $value, $m ) ) {
-                       if ( $m[2] ) {
-                               $value = $m[2];
-                       } else {
-                               $value = $m[1];
-                       }
-               }
-               $this->value = $value;
-               return $this->value;
-       }
-
-       /**
-        * Return the value of the entry as string with wiki tags
-        * @return string
-        */
-       public function getWiki() {
-               return $this->wikiValue;
-       }
-
-       /**
-        * Return the type of the entry
-        * @return string
-        */
-       public function getType() {
-               return 'string';
-       }
-}
-
-/**
- * A number value of an index entry
- */
-class ProofreadIndexValueNumber extends ProofreadIndexValue {
-
-       /**
-        * The value
-        * @var float
-        */
-       protected $value;
-
-       /**
-        * Set the value
-        * @param string $value
-        */
-       protected function setValue( $value ) {
-               $this->value = (float) $value;
-       }
-
-       /**
-        * Return the value of the entry as string
-        * @return string
-        */
-       public function __toString() {
-               return (string) $this->value;
-       }
-
-       /**
-        * Return if the value is an integer
-        * @return bool
-        */
-       public function isInteger() {
-               return floor( $this->value ) == $this->value;
-       }
-
-       /**
-        * Return the value of the entry as integer
-        * @return integer
-        */
-       public function getInteger() {
-               return (int) $this->value;
-       }
-
-       /**
-        * Return the value of the entry as float
-        * @return float
-        */
-       public function getFloat() {
-               return $this->value;
-       }
-
-       /**
-        * Return the type of the entry
-        * @return string
-        */
-       public function getType() {
-               return 'number';
-       }
-
-       /**
-        * Return if $value is valid string
-        * @param string $value
-        * @return bool
-        */
-       public function isValid( $value ) {
-               return is_numeric( $value );
-       }
-}
-
-/**
- * A page value of an index entry
- */
-class ProofreadIndexValuePage extends ProofreadIndexValue {
-
-       /**
-        * The value
-        * @var Title
-        */
-       protected $value;
-
-       /**
-        * Set the value
-        * @param string $value
-        */
-       protected function setValue( $value ) {
-               $value = trim( $value, " '\t\n\r\0\x0B" );
-               if ( preg_match( "/^\[\[([^\|]*)\|?(.*)\]\]$/", $value, $m ) ) {
-                       $value = $m[1];
-               }
-               $this->value = Title::newFromText( $value );
-       }
-
-       /**
-        * Return the value of the entry as string
-        * @return string
-        */
-       public function __toString() {
-               return $this->value->getFullText();
-       }
-
-       /**
-        * Return the base title of the page without namespace
-        * @return string
-        */
-       public function getMainText() {
-               $val = $this->value->getBaseText();
-               $parts = explode( ':', $this->value->getBaseText() );
-               if ( count( $parts ) > 1 && $parts[0] == 
$this->value->getNsText() ) {
-                       unset( $parts[0] );
-                       return implode( '/', $parts );
-               } else {
-                       return $val;
-               }
-       }
-
-       /**
-        * Return the value of the entry as URI
-        * @return string
-        */
-       public function getUri() {
-               return $this->value->getCanonicalURL();
-       }
-
-       /**
-        * Return the type of the entry
-        * @return string
-        */
-       public function getType() {
-               return 'page';
-       }
-
-       /**
-        * Return if $value is valid string
-        * @param string $value
-        * @return bool
-        */
-       public function isValid( $value ) {
-               $value = trim( $value, " '\t\n\r\0\x0B" );
-               if ( preg_match( "/^\[\[([^\|]*)\|?(.*)\]\]$/", $value, $m ) ) {
-                       $value = $m[1];
-               }
-               $title = Title::newFromText( $value );
-               return $title !== null;
-       }
-}
-
-/**
- * A Langcode value of an index entry
- */
-class ProofreadIndexValueLangcode extends ProofreadIndexValue {
-
-       /**
-        * The value
-        * @var string
-        */
-       protected $value;
-
-       /**
-        * Set the value
-        * @param string $value
-        */
-       protected function setValue( $value ) {
-               $this->value = $value;
-       }
-
-       /**
-        * Return the value of the entry as string
-        * @return string
-        */
-       public function __toString() {
-               return $this->value;
-       }
-
-       /**
-        * Return the type of the entry
-        * @return string
-        */
-       public function getType() {
-               return 'langcode';
-       }
-
-       /**
-        * Return if $value is valid string
-        * @param string $value
-        * @return bool
-        */
-       public function isValid( $value ) {
-               return Language::isValidBuiltInCode( $value );
-       }
-}
-
-/**
- * An identifier value of an index entry
- */
-abstract class ProofreadIndexValueIdentifier extends ProofreadIndexValue {
-
-       /**
-        * The value
-        * @var string
-        */
-       protected $value;
-
-       /**
-        * Set the value
-        * @param string $value
-        */
-       protected function setValue( $value ) {
-               $this->value = $value;
-       }
-
-       /**
-        * Return the value of the entry as URI
-        * @return string
-        */
-       abstract public function getUri();
-
-       /**
-        * Return the "main" type of the entry (all identifiers are regrouped 
under the name identifier)
-        * @return string
-        */
-       public function getMainType() {
-               return 'identifier';
-       }
-}
-
-/**
- * An ISBN value of an index entry
- */
-class ProofreadIndexValueIsbn extends ProofreadIndexValueIdentifier {
-
-       /**
-        * Return the value of the entry as string
-        * @return string
-        */
-       public function __toString() {
-               return 'ISBN ' . $this->value;
-       }
-
-       /**
-        * Return the value of the entry as URI
-        * @return string
-        */
-       public function getUri() {
-               return 'urn:ISBN:' . $this->value;
-       }
-
-       /**
-        * Return the type of the entry
-        * @return string
-        */
-       public function getType() {
-               return 'isbn';
-       }
-
-       /**
-        * Return if $value is valid string
-        * @param string $value
-        * @return bool
-        */
-       public function isValid( $value ) {
-               return SpecialBookSources::isValidISBN( $value );
-       }
-}
-
-/**
- * An ISSN value of an index entry
- */
-class ProofreadIndexValueIssn extends ProofreadIndexValueIdentifier {
-       const VALIDATION_REGEX = "/^\d{4}-\d{4}$/";
-
-       /**
-        * Return the value of the entry as string
-        * @return string
-        */
-       public function __toString() {
-               return 'ISSN ' . $this->value;
-       }
-
-       /**
-        * Return the value of the entry as URI
-        * @return string
-        */
-       public function getUri() {
-               return 'urn:ISSN:' . $this->value;
-       }
-
-       /**
-        * Return the type of the entry
-        * @return string
-        */
-       public function getType() {
-               return 'issn';
-       }
-
-       /**
-        * Return if $value is valid string
-        * @return bool
-        */
-       public function isValid( $value ) {
-               return preg_match( self::VALIDATION_REGEX, $value );
-       }
-}
-
-/**
- * An LCCN value of an index entry
- */
-class ProofreadIndexValueLccn extends ProofreadIndexValueIdentifier {
-
-       /**
-        * Return the value of the entry as string
-        * @return string
-        */
-       public function __toString() {
-               return 'LCCN ' . $this->value;
-       }
-
-       /**
-        * Return the value of the entry as URI
-        * @return string
-        */
-       public function getUri() {
-               return 'http://lccn.loc.gov/' . $this->value;
-       }
-
-       /**
-        * Return the type of the entry
-        * @return string
-        */
-       public function getType() {
-               return 'lccn';
-       }
-
-       /**
-        * Return if $value is valid string
-        * @param string $value
-        * @return bool
-        */
-       public function isValid( $value ) {
-               $length = strlen( $value );
-               return is_numeric( $value ) && $length >= 8 && $length <= 10;
-       }
-}
-
-/**
- * An LCCN value of an index entry
- */
-class ProofreadIndexValueOclc extends ProofreadIndexValueIdentifier {
-
-       /**
-        * Return the value of the entry as string
-        * @return string
-        */
-       public function __toString() {
-               return 'OCLC ' . $this->value;
-       }
-
-       /**
-        * Return the value of the entry as URI
-        * @return string
-        */
-       public function getUri() {
-               return 'http://www.worldcat.org/oclc/' . $this->value;
-       }
-
-       /**
-        * Return the type of the entry
-        * @return string
-        */
-       public function getType() {
-               return 'oclc';
-       }
-
-       /**
-        * Return if $value is valid string
-        * @param string $value
-        * @return bool
-        */
-       public function isValid( $value ) {
-               return is_numeric( $value );
-       }
-}
-
-/**
- * An ARC value of an index entry
- */
-class ProofreadIndexValueArc extends ProofreadIndexValueIdentifier {
-
-       /**
-        * Return the value of the entry as string
-        * @return string
-        */
-       public function __toString() {
-               return 'ARC ' . $this->value;
-       }
-
-       /**
-        * Return the value of the entry as URI
-        * @return string
-        */
-       public function getUri() {
-               return 'http://research.archives.gov/description/' . 
$this->value;
-       }
-
-       /**
-        * Return the type of the entry
-        * @return string
-        */
-       public function getType() {
-               return 'arc';
-       }
-
-       /**
-        * Return if $value is valid string
-        * @param string $value
-        * @return bool
-        */
-       public function isValid( $value ) {
-               return is_numeric( $value );
-       }
-}
-
-/**
- * An Archival Resource Key (ARK) value of an index entry
- */
-class ProofreadIndexValueArk extends ProofreadIndexValueIdentifier {
-
-       /**
-        * The Name Assigning Authority Number (NAAN)
-        * @var integer
-        */
-       protected $naan = 0;
-
-       /**
-        * @param string $value
-        * @param array $config
-        */
-       public function __construct( $value, $config ) {
-               if ( isset( $config['naan'] ) && $config['naan'] ) {
-                       $this->naan = $config['naan'];
-               }
-               parent::__construct( $value, $config );
-       }
-
-       /**
-        * Return the value of the entry as string
-        * @return string
-        */
-       public function __toString() {
-               return 'ARK ' . $this->value;
-       }
-
-       /**
-        * Return the value of the entry as URI
-        * @return string
-        */
-       public function getUri() {
-       // TODO add the canonical NMA
-               if ( $this->naan ) {
-                       return 'ark:/' . $this->naan . '/' . $this->value;
-               } else {
-                       return 'ark:/' . $this->value;
-               }
-       }
-
-       /**
-        * Return the type of the entry
-        * @return string
-        */
-       public function getType() {
-               return 'ark';
-       }
-
-       /**
-        * Return if $value is valid string
-        * @param string $value
-        * @return bool
-        */
-       public function isValid( $value ) {
-       // TODO to improve
-               if ( $this->naan ) {
-                       return true;
-               } else {
-                       return preg_match( "/^\d{5}\/.+$/", $value );
-               }
-       }
-}
diff --git a/includes/index/oai/ProofreadIndexOaiError.php 
b/includes/index/oai/ProofreadIndexOaiError.php
deleted file mode 100644
index 752e315..0000000
--- a/includes/index/oai/ProofreadIndexOaiError.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * The content of this file use some code from OAIRepo Mediawiki extension.
- */
-
-/**
- * OAI error
- */
-class ProofreadIndexOaiError extends Exception {
-
-       public function __construct( $message = '', $code = '' ) {
-               $this->message = $message;
-               $this->code = $code;
-       }
-
-       public function getXML() {
-               return Xml::element( 'error', [ 'code' => $this->getCode() ], 
$this->getMessage() ) . "\n";
-       }
-}
diff --git a/includes/index/oai/ProofreadIndexOaiRecord.php 
b/includes/index/oai/ProofreadIndexOaiRecord.php
deleted file mode 100644
index 8ddade8..0000000
--- a/includes/index/oai/ProofreadIndexOaiRecord.php
+++ /dev/null
@@ -1,227 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * The content of this file use some code from OAIRepo Mediawiki extension.
- *
- * @file
- * @ingroup SpecialPage
- */
-
-/**
- * Provide OAI record of an index page
- */
-class ProofreadIndexOaiRecord {
-       protected $index;
-       protected $lang;
-       protected $entries = [];
-       protected $lastEditionTimestamp;
-
-       /**
-        * @param ProofreadIndexPage $index
-        * @param string $lastEditionTimestamp MW timestamp of the last edition
-        */
-       public function __construct( ProofreadIndexPage $index, 
$lastEditionTimestamp ) {
-               $this->index = $index;
-               $this->lang = $this->index->getTitle()->getPageLanguage();
-               $this->lastEditionTimestamp = $lastEditionTimestamp;
-       }
-
-       /**
-        * Return OAI record of an index page.
-        * @param string $format
-        * @throws MWException
-        * @return string
-        */
-       public function renderRecord( $format ) {
-               $record = Xml::openElement( 'record' ) . "\n";
-               $record .= $this->renderHeader();
-               $record .= Xml::openElement( 'metadata' ) . "\n";
-               switch ( $format ) {
-                       case 'oai_dc':
-                               $record .= $this->renderOaiDc();
-                               break;
-                       case 'prp_qdc':
-                               $record .= $this->renderDcQdc();
-                               break;
-                       default:
-                               throw new MWException( 'Unsupported metadata 
format.' );
-               }
-               $record .= Xml::closeElement( 'metadata' ) . "\n";
-               $record .= Xml::closeElement( 'record' ) . "\n";
-               return $record;
-       }
-
-       /**
-        * Return header of an OAI record of an index page.
-        * @return string
-        */
-       public function renderHeader() {
-               $text = Xml::openElement( 'header' ) . "\n";
-               $text .= Xml::element( 'identifier', null, 
$this->getIdentifier() ) . "\n";
-               $text .= Xml::element( 'datestamp',  null, 
SpecialProofreadIndexOai::datestamp( $this->lastEditionTimestamp ) ) . "\n";
-               $sets = ProofreadIndexOaiSets::getSetSpecsForTitle( 
$this->index->getTitle() );
-               foreach ( $sets as $set ) {
-                       $text .= Xml::element( 'setSpec',  null, $set ) . "\n";
-               }
-               $text .= Xml::closeElement( 'header' ) . "\n";
-               return $text;
-       }
-
-       /**
-        * Return identifier of the record.
-        * @return string
-        */
-       protected function getIdentifier() {
-               return 'oai:' . 
SpecialProofreadIndexOai::repositoryIdentifier() . ':' . 
SpecialProofreadIndexOai::repositoryBasePath() . '/' . wfUrlencode( 
$this->index->getTitle()->getDBkey() );
-       }
-
-       /**
-        * Return OAI DC record of an index page.
-        * @return string
-        */
-       protected function renderOaiDc() {
-               global $wgMimeType;
-
-               $record = Xml::openElement( 'oai_dc:dc', [
-                       'xmlns:oai_dc' => 
'http://www.openarchives.org/OAI/2.0/oai_dc/',
-                       'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
-                       'xmlns:xsi' => 
'http://www.w3.org/2001/XMLSchema-instance',
-                       'xsi:schemaLocation' => 
'http://www.openarchives.org/OAI/2.0/oai_dc/ 
http://www.openarchives.org/OAI/2.0/oai_dc.xsd' ] )
-                       . "\n";
-
-               $record .= Xml::element( 'dc:type', null, 'Text' );
-               $record .= Xml::element( 'dc:format', null, $wgMimeType );
-
-               $mime = $this->index->getMimeType();
-               if ( $mime ) {
-                       $record .= Xml::element( 'dc:format', null, $mime );
-               }
-
-               $metadata = $this->index->getIndexEntries();
-               foreach ( $metadata as $entry ) {
-                       $record .= $this->getOaiDcEntry( $entry );
-               }
-               $record .= Xml::closeElement( 'oai_dc:dc' );
-               return $record;
-       }
-
-       /**
-        * Return Dublin Core entry
-        * @param ProofreadIndexEntry $entry
-        * @throws MWException
-        * @return string
-        */
-       protected function getOaiDcEntry( ProofreadIndexEntry $entry ) {
-               $key = $entry->getSimpleDublinCoreProperty();
-               if ( !$key ) {
-                       return '';
-               }
-
-               $text = '';
-               $values = $entry->getTypedValues();
-               foreach ( $values as $value ) {
-                       switch ( $value->getMainType() ) {
-                               case 'string':
-                                       $text .= Xml::element( $key, [ 
'xml:lang' => $this->lang->getHtmlCode() ], $value ) . "\n";
-                                       break;
-                               case 'page':
-                                       $text .= Xml::element( $key, null, 
$value->getMainText() ) . "\n";
-                                       break;
-                               case 'number':
-                                       $text .= Xml::element( $key, null, 
$value ) . "\n";
-                                       break;
-                               case 'identifier':
-                                       $text .= Xml::element( $key, null, 
$value->getUri() ) . "\n";
-                                       break;
-                               case 'langcode':
-                                       $text .= Xml::element( $key, null, 
$value ) . "\n";
-                                       break;
-                               default:
-                                       throw new MWException( 'Unknown type: ' 
. $entry->getType() );
-                       }
-               }
-               return $text;
-       }
-
-       /**
-        * Return Qualified Dublin Core record of an index page.
-        * @return string
-        */
-       protected function renderDcQdc() {
-               global $wgMimeType;
-               $record = Xml::openElement( 'prp_qdc:qdc', [
-                       'xmlns:prp_qdc' => 
'http://mediawiki.org/xml/proofreadpage/qdc/',
-                       'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
-                       'xmlns:dcterms' => 'http://purl.org/dc/terms/',
-                       'xmlns:xsi' => 
'http://www.w3.org/2001/XMLSchema-instance',
-                       'xsi:schemaLocation' => 
'http://mediawiki.org/xml/proofreadpage/qdc/ ' . Title::makeTitle( NS_SPECIAL, 
'ProofreadIndexOaiSchema/qdc' )->getFullURL() ] )
-                       . "\n";
-
-               $record .= Xml::element( 'dc:type', [ 'xsi:type' => 
'dcterms:DCMIType' ], 'Text' );
-               $record .= Xml::element( 'dc:format', [ 'xsi:type' => 
'dcterms:IMT' ], $wgMimeType );
-
-               $mime = $this->index->getMimeType();
-               if ( $mime ) {
-                       $record .= Xml::element( 'dc:format', [ 'xsi:type' => 
'dcterms:IMT' ], $mime );
-               }
-
-               $metadata = $this->index->getIndexEntries();
-               foreach ( $metadata as $entry ) {
-                       $record .= $this->getDcQdcEntry( $entry );
-               }
-               $record .= Xml::closeElement( 'prp_qdc:qdc' );
-               return $record;
-       }
-
-       /**
-        * Return Qualified Dublin Core entry
-        * @param ProofreadIndexEntry $entry
-        * @throws MWException
-        * @return string
-        */
-       protected function getDcQdcEntry( ProofreadIndexEntry $entry ) {
-               $key = $entry->getQualifiedDublinCoreProperty();
-               if ( !$key ) {
-                       return '';
-               }
-
-               $text = '';
-               $values = $entry->getTypedValues();
-               foreach ( $values as $value ) {
-                       switch ( $value->getMainType() ) {
-                               case 'string':
-                                       $text .= Xml::element( $key, [ 
'xml:lang' => $this->lang->getHtmlCode() ], $value ) . "\n";
-                                       break;
-                               case 'page':
-                                       $text .= Xml::element( $key, null, 
$value->getMainText() ) . "\n";
-                                       break;
-                               case 'number':
-                                       $text .= Xml::element( $key, [ 
'xsi:type' => 'xsi:decimal' ], $value ) . "\n";
-                                       break;
-                               case 'identifier':
-                                       $text .= Xml::element( $key, [ 
'xsi:type' => 'dcterms:URI' ], $value->getUri() ) . "\n";
-                                       break;
-                               case 'langcode':
-                                       $text .= Xml::element( $key, [ 
'xsi:type' => 'dcterms:RFC5646' ], $value ) . "\n";
-                                       break;
-                               default:
-                                       throw new MWException( 'Unknown type: ' 
. $entry->getType() );
-                       }
-               }
-               return $text;
-       }
-}
diff --git a/includes/index/oai/ProofreadIndexOaiSets.php 
b/includes/index/oai/ProofreadIndexOaiSets.php
deleted file mode 100644
index 77e7d2a..0000000
--- a/includes/index/oai/ProofreadIndexOaiSets.php
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * The content of this file use some code from OAIRepo Mediawiki extension.
- *
- * @file
- */
-
-/**
- * Manage sets-related features
- */
-class ProofreadIndexOaiSets {
-
-       /**
-        * @return array an associative array containing the sets with as key 
their identifier.
-        * This array is like:
-        * array(
-        *      'test' => array(
-        *              'spec' => 'test', //The set spec
-        *              'name' => 'Test', //The set name
-        *              'category' => 'tests_list', //The category to use, 
without the "Category:" prefix
-        *              'description' => 'A test set.' //Description of the 
set, optional
-        *              )
-        * );
-        */
-       public static function getSetsBySpec() {
-               static $setsBySpec = null;
-               if ( $setsBySpec !== null ) {
-                       return $setsBySpec;
-               }
-
-               $data = wfMessage( 'proofreadpage_index_oai_sets' 
)->inContentLanguage();
-               if ( !$data->exists() || $data->plain() == '' ) {
-                       $setsBySpec = [];
-                       return $setsBySpec;
-               }
-               $config = FormatJson::decode( $data->plain(), true );
-               if ( $config === null ) {
-                       $setsBySpec = [];
-                       return $setsBySpec;
-               }
-               $setsBySpec = [];
-               foreach ( $config as $spec => $set ) {
-                       if ( !isset( $set['category'] ) || strstr( $spec, ':' ) 
!== false ) {
-                               continue;
-                       }
-                       if ( !isset( $set['name'] ) ) {
-                               $set['name'] = $set['category'];
-                       }
-                       $set['category'] = str_replace( ' ', '_', 
$set['category'] );
-                       $set['spec'] = $spec;
-                       $setsBySpec[$spec] = $set;
-               }
-               return $setsBySpec;
-       }
-
-       /**
-        * @return array an associative array containing the sets with as key 
the name of the category used.
-        * For the array structure see getSetsBySpec()
-        */
-       public static function getSetsByCategory() {
-               static $setsByCategory = null;
-               if ( $setsByCategory !== null ) {
-                       return $setsByCategory;
-               }
-
-               $setsBySpec = self::getSetsBySpec();
-               $setsByCategory = [];
-               foreach ( $setsBySpec as $set ) {
-                       $setsByCategory[$set['category']] = $set;
-               }
-               return $setsByCategory;
-       }
-
-       /**
-        * Returns if this repository has sets or not
-        * @return bool
-        */
-       public static function withSets() {
-               return self::getSetsBySpec() !== [];
-       }
-
-       /**
-        * Returns the list of the specs of sets that contain a page
-        * @param Title $title
-        * @return array
-        */
-       public static function getSetSpecsForTitle( Title $title ) {
-               if ( !self::withSets() ) {
-                       return [];
-               }
-               $sets = self::getSetsByCategory();
-               $list = [];
-
-               $db = wfGetDB( DB_SLAVE );
-               $results = $db->select(
-                       [ 'page', 'categorylinks' ],
-                       [ 'cl_to' ],
-                       $title->pageCond() + [ 'cl_from = page_id' ],
-                       __METHOD__
-               );
-
-               foreach ( $results as $result ) {
-                       if ( isset( $sets[$result->cl_to] ) ) {
-                               $list[] = $sets[$result->cl_to]['spec'];
-                       }
-               }
-               return $list;
-       }
-
-       /**
-        * Returns the name of the category for a set or null if the set does 
not exist.
-        * @param string $spec the set spec
-        * @return string|null
-        */
-       public static function getCategoryForSpec( $spec ) {
-               $sets = self::getSetsBySpec();
-               if ( isset( $sets[$spec] ) ) {
-                       return $sets[$spec]['category'];
-               } else {
-                       return null;
-               }
-       }
-}
diff --git a/includes/index/oai/SpecialProofreadIndexOai.php 
b/includes/index/oai/SpecialProofreadIndexOai.php
deleted file mode 100644
index 0eb6c63..0000000
--- a/includes/index/oai/SpecialProofreadIndexOai.php
+++ /dev/null
@@ -1,710 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * The content of this file use some code from OAIRepo Mediawiki extension.
- *
- * @file
- * @ingroup SpecialPage
- */
-
-/**
- * A special page to return metadata of index pages in RDF/XML
- * @see http://www.openarchives.org/OAI/openarchivesprotocol.html
- */
-class SpecialProofreadIndexOai extends UnlistedSpecialPage {
-
-       /**
-        * @var array Parameters of the request
-        */
-       protected $request = [];
-
-       /**
-        * @var DatabaseBase Slave database
-        */
-       protected $db;
-
-       /**
-        * @var string URL of the API
-        */
-       protected $baseUrl;
-
-       public function __construct() {
-               parent::__construct( 'ProofreadIndexOai' );
-               $this->baseUrl = $this->getPageTitle()->getCanonicalUrl();
-       }
-
-       public function execute( $par ) {
-               $this->getOutput()->disable();
-
-               $this->db = wfGetDB( DB_SLAVE );
-               $this->outputOai();
-       }
-
-       /**
-        * Return OAI datestamp
-        * @param string $datestamp MW Timestamp
-        * @param string $granularity OAI ganularity ('YYYY-MM-DDThh:mm:ssZ' or 
'YYY-MM-DD')
-        * @throws MWException
-        * @return string
-        */
-       public static function datestamp( $datestamp, $granularity = 
'YYYY-MM-DDThh:mm:ssZ' ) {
-               $lang = new Language();
-               if ( $granularity == 'YYYY-MM-DDThh:mm:ssZ' ) {
-                       return $lang->sprintfDate( 'Y-m-d\TH:i:s\Z', $datestamp 
);
-               } elseif ( $granularity == 'YYY-MM-DD' ) {
-                       return $lang->sprintfDate( 'Y-m-d', $datestamp );
-               } else {
-                       throw new MWException( 'Unknown granularity' );
-               }
-       }
-
-       /**
-        * Return parameters of the request
-        * @throws ProofreadIndexOaiError
-        * @return array
-        */
-       protected function parseRequest() {
-               $request = $this->getRequest();
-
-               $verbs = [
-                       'GetRecord' => [
-                               'required'  => [ 'identifier', 'metadataPrefix' 
] ],
-                       'Identify' => [],
-                       'ListIdentifiers' => [
-                               'exclusive' =>        'resumptionToken',
-                               'required'  => [ 'metadataPrefix' ],
-                               'optional'  => [ 'from', 'until', 'set' ] ],
-                       'ListMetadataFormats' => [
-                               'optional'  => [ 'identifier' ] ],
-                       'ListRecords' => [
-                               'exclusive' =>        'resumptionToken',
-                               'required'  => [ 'metadataPrefix' ],
-                               'optional'  => [ 'from', 'until', 'set' ] ],
-                       'ListSets' => [
-                               'exclusive' => 'resumptionToken' ]
-                       ];
-
-               $req = [];
-
-               $verb = $request->getVal( 'verb' );
-               $req['verb'] = $verb;
-
-               if ( !isset( $verbs[$verb] ) ) {
-                       throw new ProofreadIndexOaiError( 'Unrecognized or no 
verb provided.', 'badVerb' );
-               }
-
-               $params = $verbs[$verb];
-
-               /* If an exclusive parameter is set, it's the only one we'll 
see */
-               if ( isset( $params['exclusive'] ) ) {
-                       $exclusive = $request->getVal( $params['exclusive'] );
-                       if ( !is_null( $exclusive ) ) {
-                               $req[$params['exclusive']] = $exclusive;
-                               return $req;
-                       }
-               }
-
-               /* Required parameters must all be present if no exclusive was 
found */
-               if ( isset( $params['required'] ) ) {
-                       foreach ( $params['required'] as $name ) {
-                               $val = $request->getVal( $name );
-                               if ( is_null( $val ) ) {
-                                       throw new ProofreadIndexOaiError( 
'Missing required argument "' . $name . '"', 'badArgument' );
-                               } else {
-                                       $req[$name] = $val;
-                               }
-                       }
-               }
-
-               /* Optionals are, well, optional. */
-               if ( isset( $params['optional'] ) ) {
-                       foreach ( $params['optional'] as $name ) {
-                               $val = $request->getVal( $name );
-                               if ( !is_null( $val ) ) {
-                                       $req[$name] = $val;
-                               }
-                       }
-               }
-               return $req;
-       }
-
-       /**
-        * Output OAI
-        */
-       public function outputOai() {
-               header( 'Content-type: text/xml; charset=utf-8' );
-               echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
-               echo Xml::openElement( 'OAI-PMH', [
-                       'xmlns' => 'http://www.openarchives.org/OAI/2.0/',
-                       'xmlns:xsi' => 
'http://www.w3.org/2001/XMLSchema-instance',
-                       'xsi:schemaLocation' => 
'http://www.openarchives.org/OAI/2.0/ 
http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd' ] )
-                       . "\n";
-               $error = '';
-               try {
-                       $this->request = $this->parseRequest();
-               } catch ( ProofreadIndexOaiError $e ) {
-                       $error = $e->getXML();
-               }
-               echo $this->responseDate();
-               echo $this->regurgitateRequest();
-               if ( $error === '' ) {
-                       try {
-                               $this->doResponse( $this->request['verb'] );
-                       } catch ( ProofreadIndexOaiError $e ) {
-                               echo $e->getXML();
-                       }
-               } else {
-                       echo $error;
-               }
-               echo Xml::closeElement( 'OAI-PMH' );
-       }
-
-       /**
-        * Return the responseDate node
-        * @return string XML
-        */
-       protected function responseDate() {
-               return Xml::element( 'responseDate', null, wfTimestamp( 
TS_ISO_8601 ) ) . "\n";
-       }
-
-       /**
-        * Return the request node
-        * @return string XML
-        */
-       protected function regurgitateRequest() {
-               return Xml::element( 'request', $this->request, $this->baseUrl 
) . "\n";
-       }
-
-       /**
-        * Output the main OAI content
-        * @param string $verb
-        * @throws MWException
-        */
-       protected function doResponse( $verb ) {
-               switch ( $verb ) {
-                       case 'Identify':
-                               $this->identify();
-                               break;
-                       case 'ListIdentifiers':
-                       case 'ListRecords':
-                               $this->listRecords( $verb );
-                               break;
-                       case 'ListSets':
-                               $this->listSets();
-                               break;
-                       case 'ListMetadataFormats':
-                               $this->listMetadataFormats();
-                               break;
-                       case 'GetRecord':
-                               $this->GetRecord();
-                               break;
-                       default:
-                               throw new MWException( 'Verb not implemented' );
-               }
-       }
-
-       /**
-        * Output the Identify action
-        */
-       protected function identify() {
-               echo Xml::openElement( 'Identify' ) . "\n";
-               $this->identifyInfo();
-               $this->identifierDescription();
-               $this->eprintDescription();
-               $this->brandingDescription();
-               echo Xml::closeElement( 'Identify' ) . "\n";
-       }
-
-       /**
-        * Output the main informations about the repository
-        */
-       protected function identifyInfo() {
-               global $wgEmergencyContact;
-               echo Xml::element( 'repositoryName', null, $this->msg( 
'proofreadpage-indexoai-repositoryName' )->inContentLanguage()->text() ) . "\n";
-               echo Xml::element( 'baseURL', null, $this->baseUrl ) . "\n";
-               echo Xml::element( 'protocolVersion', null, '2.0' ) . "\n";
-               echo Xml::element( 'adminEmail', null, $wgEmergencyContact ) . 
"\n";
-               echo Xml::element( 'earliestDatestamp', null, self::datestamp( 
$this->earliestDatestamp() ) ) . "\n";
-               echo Xml::element( 'deletedRecord', null, 'no' ) . "\n";
-               echo Xml::element( 'granularity', null, 'YYYY-MM-DDThh:mm:ssZ' 
) . "\n";
-               if ( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) && strpos( 
$_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) !== false ) {
-                       echo Xml::element( 'compression', null, 'gzip' ) . "\n";
-               }
-               if ( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) && strpos( 
$_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate' ) !== false ) {
-                       echo Xml::element( 'compression', null, 'deflate' ) . 
"\n";
-               }
-       }
-
-       /**
-        * Output the indentifier sheme used by the repository
-        * @see 
http://www.openarchives.org/OAI/2.0/guidelines-oai-identifier.htm
-        */
-       protected function identifierDescription() {
-               echo Xml::openElement( 'description' ) . "\n";
-               echo Xml::openElement( 'oai-identifier', [
-                       'xmlns' => 
'http://www.openarchives.org/OAI/2.0/oai-identifier',
-                       'xmlns:xsi' => 
'http://www.w3.org/2001/XMLSchema-instance',
-                       'xsi:schemaLocation' => 
'http://www.openarchives.org/OAI/2.0/oai-identifier 
http://www.openarchives.org/OAI/2.0/oai-identifier.xsd' ] )
-                       . "\n";
-               echo Xml::element( 'scheme', null, 'oai' ) . "\n";
-               echo Xml::element( 'repositoryIdentifier', null, 
$this->repositoryIdentifier() ) . "\n";
-               echo Xml::element( 'delimiter', null, ':' ) . "\n";
-               echo Xml::element( 'sampleIdentifier', null, 'oai:' . 
$this->repositoryIdentifier() . ':' . $this->repositoryBasePath() . 
'/La_Fontaine_-_The_Original_Fables_Of,_1913.djvu' ) . "\n";
-               echo Xml::closeElement( 'oai-identifier' ) . "\n";
-               echo Xml::closeElement( 'description' ) . "\n";
-       }
-
-       /*
-        * Output some informations about content of the repository
-        * @see http://www.openarchives.org/OAI/2.0/guidelines-eprints.htm
-        */
-       protected function eprintDescription() {
-               echo Xml::openElement( 'description' ) . "\n";
-               echo Xml::openElement( 'eprints', [
-                       'xmlns' => 
'http://www.openarchives.org/OAI/1.1/eprints',
-                       'xmlns:xsi' => 
'http://www.w3.org/2001/XMLSchema-instance',
-                       'xsi:schemaLocation' => 
'http://www.openarchives.org/OAI/1.1/eprints 
http://www.openarchives.org/OAI/1.1/eprints.xsd' ] )
-                       . "\n";
-
-               $url = $this->msg( 'proofreadpage-indexoai-eprint-content-url' 
)->inContentLanguage()->text();
-               $text = $this->msg( 
'proofreadpage-indexoai-eprint-content-text' )->inContentLanguage()->text();
-               $this->addEprintEntry( 'content', $url, $text );
-
-               $about = Title::newFromText( $this->msg( 'Aboutpage' 
)->inContentLanguage()->text() );
-               if ( $about !== null ) {
-                       $aboutUrl = $about->getCanonicalUrl();
-                       $this->addEprintEntry( 'metadataPolicy', $aboutUrl, 
null );
-                       $this->addEprintEntry( 'dataPolicy', $aboutUrl, null );
-               }
-               echo Xml::closeElement( 'eprints' ) . "\n";
-               echo Xml::closeElement( 'description' ) . "\n";
-       }
-
-       /*
-        * Output an entry of the eprints description
-        */
-       protected function addEprintEntry( $element, $url, $text ) {
-               if ( $url || $text ) {
-                       echo Xml::openElement( $element ) . "\n";
-                       if ( $url ) {
-                               echo Xml::element( 'URL', null, $url ) . "\n";
-                       }
-                       if ( $text ) {
-                               echo Xml::element( 'text', null, $text ) . "\n";
-                       }
-                       echo Xml::closeElement( $element ) . "\n";
-               } else {
-                       echo Xml::element( $element, null, '' ) . "\n";
-               }
-       }
-
-       /**
-        * Output some information about presentation of the repository
-        * @see http://www.openarchives.org/OAI/2.0/guidelines-branding.htm
-        */
-       protected function brandingDescription() {
-               global $wgLogo, $wgSitename;
-               if ( !isset( $wgLogo ) ) {
-                       return;
-               }
-
-               echo Xml::openElement( 'description' ) . "\n";
-               echo Xml::openElement( 'branding', [
-                       'xmlns' => 
'http://www.openarchives.org/OAI/2.0/branding/',
-                       'xmlns:xsi' => 
'http://www.w3.org/2001/XMLSchema-instance',
-                       'xsi:schemaLocation' => 
'http://www.openarchives.org/OAI/2.0/branding/ 
http://www.openarchives.org/OAI/2.0/branding.xsd' ] )
-                       . "\n";
-               echo Xml::openElement( 'collectionIcon' ) . "\n";
-               echo Xml::element( 'url', null, self::normalizeFullUrl( $wgLogo 
) ) . "\n";
-               echo Xml::element( 'link', null, 
Title::newMainPage()->getCanonicalUrl() ) . "\n";
-               echo Xml::element( 'title', null, $wgSitename ) . "\n";
-               echo Xml::closeElement( 'collectionIcon' ) . "\n";
-               echo Xml::closeElement( 'branding' ) . "\n";
-               echo Xml::closeElement( 'description' ) . "\n";
-       }
-
-       protected function stripIdentifier( $identifier ) {
-               $prefix = 'oai:' . self::repositoryIdentifier() . ':' . 
self::repositoryBasePath() . '/';
-               if ( substr( $identifier, 0, strlen( $prefix ) ) == $prefix ) {
-                       return substr( $identifier, strlen( $prefix ) );
-               }
-               return false;
-       }
-
-       /**
-        * Return the repositoryIndentifier ie the domain name of the website.
-        * @return string
-        */
-       public static function repositoryIdentifier() {
-               static $prefix;
-               if ( $prefix ) {
-                       return $prefix;
-               }
-
-               global $wgServer;
-               $prefix = parse_url( self::normalizeFullUrl( $wgServer ), 
PHP_URL_HOST );
-               return $prefix;
-       }
-
-       /**
-        * Return the base path for all the records of the repository
-        * @return string
-        */
-       public static function repositoryBasePath() {
-               return 'prpIndex';
-       }
-
-       /**
-        * Add if needed the base URL or the sheme
-        * @param string $url
-        * @return string
-        */
-       protected static function normalizeFullUrl( $url ) {
-               global $wgServer;
-
-               if ( $url[0] === '/' ) {
-                       if ( $url[1] === '/' ) {
-                               return 'http:' . $url;
-                       } else {
-                               return $wgServer . $url;
-                       }
-               } else {
-                       return $url;
-               }
-       }
-
-       /**
-        * Return the earliest last rev_timestamp of an index page
-        * @throws MWException
-        * @return string
-        */
-       protected function earliestDatestamp() {
-               global $wgMemc;
-               $memcKey = wfMemcKey( 'proofreadindexoai-earliestdatestamp' );
-               $datestamp = $wgMemc->get( $memcKey );
-
-               if ( $datestamp === false ) {
-                       $row = $this->db->selectRow(
-                               [ 'revision', 'page' ],
-                               [ 'MIN(rev_timestamp) AS min' ],
-                               [ 'rev_id = page_latest' ] + [ 'page_namespace' 
=> ProofreadPage::getIndexNamespaceId() ],
-                               __METHOD__
-                       );
-                       if ( $row->min ) {
-                               $datestamp = $row->min;
-                               $wgMemc->set( $memcKey, $datestamp, 60*60*24 );
-                       } else {
-                               throw new MWException( 'Bogus result.' );
-                       }
-               }
-
-               return $datestamp;
-       }
-
-       /**
-        * Output the ListSets action
-        */
-       protected function listSets() {
-               // try if the page exist (required by specification)
-               if ( !ProofreadIndexOaiSets::withSets() ) {
-                       throw new ProofreadIndexOaiError( "This repository 
doesn't support sets.", 'noSetHierarchy' );
-               }
-
-               $sets = ProofreadIndexOaiSets::getSetsBySpec();
-               echo Xml::openElement( 'ListSets' ) . "\n";
-               foreach ( $sets as $set ) {
-                       echo Xml::openElement( 'set' ) . "\n";
-                       echo Xml::element( 'setSpec', null, $set['spec'] ) . 
"\n";
-                       echo Xml::element( 'setName', null, $set['name'] ) . 
"\n";
-                       if ( isset( $set['description'] ) ) {
-                               echo Xml::openElement( 'setDescription' ) . 
"\n";
-                               echo Xml::openElement( 'oai_dc:dc', [
-                                       'xmlns:oai_dc' => 
'http://www.openarchives.org/OAI/2.0/oai_dc/',
-                                       'xmlns:dc' => 
'http://purl.org/dc/elements/1.1/',
-                                       'xmlns:xsi' => 
'http://www.w3.org/2001/XMLSchema-instance',
-                                       'xsi:schemaLocation' => 
'http://www.openarchives.org/OAI/2.0/oai_dc/ 
http://www.openarchives.org/OAI/2.0/oai_dc.xsd' ] )
-                                       . "\n";
-                               echo Xml::element( 'dc:description', null, 
$set['description'] ) . "\n";
-                               echo Xml::closeElement( 'oai_dc:dc' ) . "\n";
-                               echo Xml::closeElement( 'setDescription' ) . 
"\n";
-                       }
-                       echo Xml::closeElement( 'set' ) . "\n";
-               }
-               echo Xml::closeElement( 'ListSets' ) . "\n";
-       }
-
-       /**
-        * Output the ListMetadataFormats action
-        * @throws ProofreadIndexOaiError
-        */
-       protected function listMetadataFormats() {
-               // try if the page exist (required by specification)
-               if ( isset( $this->request['identifier'] ) ) {
-                       $this->getRecordPage( $this->request['identifier'] );
-               }
-
-               $formats = $this->metadataFormats();
-               echo Xml::openElement( 'ListMetadataFormats' ) . "\n";
-               foreach ( $formats as $prefix => $format ) {
-                       echo Xml::openElement( 'metadataFormat' ) . "\n";
-                       echo Xml::element( 'metadataPrefix', null, $prefix ) . 
"\n";
-                       echo Xml::element( 'schema', null, $format['schema'] ) 
. "\n";
-                       echo Xml::element( 'metadataNamespace', null, 
$format['namespace'] ) . "\n";
-                       echo Xml::closeElement( 'metadataFormat' ) . "\n";
-               }
-               echo Xml::closeElement( 'ListMetadataFormats' ) . "\n";
-       }
-
-       /**
-        * Return the list of metadata formats available in the repository
-        * @return string
-        */
-       protected function metadataFormats() {
-               return [
-                       'oai_dc' => [
-                               'namespace' => 
'http://www.openarchives.org/OAI/2.0/oai_dc/',
-                               'schema'    => 
'http://www.openarchives.org/OAI/2.0/oai_dc.xsd'
-                       ],
-                       'prp_qdc' => [
-                               'namespace' => 
'http://mediawiki.org/xml/proofreadpage/qdc/',
-                               'schema'    => Title::makeTitle( NS_SPECIAL, 
'ProofreadIndexOaiSchema/qdc' )->getFullURL()
-                       ]
-               ];
-       }
-
-       /**
-        * check if the parameter is a valid metadata format and return it
-        * @param string $var Request parameter that contain a metadata format
-        * @throws ProofreadIndexOaiError
-        * @return string|null
-        */
-       protected function validateMetadata( $var ) {
-               if ( !isset( $this->request[$var] ) ) {
-                       return null;
-               }
-               $prefix = $this->request[$var];
-               $formats = $this->metadataFormats();
-               if ( isset( $formats[$prefix] ) ) {
-                       return $this->request[$var];
-               } else {
-                       throw new ProofreadIndexOaiError( 'Requested 
unsupported metadata format.', 'cannotDisseminateFormat' );
-               }
-       }
-
-       /**
-        * Output the GetRecord action
-        */
-       protected function getRecord() {
-               $metadataPrefix = $this->validateMetadata( 'metadataPrefix' );
-               $page = $this->getRecordPage( $this->request['identifier'] );
-               $item = new ProofreadIndexOaiRecord( $page, 
$this->getRecordDatestamp( $page->getTitle() ) );
-               echo Xml::openElement( 'GetRecord' ) . "\n";
-               echo $item->renderRecord( $metadataPrefix );
-               echo Xml::closeElement( 'GetRecord' ) . "\n";
-       }
-
-       /**
-        * Get the Title page for a record
-        * @param string $identifier
-        * @throws ProofreadIndexOaiError
-        * @return ProofreadIndexPage
-        */
-       protected function getRecordPage( $identifier ) {
-               $pageid = urldecode( $this->stripIdentifier( $identifier ) );
-               if ( $pageid ) {
-                       $title = Title::makeTitleSafe( 
ProofreadPage::getIndexNamespaceId(), $pageid );
-                       if ( $title !== null && $title->exists() ) {
-                               return ProofreadIndexPage::newFromTitle( $title 
);
-                       }
-               }
-               throw new ProofreadIndexOaiError( 'Requested identifier is 
invalid or does not exist.', 'idDoesNotExist' );
-       }
-
-       /**
-        * Return the datestamp for a record
-        * @param Title $title
-        * @throws MWException
-        * @return string rev_timestamp
-        */
-       protected function getRecordDatestamp( Title $title ) {
-               $row = $this->db->selectRow(
-                       [ 'page', 'revision' ],
-                       [ 'rev_timestamp' ],
-                       $title->pageCond(),
-                       __METHOD__,
-                       [],
-                       [ 'page' => [ 'JOIN', 'rev_id = page_latest' ] ]
-               );
-               if ( $row->rev_timestamp ) {
-                       return $row->rev_timestamp;
-               } else {
-                       throw new MWException( 'Bogus result.' );
-               }
-       }
-
-       /**
-        * Check if an OAI datestamp is valid
-        * @param string $var Request parameter that contain a datestamp
-        * @param string $defaultTime default time for a date-only datestamp as 
HHMMSS
-        * @throws ProofreadIndexOaiError
-        * @return string|null timestamp in MW format
-        */
-       protected function validateDatestamp( $var, $defaultTime = '000000' ) {
-               if ( !isset( $this->request[$var] ) ) {
-                       return null;
-               }
-               $time = $this->request[$var];
-               $matches = [];
-               if ( preg_match( '/^(\d\d\d\d)-(\d\d)-(\d\d)$/', $time, 
$matches ) ) {
-                       return wfTimestamp( TS_MW, $matches[1] . $matches[2] . 
$matches[3] . $defaultTime );
-               } elseif ( preg_match( 
'/^(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)Z$/', $time, $matches ) ) {
-                       return wfTimestamp( TS_MW, $matches[1] . $matches[2] . 
$matches[3] . $matches[4] . $matches[5] . $matches[6] );
-               } else {
-                       throw new ProofreadIndexOaiError( "Illegal timestamp 
format in '$var'", 'badArgument' );
-               }
-       }
-
-       /**
-        * Check if a token is valid
-        * @param string $var Request parameter that contain a token
-        * @throws ProofreadIndexOaiError
-        * @return array|null the token content
-        */
-       protected function validateToken( $var ) {
-               if ( !isset( $this->request[$var] ) ) {
-                       return null;
-               }
-               $matches = [];
-               if ( preg_match( '/^([a-z_]+):(\d+):(\d+)(?:|:(\d{14}))$/', 
$this->request[$var], $matches ) ) {
-                       $token = [];
-                       $token['metadataPrefix'] = $matches[1];
-                       $token['resume_id'] = isset( $matches[2] ) ? intval( 
$matches[2] ) : null;
-                       $token['cursor'] = isset( $matches[3] ) ? intval( 
$matches[3] ) : null;
-                       $token['until'] = isset( $matches[4] ) ? wfTimestamp( 
TS_MW, $matches[4] ) : null;
-                       $formats = $this->metadataFormats();
-                       if ( isset( $formats[$token['metadataPrefix']] ) ) {
-                               return $token;
-                       }
-               }
-               throw new ProofreadIndexOaiError( 'Invalid resumption token.', 
'badResumptionToken' );
-       }
-
-       /**
-        * Return the max size of a record list
-        * @return int
-        */
-       protected function getChunkSize() {
-               return 50;
-       }
-
-       /**
-        * Output the ListRecords or ListIdentifiers action
-        */
-       protected function listRecords( $verb ) {
-               $withData = ( $verb == 'ListRecords' );
-
-               $category = null;
-               $startToken = $this->validateToken( 'resumptionToken' );
-               if ( $startToken !== null ) {
-                       $metadataPrefix = $startToken['metadataPrefix'];
-                       $from = null;
-                       $until = $startToken['until'];
-               } else {
-                       $metadataPrefix = $this->validateMetadata( 
'metadataPrefix' );
-                       $from = $this->validateDatestamp( 'from', '000000' );
-                       $until = $this->validateDatestamp( 'until', '235959' );
-                       if ( isset( $this->request['set'] ) ) {
-                               $category = 
ProofreadIndexOaiSets::getCategoryForSpec( $this->request['set'] );
-                               if ( $category === null ) {
-                                       throw new ProofreadIndexOaiError( 'No 
records available match the request.', 'noRecordsMatch' );
-                               }
-                       }
-               }
-
-               # Fetch one extra row to check if we need a resumptionToken
-               $chunk = $this->getChunkSize();
-               $resultSet = $this->getIndexRows( $from, $until, $chunk + 1, 
$startToken, $category );
-               $count = min( $resultSet->numRows(), $chunk );
-               if ( !$count ) {
-                       throw new ProofreadIndexOaiError( 'No records available 
match the request.', 'noRecordsMatch' );
-               }
-
-               // buffer everything up
-               $rows = [];
-               for ( $i = 0; $i < $count; $i++ ) {
-                       $row = $resultSet->fetchObject();
-                       $rows[] = $row;
-               }
-               $row = $resultSet->fetchObject();
-               if ( $row ) {
-                       $limit = $until;
-                       if ( $until ) {
-                               $nextToken = $metadataPrefix . ':' . ':' . 
$row->page_id . ':' . ( $startToken['cursor'] + $count ) . $limit;
-                       } else {
-                               $nextToken = $metadataPrefix . ':' . 
$row->page_id . ':' . ( $startToken['cursor'] + $count );
-                       }
-               }
-               $resultSet->free();
-
-               // render
-               echo Xml::openElement( $verb ) . "\n";
-               foreach ( $rows as $row ) {
-                       $title = Title::makeTitleSafe( $row->page_namespace, 
$row->page_title );
-                       if ( $title !== null ) {
-                               $item = new ProofreadIndexOaiRecord( 
ProofreadIndexPage::newFromTitle( $title ), $row->rev_timestamp );
-                               if ( $withData ) {
-                                       echo $item->renderRecord( 
$metadataPrefix );
-                               } else {
-                                       echo $item->renderHeader();
-                               }
-                       }
-               }
-
-               if ( isset( $nextToken ) ) {
-                       $cursor = isset( $startToken['cursor'] ) ? 
$startToken['cursor'] : 0;
-                       echo Xml::element( 'resumptionToken', [ 'cursor' => 
$cursor ], $nextToken ) . "\n";
-               } // TODO Add <resumptionToken completeListSize="6" 
cursor="4"/> 
http://www.openarchives.org/OAI/openarchivesprotocol.html#ListIdentifiers
-               echo Xml::closeElement( $verb ) . "\n";
-       }
-
-       protected function getIndexRows( $from, $until, $chunk, $token = null, 
$category = null ) {
-               $tables = [ 'page', 'revision' ];
-               $fields = [ 'page_namespace', 'page_title', 'page_id', 
'rev_timestamp', 'rev_id' ];
-               $conds = [ 'rev_id = page_latest' ];
-               $conds['page_namespace'] = ProofreadPage::getIndexNamespaceId();
-               $options = [ 'LIMIT' => $chunk, 'ORDER BY' => [ 'page_id ASC' ] 
];
-
-               if ( $token !== null ) {
-                       $conds[] = 'page_id >= ' . $this->db->addQuotes( 
$token['resume_id'] );
-               }
-
-               if ( $from !== null ) {
-                       $conds[] = 'rev_timestamp >= ' . $this->db->addQuotes( 
$from );
-               }
-               if ( $until !== null ) {
-                       $conds[] = 'rev_timestamp <= ' . $this->db->addQuotes( 
$until );
-               }
-
-               if ( $category !== null ) {
-                       $tables[] = 'categorylinks';
-                       $conds['cl_to'] = $category;
-                       $conds[] = 'cl_from = page_id';
-               }
-
-               return $this->db->select( $tables, $fields, $conds, __METHOD__, 
$options );
-       }
-}
diff --git a/includes/index/oai/SpecialProofreadIndexOaiSchema.php 
b/includes/index/oai/SpecialProofreadIndexOaiSchema.php
deleted file mode 100644
index 9249a19..0000000
--- a/includes/index/oai/SpecialProofreadIndexOaiSchema.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * The content of this file use some code from OAIRepo Mediawiki extension.
- *
- * @file
- * @ingroup SpecialPage
- */
-
-/**
- * A special page to return XML schema used by ProofreadPage OAi-PMH API
- */
-class SpecialProofreadIndexOaiSchema extends UnlistedSpecialPage {
-       protected $namespaces = [ 'qdc' ];
-
-       public function __construct() {
-               parent::__construct( 'ProofreadIndexOaiSchema' );
-       }
-
-       public function execute( $namespace ) {
-               $output = $this->getOutput();
-
-               if ( $namespace === '' || !in_array( $namespace, 
$this->namespaces ) ) {
-                       $this->getRequest()->response()->header( 'HTTP/1.1 404 
Not Found' );
-                       $output->showErrorPage( 
'proofreadpage-indexoai-error-schemanotfound', 
'proofreadpage-indexoai-error-schemanotfound-text', [ $namespace ] );
-               } else {
-                       $output->disable();
-                       header( 'Content-type: text/xml; charset=utf-8' );
-                       readfile( __DIR__ . '/schemas/' . $namespace . '.xsd' );
-               }
-       }
-}
diff --git a/includes/index/oai/schemas/qdc.xsd 
b/includes/index/oai/schemas/qdc.xsd
deleted file mode 100644
index 344da6f..0000000
--- a/includes/index/oai/schemas/qdc.xsd
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<schema targetNamespace="http://mediawiki.org/xml/proofreadpage/qdc/";
-       xmlns:prp_qdc="http://mediawiki.org/xml/proofreadpage/qdc/";
-       xmlns:dc="http://purl.org/dc/elements/1.1/";
-       xmlns:dcterms="http://purl.org/dc/terms/";
-       xmlns="http://www.w3.org/2001/XMLSchema";
-       elementFormDefault="qualified" attributeFormDefault="unqualified">
-       <annotation>
-               <documentation>
-                       Adjusted for usage in the OAI-PMH.
-                       Schema imports the Dublin Core elements from the DCMI 
schema for qualified Dublin Core.
-               </documentation>
-       </annotation>
-
-       <import namespace="http://purl.org/dc/terms/"; 
schemaLocation="http://dublincore.org/schemas/xmls/qdc/dcterms.xsd"; />
-
-       <element name="qdc" type="prp_qdc:prp_qdcType" />
-       <complexType name="prp_qdcType">
-               <choice minOccurs="0" maxOccurs="unbounded">
-                       <element ref="dc:title" />
-                       <element ref="dc:creator" />
-                       <element ref="dc:subject" />
-                       <element ref="dc:description" />
-                       <element ref="dc:publisher" />
-                       <element ref="dc:contributor" />
-                       <element ref="dc:date" />
-                       <element ref="dc:type" />
-                       <element ref="dc:format" />
-                       <element ref="dc:identifier" />
-                       <element ref="dc:source" />
-                       <element ref="dc:language" />
-                       <element ref="dc:relation" />
-                       <element ref="dc:coverage" />
-                       <element ref="dc:rights" />
-                       <element ref="dcterms:alternative" />
-                       <element ref="dcterms:tableOfContents" />
-                       <element ref="dcterms:abstract" />
-                       <element ref="dcterms:created" />
-                       <element ref="dcterms:valid" />
-                       <element ref="dcterms:available" />
-                       <element ref="dcterms:issued" />
-                       <element ref="dcterms:modified" />
-                       <element ref="dcterms:dateAccepted" />
-                       <element ref="dcterms:dateCopyrighted" />
-                       <element ref="dcterms:dateSubmitted" />
-                       <element ref="dcterms:extent" />
-                       <element ref="dcterms:medium" />
-                       <element ref="dcterms:isVersionOf" />
-                       <element ref="dcterms:hasVersion" />
-                       <element ref="dcterms:isReplacedBy" />
-                       <element ref="dcterms:replaces" />
-                       <element ref="dcterms:isRequiredBy" />
-                       <element ref="dcterms:requires" />
-                       <element ref="dcterms:isPartOf" />
-                       <element ref="dcterms:hasPart" />
-                       <element ref="dcterms:isReferencedBy" />
-                       <element ref="dcterms:references" />
-                       <element ref="dcterms:isFormatOf" />
-                       <element ref="dcterms:hasFormat" />
-                       <element ref="dcterms:conformsTo" />
-                       <element ref="dcterms:spatial" />
-                       <element ref="dcterms:temporal" />
-                       <element ref="dcterms:audience" />
-                       <element ref="dcterms:accrualMethod" />
-                       <element ref="dcterms:accrualPeriodicity" />
-                       <element ref="dcterms:accrualPolicy" />
-                       <element ref="dcterms:instructionalMethod" />
-                       <element ref="dcterms:provenance" />
-                       <element ref="dcterms:rightsHolder" />
-                       <element ref="dcterms:mediator" />
-                       <element ref="dcterms:educationLevel" />
-                       <element ref="dcterms:accessRights" />
-                       <element ref="dcterms:license" />
-                       <element ref="dcterms:bibliographicCitation" />
-               </choice>
-       </complexType>
-</schema>
-

-- 
To view, visit https://gerrit.wikimedia.org/r/346041
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8ad1a3ac4bda865e3580caf4a2e4bb37499e3a80
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ProofreadPage
Gerrit-Branch: master
Gerrit-Owner: Tpt <[email protected]>
Gerrit-Reviewer: GOIII <[email protected]>
Gerrit-Reviewer: Phe <[email protected]>
Gerrit-Reviewer: Tpt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to