jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/403950 )

Change subject: Convert ArticleIndex to use extension registration
......................................................................


Convert ArticleIndex to use extension registration

- Converts ArticleIndex to use extension registration.
- Version number in extension.json bumped to 0.5.0.

Change-Id: Ifca5caaa9810c92fceb218458ab6418b57d81f2c
---
M ArticleIndex.php
A extension.json
2 files changed, 58 insertions(+), 36 deletions(-)

Approvals:
  Jossmart: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/ArticleIndex.php b/ArticleIndex.php
index be62966..a8ec1ac 100644
--- a/ArticleIndex.php
+++ b/ArticleIndex.php
@@ -1,42 +1,24 @@
 <?php
 /**
  * Extension displays index of words in an article.
- * Add tag <aindex></aindex>.
- * Words in these tags are displayed instead of tag <articleindex/> in 
alphabet order
- * grouped by first letters.
+ *
+ * Add tag <aindex></aindex>. Words in these tags are displayed
+ * instead of tag <articleindex/> in alphabet order grouped by first letters.
+ *
  * Clicking the word highlights his occurrences and moves page to the first one
- * Navigation buttons on mouseover
+ * Navigation buttons on mouseover.
+ *
  */
-
-if ( !defined( 'MEDIAWIKI' ) ) {
-echo <<<EOT
-       To install my extension, put the following line in LocalSettings.php:
-       require_once( "\$IP/extensions/ArticleIndex/ArticleIndex.php");
-EOT;
-exit( 1 );
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'ArticleIndex' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['ArticleIndex'] = __DIR__ . '/i18n';
+       wfWarn(
+               'Deprecated PHP entry point used for the ArticleIndex 
extension. ' .
+               'Please use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );
+       return;
+} else {
+       die( 'This version of the ArticleIndex extension requires MediaWiki 
1.29+' );
 }
-
-$wgExtensionCredits['specialpage'][] = array(
-       'name' => 'ArticleIndex',
-       'author' => 'Josef Martiňák',
-       'url' => 'https://www.mediawiki.org/wiki/Extension:ArticleIndex',
-       'descriptionmsg' => 'articleindex-desc',
-       'version' => '0.4.0'
-);
-
-# Register a module
-$wgResourceModules['ext.ArticleIndex'] = array(
-       'styles' => array( 'ext.ArticleIndex.css' ),
-       'scripts' => array( 'ext.ArticleIndex.js' ),
-       'localBasePath' => __DIR__,
-       'remoteExtPath' => 'ArticleIndex',
-       'messages' => array(
-               'articleindex-prev',
-               'articleindex-next',
-               'articleindex-index')
-);
-
-$wgAutoloadClasses['ArticleIndexHooks'] = __DIR__ . '/ArticleIndexHooks.php';
-$wgMessagesDirs['ArticleIndex'] = __DIR__ . '/i18n';
-$wgHooks['ParserFirstCallInit'][] = 'ArticleIndexHooks::registerParserHook';
-$wgHooks['BeforePageDisplay'][] = 'ArticleIndexHooks::showIndex';
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..e662932
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,40 @@
+{
+       "name": "ArticleIndex",
+       "version": "0.5.0",
+       "author": "[https://www.mediawiki.org/wiki/User:Jossmart Josef 
Martiňák]",
+       "url": "https://www.mediawiki.org/wiki/Extension:ArticleIndex";,
+       "descriptionmsg": "articleindex-desc",
+       "type": "specialpage",
+       "MessagesDirs": {
+               "ArticleIndex": [
+                       "i18n"
+               ]
+       },
+       "AutoloadClasses": {
+               "ArticleIndexHooks": "ArticleIndexHooks.php"
+       },
+       "ResourceModules": {
+               "ext.ArticleIndex": {
+                       "styles": [
+                               "ext.ArticleIndex.css"
+                       ],
+                       "scripts": [
+                               "ext.ArticleIndex.js"
+                       ],
+                       "messages": [
+                               "articleindex-prev",
+                               "articleindex-next",
+                               "articleindex-index"
+                       ]
+               }
+       },
+       "ResourceFileModulePaths": {
+               "localBasePath": "",
+               "remoteExtPath": "ArticleIndex"
+       },
+       "Hooks": {
+               "ParserFirstCallInit": "ArticleIndexHooks::registerParserHook",
+               "BeforePageDisplay": "ArticleIndexHooks::showIndex"
+       },
+       "manifest_version": 2
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifca5caaa9810c92fceb218458ab6418b57d81f2c
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/ArticleIndex
Gerrit-Branch: master
Gerrit-Owner: MarcoAurelio <[email protected]>
Gerrit-Reviewer: Jossmart <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Mainframe98 <[email protected]>
Gerrit-Reviewer: MarcoAurelio <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to