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

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

Convert DeleteBatch to use extension registration

Bug: T180818
Change-Id: Ibca3f2d3bbb4c9b6128a26ed6c95f50c1ea310f0
---
M DeleteBatch.php
A extension.json
2 files changed, 52 insertions(+), 31 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DeleteBatch 
refs/changes/81/392081/1

diff --git a/DeleteBatch.php b/DeleteBatch.php
index 5c3a84b..e5dae19 100644
--- a/DeleteBatch.php
+++ b/DeleteBatch.php
@@ -9,35 +9,17 @@
  * @license https://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
  * @link https://www.mediawiki.org/wiki/Extension:DeleteBatch Documentation
  */
-
-// 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.' 
);
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'DeleteBatch' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['DeleteBatch'] = __DIR__ . '/i18n';
+       $wgExtensionMessagesFiles['DeleteBatchAlias'] = __DIR__ . 
'/DeleteBatch.alias.php';
+       wfWarn(
+               'Deprecated PHP entry point used for the DeleteBatch extension. 
' .
+               'Please use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );
+       return;
+} else {
+       die( 'This version of the DeleteBatch extension requires MediaWiki 
1.29+' );
 }
-// Extension credits that will show up on Special:version
-$wgExtensionCredits['specialpage'][] = array(
-       'path' => __FILE__,
-       'name' => 'Delete Batch',
-       'version' => '1.6.0',
-       'author' => array(
-               'Bartek Łapiński',
-               '...'
-       ),
-       'url' => 'https://www.mediawiki.org/wiki/Extension:DeleteBatch',
-       'descriptionmsg' => 'deletebatch-desc',
-       'license-name' => 'GPL-2.0+'
-);
-
-// New user right, required to use Special:DeleteBatch
-$wgAvailableRights[] = 'deletebatch';
-$wgGroupPermissions['bureaucrat']['deletebatch'] = true;
-
-// Set up the new special page
-$wgMessagesDirs['DeleteBatch'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['DeleteBatchAlias'] = __DIR__ . 
'/DeleteBatch.alias.php';
-$wgAutoloadClasses['SpecialDeleteBatch'] = __DIR__ . '/DeleteBatch.body.php';
-$wgAutoloadClasses['DeleteBatchForm'] = __DIR__ . '/DeleteBatch.body.php';
-$wgSpecialPages['DeleteBatch'] = 'SpecialDeleteBatch';
-
-// Hooks
-$wgHooks['AdminLinks'][] = 'SpecialDeleteBatch::addToAdminLinks'; // Admin 
Links extension
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..ef40cc8
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,39 @@
+{
+       "name": "Delete Batch",
+       "version": "1.6.0",
+       "author": [
+               "Bartek Łapiński",
+               "..."
+       ],
+       "url": "https://www.mediawiki.org/wiki/Extension:DeleteBatch";,
+       "descriptionmsg": "deletebatch-desc",
+       "license-name": "GPL-2.0+",
+       "type": "specialpage",
+       "AvailableRights": [
+               "deletebatch"
+       ],
+       "GroupPermissions": {
+               "bureaucrat": {
+                       "deletebatch": true
+               }
+       },
+       "SpecialPages": {
+               "DeleteBatch": "SpecialDeleteBatch"
+       },
+       "MessagesDirs": {
+               "DeleteBatch": [
+                       "i18n"
+               ]
+       },
+       "ExtensionMessagesFiles": {
+               "DeleteBatchAlias": "DeleteBatch.alias.php"
+       },
+       "AutoloadClasses": {
+               "SpecialDeleteBatch": "DeleteBatch.body.php",
+               "DeleteBatchForm": "DeleteBatch.body.php"
+       },
+       "Hooks": {
+               "AdminLinks": "SpecialDeleteBatch::addToAdminLinks"
+       },
+       "manifest_version": 2
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibca3f2d3bbb4c9b6128a26ed6c95f50c1ea310f0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DeleteBatch
Gerrit-Branch: master
Gerrit-Owner: MarcoAurelio <[email protected]>

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

Reply via email to