MarcoAurelio has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/405804 )
Change subject: Convert CategoryTagSorter to use extension registration
......................................................................
Convert CategoryTagSorter to use extension registration
Bug: T185528
Change-Id: I091ab3690adb2978a6f56b19ae5ca2af2eb94a74
---
R COPYING
M CategoryTagSorter.php
A extension.json
R tests/phpunit/CategoryTagSorterTest.php
4 files changed, 38 insertions(+), 65 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CategoryTagSorter
refs/changes/04/405804/1
diff --git a/LICENSE b/COPYING
similarity index 100%
rename from LICENSE
rename to COPYING
diff --git a/CategoryTagSorter.php b/CategoryTagSorter.php
index 9ab9e07..5de0954 100644
--- a/CategoryTagSorter.php
+++ b/CategoryTagSorter.php
@@ -2,15 +2,13 @@
/**
* CategoryTagSorter - Sort the category tags on every article page.
*
- *
* @file
* @ingroup Extensions
*
* @author Dan Barrett
* @author Daniel Renfro
*
- *
- * Copyright 2013 Vistaprint Schweiz GmbH.
+ * Copyright (C) 2013 Vistaprint Schweiz GmbH.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,66 +22,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
-
-/**
- * This is not a valid point of entry.
- *
- */
-if ( !defined( 'MEDIAWIKI' ) ) {
- echo <<< EOT
- To install my extension, put the following line in
Localsettings.php:
- require_once(
"\$IP/extensions/CategoryTagSorter/CategoryTagSorter.php" );
-EOT;
- exit( 1 );
+if ( function_exists( 'wfLoadExtension' ) ) {
+ wfLoadExtension( 'CategoryTagSorter' );
+ // Keep i18n globals so mergeMessageFileList.php doesn't break
+ $wgMessagesDirs['CategoryTagSorter'] = __DIR__ . '/i18n';
+ wfWarn(
+ 'Deprecated PHP entry point used for the CategoryTagSorter
extension. ' .
+ 'Please use wfLoadExtension instead, ' .
+ 'see https://www.mediawiki.org/wiki/Extension_registration for
more details.'
+ );
+ return;
+} else {
+ die( 'This version of the CategoryTagSorter extension requires
MediaWiki 1.29+' );
}
-
-/**
- * Credits
- *
- */
-$wgExtensionCredits['other'][] = array(
- 'name' => 'CategoryTagSorter',
- 'author' => array(
- '[https://www.mediawiki.org/wiki/User:Maiden_taiwan Dan
Barrett]',
- '[https://www.mediawiki.org/wiki/User:AlephNull Daniel Renfro]',
- ),
- 'url' => 'https://www.mediawiki.org/wiki/Extension:CategoryTagSorter',
- 'descriptionmsg' => 'categorytagsorter-desc',
- 'version' => '0.3.0',
-);
-
-/**
- * The body of the extension.
- *
- */
-$wgAutoloadClasses['CategoryTagSorter'] = __DIR__ .
'/CategoryTagSorter_body.php';
-
-
-/**
- * Internationalization/localization
- *
- */
-$wgMessagesDirs['CategoryTagSorter'] = __DIR__ . '/i18n';
-
-
-
-/**
- * Hooks
- *
- */
-$wgHooks['ParserBeforeTidy'][] = 'CategoryTagSorter::sort';
-$wgHooks['GetPreferences'][] = 'CategoryTagSorter::prefs';
-$wgHooks['UnitTestsList'][] = 'wfCategoryTagSorterUnitTests';
-
-
-
-/**
- * Add our unit-tests to the list
- *
- */
-function wfCategoryTagSorterUnitTests( array &$files ) {
- $files[] = dirname( __FILE__ ) . '/tests/CategoryTagSorterTest.php';
- return true;
-} ;
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..38511dc
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,25 @@
+{
+ "name": "CategoryTagSorter",
+ "version": "0.3.0",
+ "author": [
+ "[https://www.mediawiki.org/wiki/User:Maiden_taiwan Dan
Barrett]",
+ "[https://www.mediawiki.org/wiki/User:AlephNull Daniel Renfro]"
+ ],
+ "url": "https://www.mediawiki.org/wiki/Extension:CategoryTagSorter",
+ "descriptionmsg": "categorytagsorter-desc",
+ "type": "other",
+ "MessagesDirs": {
+ "CategoryTagSorter": [
+ "i18n"
+ ]
+ },
+ "AutoloadClasses": {
+ "CategoryTagSorter": "CategoryTagSorter_body.php"
+ },
+ "Hooks": {
+ "ParserBeforeTidy": "CategoryTagSorter::sort",
+ "GetPreferences": "CategoryTagSorter::prefs",
+ "UnitTestsList": "wfCategoryTagSorterUnitTests"
+ },
+ "manifest_version": 2
+}
diff --git a/tests/CategoryTagSorterTest.php
b/tests/phpunit/CategoryTagSorterTest.php
similarity index 100%
rename from tests/CategoryTagSorterTest.php
rename to tests/phpunit/CategoryTagSorterTest.php
--
To view, visit https://gerrit.wikimedia.org/r/405804
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I091ab3690adb2978a6f56b19ae5ca2af2eb94a74
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CategoryTagSorter
Gerrit-Branch: master
Gerrit-Owner: MarcoAurelio <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits