jenkins-bot has submitted this change and it was merged.

Change subject: Convert OAI to use extension registration
......................................................................


Convert OAI to use extension registration

Bug: T87948
Change-Id: Idf58bf8d62228acbb6c6f8f9f2b1d09a9843bb09
---
D OAIRepo.i18n.php
M OAIRepo.php
A extension.json
3 files changed, 75 insertions(+), 131 deletions(-)

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



diff --git a/OAIRepo.i18n.php b/OAIRepo.i18n.php
deleted file mode 100644
index e90cbae..0000000
--- a/OAIRepo.i18n.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * This is a backwards-compatibility shim, generated by:
- * 
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
- *
- * Beginning with MediaWiki 1.23, translation strings are stored in json files,
- * and the EXTENSION.i18n.php file only exists to provide compatibility with
- * older releases of MediaWiki. For more information about this migration, see:
- * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
- *
- * This shim maintains compatibility back to MediaWiki 1.17.
- */
-$messages = array();
-if ( !function_exists( 'wfJsonI18nShimf156fc0acb981ac6' ) ) {
-       function wfJsonI18nShimf156fc0acb981ac6( $cache, $code, &$cachedData ) {
-               $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
-               foreach ( $codeSequence as $csCode ) {
-                       $fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
-                       if ( is_readable( $fileName ) ) {
-                               $data = FormatJson::decode( file_get_contents( 
$fileName ), true );
-                               foreach ( array_keys( $data ) as $key ) {
-                                       if ( $key === '' || $key[0] === '@' ) {
-                                               unset( $data[$key] );
-                                       }
-                               }
-                               $cachedData['messages'] = array_merge( $data, 
$cachedData['messages'] );
-                       }
-
-                       $cachedData['deps'][] = new FileDependency( $fileName );
-               }
-               return true;
-       }
-
-       $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 
'wfJsonI18nShimf156fc0acb981ac6';
-}
diff --git a/OAIRepo.php b/OAIRepo.php
index 20d37d9..865eeb2 100644
--- a/OAIRepo.php
+++ b/OAIRepo.php
@@ -1,99 +1,15 @@
 <?php
 
-/**
- * OAI-PMH repository extension for MediaWiki 1.4+
- *
- * Copyright (C) 2005 Brion Vibber <[email protected]>
- * http://www.mediawiki.org/
- *
- * 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
- *
- * @todo Check update hooks for all actions
- * @todo Make sure identifiers are correct format
- * @todo Configurable bits n pieces
- * @todo Test for conformance & error conditions
- */
-
-if( !defined( 'MEDIAWIKI' ) ) {
-       die();
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'OAIRepo' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['OAIRepo'] = __DIR__ . '/i18n';
+       $wgExtensionMessagesFiles['OAIRepositoryAlias'] = $dir . 
'OAIRepo.alias.php';
+       /*wfWarn(
+               'Deprecated PHP entry point used for OAIRepo extension. Please 
use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );*/
+       return;
+} else {
+       die( 'This version of the OAIRepo extension requires MediaWiki 1.25+' );
 }
-
-/**
- * To limit access to specific user-agents
- */
-$oaiAgentRegex = false;
-
-/**
- * To use HTTP authentication for clients in the oaiuser database
- */
-$oaiAuth = false;
-
-/**
- * Log accesses into the oaiaudit table
- */
-$oaiAudit = false;
-
-/**
- * The oaiaudit and oaiusers tables are used on the connection
- * in load group 'oai', or the primary database if none is set.
- *
- * If the tables are not in the default database for that connection,
- * put it here so the system knows where to find them.
- */
-$oaiAuditDatabase = false;
-
-/**
- * Number of records to return in each ListRecords or ListIdentifiers request.
- * Additional records will be available by making another request using the
- * ResumptionToken returned.
- */
-$oaiChunkSize = 50;
-
-$wgExtensionCredits['specialpage'][] = array(
-       'path'           => __FILE__,
-       'name'           => 'OAIRepository',
-       'author'         => 'Brion Vibber',
-       'url'            => 
'https://www.mediawiki.org/wiki/Extension:OAIRepository',
-       'descriptionmsg' => 'oai-desc',
-       'license-name'   => 'GPL-2.0+',
-);
-
-$dir = __DIR__ . '/';
-$wgMessagesDirs['OAIRepository'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['OAIRepository'] = $dir . 'OAIRepo.i18n.php';
-$wgExtensionMessagesFiles['OAIRepositoryAlias'] = $dir . 'OAIRepo.alias.php';
-$wgAutoloadClasses['SpecialOAIRepository'] = $dir . 'OAIRepo_body.php';
-$wgAutoloadClasses['OAIRepo'] = $dir . 'OAIRepo_body.php';
-$wgAutoloadClasses['OAIRecord'] = $dir . 'OAIRepo_body.php';
-$wgAutoloadClasses['WikiOAIRecord'] = $dir . 'OAIRepo_body.php';
-$wgAutoloadClasses['OAIDumpWriter'] = $dir . 'OAIRepo_body.php';
-$wgAutoloadClasses['OAILSearchWriter'] = $dir . 'OAIRepo_body.php';
-$wgAutoloadClasses['OAIHarvester'] = $dir . 'OAIHarvest.php';
-$wgAutoloadClasses['OAIError'] = $dir . 'OAIHarvest.php';
-$wgAutoloadClasses['OAIUpdateRecord'] = $dir . 'OAIHarvest.php';
-$wgAutoloadClasses['OAIHook'] = $dir . 'OAIHooks.php';
-$wgSpecialPages['OAIRepository'] = 'SpecialOAIRepository';
-
-/* Add update hooks */
-$wgHooks['ArticleSaveComplete'  ][] = 'OAIHook::updateSave';
-$wgHooks['ArticleDelete'        ][] = 'OAIHook::updateDeleteSetup';
-$wgHooks['ArticleDeleteComplete'][] = 'OAIHook::updateDelete';
-$wgHooks['TitleMoveComplete'    ][] = 'OAIHook::updateMove';
-$wgHooks['ParserTestTables'     ][] = 'OAIHook::testTables';
-$wgHooks['ArticleUndelete'      ][] = 'OAIHook::updateUndelete';
-$wgHooks['LoadExtensionSchemaUpdates'][] = 'OAIHook::updateSchemaHook';
-
-$oaiDeleteIds = array();
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..1538425
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,63 @@
+{
+       "name": "OAIRepository",
+       "author": "Brion Vibber",
+       "url": "https://www.mediawiki.org/wiki/Extension:OAIRepository";,
+       "descriptionmsg": "oai-desc",
+       "license-name": "GPL-2.0+",
+       "config": {
+               "_prefix": "oai",
+               "AgentRegex": false,
+               "Auth": false,
+               "Audit": false,
+               "AuditDatabase": false,
+               "ChunkSize": 50,
+               "DeleteIds": []
+       },
+       "Hooks": {
+               "ArticleSaveComplete": [
+                       "OAIHook::updateSave"
+               ],
+               "ArticleDelete": [
+                       "OAIHook::updateDeleteSetup"
+               ],
+               "ArticleDeleteComplete": [
+                       "OAIHook::updateDelete"
+               ],
+               "TitleMoveComplete": [
+                       "OAIHook::updateMove"
+               ],
+               "ParserTestTables": [
+                       "OAIHook::testTables"
+               ],
+               "ArticleUndelete": [
+                       "OAIHook::updateUndelete"
+               ],
+               "LoadExtensionSchemaUpdates": [
+                       "OAIHook::updateSchemaHook"
+               ]
+       },
+       "MessageDirs": {
+               "OAIRepository": [
+                       "i18n"
+               ]
+       },
+       "ExtensionMessagesFiles": {
+               "OAIRepositoryAlias": "OAIRepo.alias.php"
+       },
+       "AutoloadClasses": {
+               "SpecialOAIRepository": "OAIRepo_body.php",
+               "OAIRepo": "OAIRepo_body.php",
+               "OAIRecord": "OAIRepo_body.php",
+               "WikiOAIRecord": "OAIRepo_body.php",
+               "OAIDumpWriter": "OAIRepo_body.php",
+               "OAILSearchWriter": "OAIRepo_body.php",
+               "OAIHarvester": "OAIHarvest.php",
+               "OAIError": "OAIHarvest.php",
+               "OAIUpdateRecord": "OAIHarvest.php",
+               "OAIHook": "OAIHooks.php"
+       },
+       "SpecialPages": {
+               "OAIRepository": "SpecialOAIRepository"
+       },
+       "manifest_version": 1
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idf58bf8d62228acbb6c6f8f9f2b1d09a9843bb09
Gerrit-PatchSet: 14
Gerrit-Project: mediawiki/extensions/OAI
Gerrit-Branch: master
Gerrit-Owner: MtDu <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to