MtDu has uploaded a new change for review.
https://gerrit.wikimedia.org/r/261172
Change subject: Convert OAI to use extension registration
......................................................................
Convert OAI to use extension registration
Bug: T87948
Change-Id: Idf58bf8d62228acbb6c6f8f9f2b1d09a9843bb09
---
M OAI.php
D OAIRepo.i18n.php
D OAIRepo.php
A extension.json
4 files changed, 71 insertions(+), 135 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAI
refs/changes/72/261172/1
diff --git a/OAI.php b/OAI.php
index 7cb12a3..944d0e2 100644
--- a/OAI.php
+++ b/OAI.php
@@ -1,3 +1,14 @@
<?php
-require_once( __DIR__ . '/OAIRepo.php' );
+if ( function_exists( 'wfLoadExtension' ) ) {
+ wfLoadExtension( 'OAIRepository' );
+ // Keep i18n globals so mergeMessageFileList.php doesn't break
+ $wgMessagesDirs['OAIRepository'] = __DIR__ . '/i18n';
+ /*wfWarn(
+ 'Deprecated PHP entry point used for FooBar extension. Please
use wfLoadExtension instead, ' .
+ 'see https://www.mediawiki.org/wiki/Extension_registration for
more details.'
+ );*/
+ return;
+} else {
+ die( 'This version of the OAIRepository extension requires MediaWiki
1.25+' );
+}
\ No newline at end of file
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
deleted file mode 100644
index 20d37d9..0000000
--- a/OAIRepo.php
+++ /dev/null
@@ -1,99 +0,0 @@
-<?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();
-}
-
-/**
- * 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..24b7f59
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,59 @@
+{
+ "name": "OAIRepository",
+ "author": "Brion Vibber",
+ "url": "https://www.mediawiki.org/wiki/Extension:OAIRepository",
+ "descriptionmsg": "oai-desc",
+ "license-name": "GPL-2.0+",
+ "oaiAgentRegex": false,
+ "oaiAuth": false,
+ "oaiAudit": false,
+ "oaiAuditDatabase": false,
+ "oaiChunkSize": 50,
+ "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": {
+ "OAIRepository": "OAIRepo.i18n.php",
+ "OAIRepositoryAlias": "OAIRepo.alias.php"
+ },
+ "AutoloadClasses": {
+ "SpecialOAIRepository": "OAIRepo_body.php",
+ "OAIRepo": "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"
+ },
+ "oaiDeleteIds": []
+}
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/261172
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf58bf8d62228acbb6c6f8f9f2b1d09a9843bb09
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAI
Gerrit-Branch: master
Gerrit-Owner: MtDu <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits