Jayprakash12345 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405701 )

Change subject: Convert CategorySortHeaders to use extension reg
......................................................................

Convert CategorySortHeaders to use extension reg

Bug: T185488
Change-Id: Ic889f14ada27c6953e0a3110cae97e64c97eb101
---
M CategorySortHeaders.php
M CategorySortHeaders_body.php
A extension.json
3 files changed, 51 insertions(+), 31 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CategorySortHeaders 
refs/changes/01/405701/1

diff --git a/CategorySortHeaders.php b/CategorySortHeaders.php
index 7b1e73e..a556e7c 100644
--- a/CategorySortHeaders.php
+++ b/CategorySortHeaders.php
@@ -41,34 +41,16 @@
  * @author Brian Wolff
  */
 
-
-$wgExtensionCredits['other'][] = array(
-        'path' => __FILE__,
-        'name' => 'CategorySortHeaders',
-        'author' => '[http://mediawiki.org/wiki/User:Bawolff Brian Wolff]',
-        'descriptionmsg' => 'categorysortheaders-desc',
-        'url' => 
'https://www.mediawiki.org/wiki/Extension:CategorySortHeaders',
-        'version' => '0.3.0',
-);
-
-$dir = dirname( __FILE__ ) . '/';
-$wgMessagesDirs['CategorySortHeaders'] = __DIR__ . '/i18n';
-$wgAutoloadClasses['CustomHeaderCollation'] = $dir . 
'CategorySortHeaders_body.php';
-
-$wgCategoryCollation = 'CustomHeaderCollation';
-
-// Control if a sortkey of ^foo^ is considered just ^foo^ or ^foo^{{PAGENAME}}.
-// After changing this option, you should run the maintinance script (the 
--force is important)
-// php updateCollations.php --force
-
-$wgCategorySortHeaderAppendPageNameToKey = true;
-
-$wgHooks['Collation::factory'][] = 'wfCategorySortHeadersSetup';
-
-function wfCategorySortHeadersSetup( $collationName, &$collationObject ) {
-       if ( $collationName === 'CustomHeaderCollation' ) {
-               $collationObject = new CustomHeaderCollation;
-               return false;
-       }
-       return true;
-}
+ if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'CategorySortHeaders' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['CategorySortHeaders'] = __DIR__ . '/i18n';
+       wfWarn(
+               'Deprecated PHP entry point used for the CategorySortHeaders 
extension. ' .
+               'Please use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );
+       return;
+} else {
+       die( 'This version of the CategorySortHeaders extension requires 
MediaWiki 1.29+' );
+}
\ No newline at end of file
diff --git a/CategorySortHeaders_body.php b/CategorySortHeaders_body.php
index 89b8c06..d465342 100644
--- a/CategorySortHeaders_body.php
+++ b/CategorySortHeaders_body.php
@@ -8,6 +8,15 @@
  * custom 'first-character' headings for category pages.
  */
 class CustomHeaderCollation extends Collation {
+       
+       // Global Function
+       function wfCategorySortHeadersSetup( $collationName, &$collationObject 
) {
+       if ( $collationName === 'CustomHeaderCollation' ) {
+               $collationObject = new CustomHeaderCollation;
+               return false;
+                  }
+       return true;
+    }
 
        // The basic idea is we store the sortkey as three parts A^B^C
        // A is the capitalized first letter of the header it falls under.
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..b377f90
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,29 @@
+{
+       "name": "CategorySortHeaders",
+       "version": "0.3.0",
+       "author": "[http://mediawiki.org/wiki/User:Bawolff Brian Wolff]",
+       "url": "https://www.mediawiki.org/wiki/Extension:CategorySortHeaders";,
+       "descriptionmsg": "categorysortheaders-desc",
+       "license-name": "GPL-2.0-or-later",
+       "type": "other",
+       "MessagesDirs": {
+               "CategorySortHeaders": [
+                       "i18n"
+               ]
+       },
+       "AutoloadClasses": {
+               "CustomHeaderCollation": "CategorySortHeaders_body.php"
+       },
+       "Hooks": {
+               "Collation::factory": "wfCategorySortHeadersSetup"
+       },
+       "config": {
+               "CategoryCollation": {
+                       "value": "CustomHeaderCollation"
+               },
+               "CategorySortHeaderAppendPageNameToKey": {
+                       "value": true
+               }
+       },
+       "manifest_version": 2
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/405701
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic889f14ada27c6953e0a3110cae97e64c97eb101
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CategorySortHeaders
Gerrit-Branch: master
Gerrit-Owner: Jayprakash12345 <0freerunn...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to