[MediaWiki-commits] [Gerrit] mediawiki...Awesomeness[master]: Do some maintenance
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/370618 ) Change subject: Do some maintenance .. Do some maintenance * Remove I18n php shim * Provide entry point security * Provide license label * Extend author's array * Improve file documentation * Bump version Note: This is breaking for MW 1.22.x and lower. Bug:T123943 Bug:T168353 Change-Id: I4ebb5685efa0c26cb714f89c728696d9ec9f4f3d --- D Awesomeness.i18n.php M Awesomeness.php M INSTALL 3 files changed, 23 insertions(+), 47 deletions(-) Approvals: Umherirrender: Looks good to me, approved jenkins-bot: Verified diff --git a/Awesomeness.i18n.php b/Awesomeness.i18n.php deleted file mode 100644 index ede944d..000 --- a/Awesomeness.i18n.php +++ /dev/null @@ -1,35 +0,0 @@ -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( 'wfJsonI18nShim1b2b6a378e417dee' ) ) { - function wfJsonI18nShim1b2b6a378e417dee( $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'][] = 'wfJsonI18nShim1b2b6a378e417dee'; -} diff --git a/Awesomeness.php b/Awesomeness.php index 5176dd6..b05b697 100644 --- a/Awesomeness.php +++ b/Awesomeness.php @@ -2,14 +2,15 @@ /** * Initialization file for the Awesomeness extension. * - * Documentation: http://www.mediawiki.org/wiki/Extension:Awesomeness - * Support http://www.mediawiki.org/wiki/Extension_talk:Awesomeness - * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Awesomeness + * Documentation: https://www.mediawiki.org/wiki/Extension:Awesomeness + * Support https://www.mediawiki.org/wiki/Extension_talk:Awesomeness + * Source code: https://phabricator.wikimedia.org/diffusion/EAWE/ * * @file Awesomeness.php * @ingroup Awesomeness + * @package MediaWiki * - * @licence GNU GPL v2+ + * @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License 2.0 or later * * @author Jeroen De Dauw < jeroended...@gmail.com > */ @@ -20,20 +21,32 @@ * @defgroup Awesomeness Awesomeness */ -define( 'Awesomeness_VERSION', 'awesomeness = infinity+2' ); +// Ensure that the script cannot be executed outside of MediaWiki. +if ( !defined( 'MEDIAWIKI' ) ) { + die( 'This is an extension to MediaWiki and cannot be run standalone.' ); +} +// Define extension's version. +define( 'Awesomeness_VERSION', 'awesomeness = infinity+3' ); + +// Display extension properties on MediaWiki. $wgExtensionCredits['other'][] = array( 'path' => __FILE__, 'name' => 'Awesomeness', 'version' => Awesomeness_VERSION, - 'author' => array( '[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]' ), + 'author' => array( + '[https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]', + '...' + ), 'url' => 'https://www.mediawiki.org/wiki/Extension:Awesomeness', 'descriptionmsg' => 'awesomeness-desc', + 'license-label' => 'GPL-2.0+' ); +// Register extension messages and other localisation. $wgMessagesDirs['Awesomeness'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles['Awesomeness'] = dirname( __FILE__ ) . '/Awesomeness.i18n.php'; +// And action. $wgHooks['PageContentSave'][] = function ( &$wikiPage, &$user, &$content, &$summary, $isMinor, $isWatch, $section, &$flags, &$status ) { $awesomeness = array( 'awesomeness', 'awesome' ); diff --git
[MediaWiki-commits] [Gerrit] mediawiki...Awesomeness[master]: Do some maintenance
Kghbln has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/370618 ) Change subject: Do some maintenance .. Do some maintenance * Remove I18n php shim * Provide license label * Extend author's array * Switch to consistently use __DIR__ * Bump version Note: This is breaking for MW 1.22.x and lower. Bug:T123943 Bug:T168353 Change-Id: I4ebb5685efa0c26cb714f89c728696d9ec9f4f3d --- D Awesomeness.i18n.php M Awesomeness.php M INSTALL 3 files changed, 13 insertions(+), 46 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Awesomeness refs/changes/18/370618/1 diff --git a/Awesomeness.i18n.php b/Awesomeness.i18n.php deleted file mode 100644 index ede944d..000 --- a/Awesomeness.i18n.php +++ /dev/null @@ -1,35 +0,0 @@ -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( 'wfJsonI18nShim1b2b6a378e417dee' ) ) { - function wfJsonI18nShim1b2b6a378e417dee( $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'][] = 'wfJsonI18nShim1b2b6a378e417dee'; -} diff --git a/Awesomeness.php b/Awesomeness.php index 5176dd6..4bda83e 100644 --- a/Awesomeness.php +++ b/Awesomeness.php @@ -2,9 +2,9 @@ /** * Initialization file for the Awesomeness extension. * - * Documentation: http://www.mediawiki.org/wiki/Extension:Awesomeness - * Support http://www.mediawiki.org/wiki/Extension_talk:Awesomeness - * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Awesomeness + * Documentation: https://www.mediawiki.org/wiki/Extension:Awesomeness + * Support https://www.mediawiki.org/wiki/Extension_talk:Awesomeness + * Source code: https://phabricator.wikimedia.org/diffusion/EAWE/ * * @file Awesomeness.php * @ingroup Awesomeness @@ -20,19 +20,23 @@ * @defgroup Awesomeness Awesomeness */ -define( 'Awesomeness_VERSION', 'awesomeness = infinity+2' ); +define( 'Awesomeness_VERSION', 'awesomeness = infinity+3' ); $wgExtensionCredits['other'][] = array( 'path' => __FILE__, 'name' => 'Awesomeness', 'version' => Awesomeness_VERSION, - 'author' => array( '[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]' ), + 'author' => array( + '[https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]', + '...' + ), 'url' => 'https://www.mediawiki.org/wiki/Extension:Awesomeness', 'descriptionmsg' => 'awesomeness-desc', + 'license-label' => 'GPL-2.0+' ); $wgMessagesDirs['Awesomeness'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles['Awesomeness'] = dirname( __FILE__ ) . '/Awesomeness.i18n.php'; +$wgExtensionMessagesFiles['Awesomeness'] = __DIR__ . '/Awesomeness.i18n.php'; $wgHooks['PageContentSave'][] = function ( &$wikiPage, &$user, &$content, &$summary, $isMinor, $isWatch, $section, &$flags, &$status ) { diff --git a/INSTALL b/INSTALL index fcee31e..e33e030 100644 --- a/INSTALL +++ b/INSTALL @@ -1,8 +1,6 @@ These is the install file for the Awesomeness extension. Extension page on mediawiki.org: https://www.mediawiki.org/wiki/Extension:Awesomeness -Latest version of the install file: https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/Awesomeness.git;a=blob;f=INSTALL - == Installation == @@ -10,7 +8,7 @@ Then add the following code to your [[Manual:LocalSettings.php|LocalSettings.php]] file: # Awesomeness -require_once(