From f6d65e533c62f6deb21342d4901ece24497b433e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 4 Jun 2015 07:31:04 +0200 Subject: Update to MediaWiki 1.25.1 --- extensions/Interwiki/Interwiki.php | 136 ++++--------------------------------- 1 file changed, 12 insertions(+), 124 deletions(-) (limited to 'extensions/Interwiki/Interwiki.php') diff --git a/extensions/Interwiki/Interwiki.php b/extensions/Interwiki/Interwiki.php index 2c5d76c7..73341819 100644 --- a/extensions/Interwiki/Interwiki.php +++ b/extensions/Interwiki/Interwiki.php @@ -1,127 +1,15 @@ - * @author Robin Pepermans (SPQRobin) - * @author Jack Phoenix - * @author Calimonius the Estrange - * @copyright Copyright © 2005-2007 Stephanie Amanda Stevens - * @copyright Copyright © 2007-2011 Robin Pepermans (SPQRobin) - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later - * @link http://www.mediawiki.org/wiki/Extension:SpecialInterwiki Documentation - * Formatting improvements Stephen Kennedy, 2006. - */ -if ( !defined( 'MEDIAWIKI' ) ) { - die( "This is not a valid entry point.\n" ); -} - -// Set this value to true in LocalSettings.php if you will not use this -// extension to actually change any interwiki table entries. It will suppress -// the addition of a log for interwiki link changes. -$wgInterwikiViewOnly = false; - -// Name of a database where global interwikis will be stored. -$wgInterwikiCentralDB = null; - -// Extension credits for Special:Version -$wgExtensionCredits['specialpage'][] = array( - 'path' => __FILE__, - 'name' => 'Interwiki', - 'author' => array( - 'Stephanie Amanda Stevens', - 'Alexandre Emsenhuber', - 'Robin Pepermans', - 'Siebrand Mazeland', - 'Platonides', - 'Raimond Spekking', - 'Sam Reed', - 'Jack Phoenix', - 'Calimonius the Estrange', - '...' - ), - 'version' => '3.0 20140719', - 'url' => 'https://www.mediawiki.org/wiki/Extension:Interwiki', - 'descriptionmsg' => 'interwiki-desc', -); - -$wgExtensionFunctions[] = 'setupInterwikiExtension'; - -$wgResourceModules['ext.interwiki.specialpage'] = array( - 'styles' => 'Interwiki.css', - 'localBasePath' => dirname( __FILE__ ), - 'remoteExtPath' => 'Interwiki', - 'dependencies' => array( - 'jquery.makeCollapsible', - ), -); - -// Set up the new special page -$dir = dirname( __FILE__ ) . '/'; -$wgMessagesDirs['Interwiki'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles['Interwiki'] = $dir . 'Interwiki.i18n.php'; -$wgExtensionMessagesFiles['InterwikiAlias'] = $dir . 'Interwiki.alias.php'; -$wgAutoloadClasses['SpecialInterwiki'] = $dir . 'Interwiki_body.php'; -$wgAutoloadClasses['InterwikiLogFormatter'] = $dir . 'Interwiki_body.php'; -$wgSpecialPages['Interwiki'] = 'SpecialInterwiki'; -$wgSpecialPageGroups['Interwiki'] = 'wiki'; - -$wgHooks['InterwikiLoadPrefix'][] = 'wfGlobalInterwikis'; - - -function setupInterwikiExtension() { - global $wgInterwikiViewOnly; - - if ( $wgInterwikiViewOnly === false ) { - global $wgAvailableRights, $wgLogTypes, $wgLogActionsHandlers; - - // New user right, required to modify the interwiki table through Special:Interwiki - $wgAvailableRights[] = 'interwiki'; - - // Set up the new log type - interwiki actions are logged to this new log - $wgLogTypes[] = 'interwiki'; - // interwiki, iw_add, iw_delete, iw_edit - $wgLogActionsHandlers['interwiki/*'] = 'InterwikiLogFormatter'; - } - - return true; -} - -function wfGlobalInterwikis( $prefix, &$iwData ) { - global $wgInterwikiCentralDB; - // docs/hooks.txt says: Return true without providing an interwiki to continue interwiki search. - if ( $wgInterwikiCentralDB === null || $wgInterwikiCentralDB === wfWikiId() ) { - // No global set or this is global, nothing to add - return true; - } - if ( !Language::fetchLanguageName( $prefix ) ) { - // Check if prefix exists locally and skip - foreach ( Interwiki::getAllPrefixes( null ) as $id => $localPrefixInfo ) { - if ( $prefix === $localPrefixInfo['iw_prefix'] ) { - return true; - } - } - $dbr = wfGetDB( DB_SLAVE, array(), $wgInterwikiCentralDB ); - $res = $dbr->selectRow( - 'interwiki', - '*', - array( 'iw_prefix' => $prefix ), - __METHOD__ - ); - if ( !$res ) { - return true; - } - // Excplicitly make this an array since it's expected to be one - $iwData = (array)$res; - // At this point, we can safely return false because we know that we have something - return false; - } - return true; +if ( function_exists( 'wfLoadExtension' ) ) { + wfLoadExtension( 'Interwiki' ); + // Keep i18n globals so mergeMessageFileList.php doesn't break + $wgMessagesDirs['Interwiki'] = __DIR__ . '/i18n'; + $wgExtensionMessagesFiles['InterwikiAlias'] = __DIR__ . '/Interwiki.alias.php'; + /* wfWarn( + 'Deprecated PHP entry point used for Interwiki extension. Please use wfLoadExtension instead, ' . + 'see https://www.mediawiki.org/wiki/Extension_registration for more details.' + ); */ + return; +} else { + die( 'This version of the Interwiki extension requires MediaWiki 1.25+' ); } -- cgit v1.2.2