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

Change subject: Convert DebugTemplates to use extension Regstrattion
......................................................................

Convert DebugTemplates to use extension Regstrattion

Bug: T185513
Change-Id: Ie0670452021c9c6491acd3d0e5c4e03466b575e1
---
M DebugTemplates.php
A extension.json
2 files changed, 68 insertions(+), 50 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DebugTemplates 
refs/changes/42/405742/1

diff --git a/DebugTemplates.php b/DebugTemplates.php
index 1a6b4bd..c3aa9f6 100644
--- a/DebugTemplates.php
+++ b/DebugTemplates.php
@@ -1,52 +1,15 @@
 <?php
-# Alert the user that this is not a valid access point to MediaWiki if they 
try to access the special pages file directly.
-if ( !defined( 'MEDIAWIKI' ) ) {
-       echo <<<EOT
-To install my extension, put the following line in LocalSettings.php:
-require_once( "\$IP/extensions/DebugTemplates/DebugTemplates.php" );
-EOT;
-       exit( 1 );
+
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'DebugTemplates' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['DebugTemplates'] = __DIR__ . '/i18n';
+       wfWarn(
+               'Deprecated PHP entry point used for the DebugTemplates 
extension. ' .
+               'Please use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );
+       return;
+} else {
+       die( 'This version of the DebugTemplates extension requires MediaWiki 
1.29+' );
 }
-
-$wgExtensionCredits['specialpage'][] = array(
-       'path' => __FILE__,
-       'name' => 'DebugTemplates',
-       'author' => 'Clark Verbrugge',
-       'license-name' => 'CC-BY-SA-3.0',
-       'url' => 'https://www.mediawiki.org/wiki/Extension:DebugTemplates',
-       'descriptionmsg' => 'debugtemplates-desc',
-       'version' => '0.5',
-);
-
-$wgAutoloadClasses['SpecialDebugTemplates'] = __DIR__ . 
'/SpecialDebugTemplates.php';
-$wgAutoloadClasses['ApiDebugTemplates'] = __DIR__ . '/ApiDebugTemplates.php';
-
-$wgMessagesDirs['DebugTemplates'] = __DIR__ . "/i18n";
-$wgExtensionMessagesFiles['DebugTemplatesAlias'] = __DIR__ . 
'/DebugTemplates.alias.php';
-
-$wgSpecialPages['DebugTemplates'] = 'SpecialDebugTemplates';
-$wgAPIModules['expandframe'] = 'ApiDebugTemplates';
-
-$wgResourceModules['ext.debugTemplates'] = array(
-       'scripts' => array( 'ext.debugTemplates.js' ),
-       'styles' => 'ext.debugTemplates.css',
-
-       // error and warning messages used in the javascript
-       'messages' => array( 'debugtemplates-error-parse',
-               'debugtemplates-error-button',
-               'debugtemplates-error-eval',
-               'debugtemplates-error-arg-eval',
-               'debugtemplates-warning-template-not-a-template',
-               'debugtemplates-warning-template-not-found',
-               'debugtemplates-error-template-name',
-               'debugtemplates-error-template-revisions',
-               'debugtemplates-error-template-page',
-               'debugtemplates-args-constructed',
-               'debugtemplates-args-eval-all' ),
-
-       // no dependencies
-       'dependencies' => array(  ),
-
-       'localBasePath' => __DIR__,
-       'remoteExtPath' => 'DebugTemplates'
-);
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..f382da9
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,55 @@
+{
+       "name": "DebugTemplates",
+       "version": "0.5",
+       "author": "Clark Verbrugge",
+       "url": "https://www.mediawiki.org/wiki/Extension:DebugTemplates";,
+       "descriptionmsg": "debugtemplates-desc",
+       "license-name": "CC-BY-SA-3.0",
+       "type": "specialpage",
+       "APIModules": {
+               "expandframe": "ApiDebugTemplates"
+       },
+       "SpecialPages": {
+               "DebugTemplates": "SpecialDebugTemplates"
+       },
+       "MessagesDirs": {
+               "DebugTemplates": [
+                       "i18n"
+               ]
+       },
+       "ExtensionMessagesFiles": {
+               "DebugTemplatesAlias": "DebugTemplates.alias.php"
+       },
+       "AutoloadClasses": {
+               "SpecialDebugTemplates": "SpecialDebugTemplates.php",
+               "ApiDebugTemplates": "ApiDebugTemplates.php"
+       },
+       "ResourceModules": {
+               "ext.debugTemplates": {
+                       "scripts": [
+                               "ext.debugTemplates.js"
+                       ],
+                       "styles": "ext.debugTemplates.css",
+                       "messages": [
+                               "debugtemplates-error-parse",
+                               "debugtemplates-error-button",
+                               "debugtemplates-error-eval",
+                               "debugtemplates-error-arg-eval",
+                               
"debugtemplates-warning-template-not-a-template",
+                               "debugtemplates-warning-template-not-found",
+                               "debugtemplates-error-template-name",
+                               "debugtemplates-error-template-revisions",
+                               "debugtemplates-error-template-page",
+                               "debugtemplates-args-constructed",
+                               "debugtemplates-args-eval-all"
+                       ],
+                       "description": "ext.debugTemplates's messages: Error 
and warning messages used in the javascript.",
+                       "dependencies": []
+               }
+       },
+       "ResourceFileModulePaths": {
+               "localBasePath": "",
+               "remoteExtPath": "DebugTemplates"
+       },
+       "manifest_version": 2
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie0670452021c9c6491acd3d0e5c4e03466b575e1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DebugTemplates
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