Reedy has uploaded a new change for review. https://gerrit.wikimedia.org/r/315864
Change subject: Revert "Convert ZeroPortal to extension registration" ...................................................................... Revert "Convert ZeroPortal to extension registration" This reverts commit d1ea1c7d50545d52ef80c75d3c13b49c339aeeda. Change-Id: I7f63c9542590b957e0202fa536d0eb57a60251d0 --- A ZeroPortal.i18n.php M ZeroPortal.php D extension.json M includes/ConfigPageHooks.php M includes/ZeroConfigView.php 5 files changed, 110 insertions(+), 99 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ZeroPortal refs/changes/64/315864/1 diff --git a/ZeroPortal.i18n.php b/ZeroPortal.i18n.php new file mode 100644 index 0000000..9b40e78 --- /dev/null +++ b/ZeroPortal.i18n.php @@ -0,0 +1,35 @@ +<?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( 'wfJsonI28nShim525f69e04aead689' ) ) { + function wfJsonI28nShim525f69e04aead689( $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'][] = 'wfJsonI28nShim525f69e04aead689'; +} diff --git a/ZeroPortal.php b/ZeroPortal.php index ef35ba9..4dd8566 100644 --- a/ZeroPortal.php +++ b/ZeroPortal.php @@ -1,16 +1,75 @@ <?php +/** + * Extension ZeroRatedMobileAccess — Zero Rated Mobile Access. + * + * Require the ZeroBanner extension. + * + * @file + * @ingroup Extensions + * @author Patrick Reilly + * @author Yuri Astrakhan + * @copyright © 2011 Patrick Reilly, 2013 Yuri Astrakhan + * @licence GNU General Public Licence 2.0 or later + */ -if ( function_exists( 'wfLoadExtension' ) ) { - wfLoadExtension( 'ZeroPortal' ); - // Keep i18n globals so mergeMessageFileList.php doesn't break - $wgMessagesDirs['ZeroPortal'] = __DIR__ . '/i18n'; - $wgExtensionMessagesFiles['ZeroPortalAlias'] = __DIR__ . '/ZeroPortal.alias.php'; - /*wfWarn( - 'Deprecated PHP entry point used for ZeroPortal extension. ' . - 'Please use wfLoadExtension instead, ' . - 'see https://www.mediawiki.org/wiki/Extension_registration for more details.' - );*/ - return; -} else { - die( 'This version of the ZeroPortal extension requires MediaWiki 1.28+' ); +// Needs to be called within MediaWiki; not standalone +if ( !defined( 'MEDIAWIKI' ) ) { + echo( "This is a MediaWiki extension and cannot run standalone.\n" ); + die( -1 ); } + +// Extension credits that will show up on Special:Version +$wgExtensionCredits['other'][] = array( + 'path' => __FILE__, + 'name' => 'ZeroPortal', + 'version' => '1.0.0', + 'author' => array( 'Yuri Astrakhan' ), + 'descriptionmsg' => 'zeroportal-desc', + 'url' => 'https://www.mediawiki.org/wiki/Extension:ZeroPortal', + 'license-name' => 'GPL-2.0+', +); + +$wgMessagesDirs['ZeroPortal'] = __DIR__ . '/i18n'; +$wgExtensionMessagesFiles['ZeroPortal'] = __DIR__ . '/ZeroPortal.i18n.php'; + +$wgAutoloadClasses['ZeroPortal\\ApiZeroPortal'] = __DIR__ . '/includes/ApiZeroPortal.php'; +$wgAutoloadClasses['ZeroPortal\\ConfigPageHooks'] = __DIR__ . '/includes/ConfigPageHooks.php'; +$wgAutoloadClasses['ZeroPortal\\LuaLibrary'] = __DIR__ . '/includes/LuaLibrary.php'; +$wgAutoloadClasses['ZeroPortal\\PortalSpecialPage'] = __DIR__ . '/includes/PortalSpecialPage.php'; +$wgAutoloadClasses['ZeroPortal\\ConfigMerger'] = __DIR__ . '/includes/ConfigMerger.php'; +$wgAutoloadClasses['ZeroPortal\\ZeroConfigView'] = __DIR__ . '/includes/ZeroConfigView.php'; + +$wgResourceModules['zeroportal.config'] = array( + 'dependencies' => 'zerobanner.config.styles', // defined in ZeroBanner ext, used for sample banners + 'localBasePath' => __DIR__, + 'remoteExtPath' => 'ZeroPortal', + 'styles' => array( 'modules/zero.config.css' ), + 'position' => 'top', +); + +$wgResourceModules['zeroportal.portalstyles'] = array( + 'localBasePath' => __DIR__, + 'remoteExtPath' => 'ZeroPortal', + 'styles' => array( 'modules/zero.resets.less', 'modules/zero.content.less' ), + 'position' => 'top', +); + +$wgAPIModules['zeroportal'] = 'ZeroPortal\ApiZeroPortal'; +$wgHooks['BeforePageDisplay'][] = 'ZeroPortal\ConfigPageHooks::onBeforePageDisplay'; +$wgHooks['ScribuntoExternalLibraries'][] = 'ZeroPortal\LuaLibrary::onScribuntoExternalLibraries'; + +// Set our own view class for the JsonZeroConfig model, and configure local storage +$wgJsonConfigModels['JsonZeroConfig']['view'] = 'ZeroPortal\ZeroConfigView'; +$wgJsonConfigs['JsonZeroConfig']['store'] = true; + +$wgSpecialPages['ZeroPortal'] = 'ZeroPortal\PortalSpecialPage'; +$wgExtensionMessagesFiles['ZeroPortalAlias'] = __DIR__ . DIRECTORY_SEPARATOR . 'ZeroPortal.alias.php'; + +$wgZeroPortalImpersonateUser = false; + +$wgExtensionFunctions[] = function( ) { + if ( !defined( 'NS_ZERO' ) ) { + echo( "ZeroBanner extension has not been added\n" ); + die( -1 ); + } +}; diff --git a/extension.json b/extension.json deleted file mode 100644 index 58e0812..0000000 --- a/extension.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "ZeroPortal", - "version": "1.1.0", - "author": [ - "Yuri Astrakhan" - ], - "url": "https://www.mediawiki.org/wiki/Extension:ZeroPortal", - "descriptionmsg": "zeroportal-desc", - "license-name": "GPL-2.0+", - "type": "other", - "ExtensionFunctions": [ - "ZeroPortal\\ConfigPageHooks::onExtensionFunctions" - ], - "SpecialPages": { - "ZeroPortal": "ZeroPortal\\PortalSpecialPage" - }, - "APIModules": { - "zeroportal": "ZeroPortal\\ApiZeroPortal" - }, - "MessagesDirs": { - "ZeroPortal": [ - "i18n" - ] - }, - "ExtensionMessagesFiles": { - "ZeroPortalAlias": "ZeroPortal.alias.php" - }, - "AutoloadClasses": { - "ZeroPortal\\ApiZeroPortal": "includes/ApiZeroPortal.php", - "ZeroPortal\\ConfigPageHooks": "includes/ConfigPageHooks.php", - "ZeroPortal\\LuaLibrary": "includes/LuaLibrary.php", - "ZeroPortal\\PortalSpecialPage": "includes/PortalSpecialPage.php", - "ZeroPortal\\ConfigMerger": "includes/ConfigMerger.php", - "ZeroPortal\\ZeroConfigView": "includes/ZeroConfigView.php" - }, - "ResourceModules": { - "zeroportal.config": { - "dependencies": "zerobanner.config.styles", - "styles": [ - "modules/zero.config.css" - ], - "position": "top" - }, - "zeroportal.portalstyles": { - "styles": [ - "modules/zero.resets.less", - "modules/zero.content.less" - ], - "position": "top" - } - }, - "ResourceFileModulePaths": { - "localBasePath": "", - "remoteExtPath": "ZeroPortal" - }, - "Hooks": { - "BeforePageDisplay": "ZeroPortal\\ConfigPageHooks::onBeforePageDisplay", - "ScribuntoExternalLibraries": "ZeroPortal\\LuaLibrary::onScribuntoExternalLibraries" - }, - "JsonConfigModels": { - "JsonZeroConfig": { - "view": "ZeroPortal\\ZeroConfigView" - } - }, - "JsonConfigs": { - "JsonZeroConfig": { - "store": true - } - }, - "config": { - "ZeroPortalImpersonateUser": { - "value": false - } - }, - "manifest_version": 2 -} diff --git a/includes/ConfigPageHooks.php b/includes/ConfigPageHooks.php index 5e470cf..b2eac1e 100644 --- a/includes/ConfigPageHooks.php +++ b/includes/ConfigPageHooks.php @@ -6,7 +6,7 @@ use TitleValue; /** - * Configuration page hook handlers for ZeroPortal extension. + * Configuration page hook handlers for ZeroRatedMobileAccess extension. * * @file * @ingroup Extensions @@ -34,7 +34,7 @@ * * @return bool */ - public static function onBeforePageDisplay( + static function onBeforePageDisplay( &$out, /** @noinspection PhpUnusedParameterInspection */ &$skin @@ -48,13 +48,6 @@ } return true; - } - - public static function onExtensionFunctions() { - if ( !defined( 'NS_ZERO' ) ) { - echo( "ZeroBanner extension has not been added\n" ); - die( -1 ); - } } } diff --git a/includes/ZeroConfigView.php b/includes/ZeroConfigView.php index 9a9ee71..99da118 100644 --- a/includes/ZeroConfigView.php +++ b/includes/ZeroConfigView.php @@ -18,7 +18,7 @@ * Represents the content of a JSON Zero Config article. * @file * @ingroup Extensions - * @ingroup ZeroPortal + * @ingroup ZeroRatedMobileAccess * * @author Yuri Astrakhan <yu...@wikimedia.org>, based on Ori Livneh <o...@wikimedia.org> schema * extension -- To view, visit https://gerrit.wikimedia.org/r/315864 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7f63c9542590b957e0202fa536d0eb57a60251d0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ZeroPortal Gerrit-Branch: master Gerrit-Owner: Reedy <re...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits