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

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

Convert Blackout to use extension registration

Bug: T180674
Change-Id: Ie0279e93bb39b3e7c56dbb5831bf0c540d550497
---
M Blackout.php
A extension.json
2 files changed, 55 insertions(+), 70 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Blackout 
refs/changes/79/391779/1

diff --git a/Blackout.php b/Blackout.php
index a86c195..565afbe 100644
--- a/Blackout.php
+++ b/Blackout.php
@@ -11,73 +11,17 @@
  * Thank you to *** for feedback, bug reporting and cleaning up code
  *
  */
-
-/**
- * Exit if called outside of MediaWiki
- */
-if( !defined( 'MEDIAWIKI' ) ) {
-       echo( "This file is an extension to the MediaWiki software and cannot 
be used standalone.\n" );
-       die( 1 );
-}
-
-/**
- * SETTINGS
- * --------
- * The following variables may be reset in your LocalSettings.php file.
- *
- * $wgBlackout['Enable']
- *                     - Enables blackout message
- *                       Default is true
- *
- * $wgBlackout['Skin']
- *                     - Change the blackout skin
- *                             * ProtestSopa (Default)
- *                             * SopaStrike
- *                             * StopSopa
- *
- * $wgBlackout['Whitelist'][]
- *                     - Add pages to the whitelist
- *
- */
-
-$wgBlackout = array(
-       'Enable' => true,
-       'Skin' => 'ProtestSopa',
-       'Whitelist' => array(
-               'Special:Version',
-       ),
-);
-
-/**
- * Class and localisation
- *
- */
-
-$dir = dirname(__FILE__) . '/';
-
-$wgAutoloadClasses['Blackout'] = $dir . 'Blackout.body.php';
-$wgMessagesDirs['Blackout'] = __DIR__ . '/i18n';
-
-$skinDir = $dir . 'skins/';
-$wgAutoloadClasses['SkinProtestSopa'] = $skinDir . 'ProtestSopa.php';
-$wgAutoloadClasses['SkinStopSopa'] = $skinDir . 'StopSopa.php';
-$wgAutoloadClasses['SkinSopaStrike'] = $skinDir . 'SopaStrike.php';
-$wgAutoloadClasses['ProtestSopaTemplate'] = $skinDir . 'ProtestSopa.php';
-$wgAutoloadClasses['StopSopaTemplate'] = $skinDir . 'StopSopa.php';
-$wgAutoloadClasses['SopaStrikeTemplate'] = $skinDir . 'SopaStrike.php';
-
-/*
- * Credits
- */
-$wgExtensionCredits['other'][] = array(
-       'name'           => 'Blackout',
-       'version'        => '1.0.20120118',
-       'author'         => 
array('[https://www.mediawiki.org/wiki/User:Johnduhart John Du Hart]', 
'[https://www.mediawiki.org/wiki/User:Varnent Gregory Varnum]', '...'),
-       'descriptionmsg' => 'blackout-desc',
-       'url'            => 'https://www.mediawiki.org/wiki/Extension:Blackout',
-);
-
-/*
- * Hooks
- */
-$wgHooks['MediaWikiPerformAction'][] = 'Blackout::overrideAction';
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'Blackout' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['Blackout'] = __DIR__ . '/i18n';
+       $wgExtensionMessagesFiles['BlackoutAlias'] = __DIR__ . 
'/Blackout.alias.php';
+       wfWarn(
+               'Deprecated PHP entry point used for the Blackout extension. ' .
+               'Please use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );
+       return;
+} else {
+       die( 'This version of the Blackout extension requires MediaWiki 1.29+' 
);
+}
\ No newline at end of file
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..5c2fd35
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,41 @@
+{
+       "name": "Blackout",
+       "version": "1.0.20120118",
+       "author": [
+               "[https://www.mediawiki.org/wiki/User:Johnduhart John Du Hart]",
+               "[https://www.mediawiki.org/wiki/User:Varnent Gregory Varnum]",
+               "..."
+       ],
+       "url": "https://www.mediawiki.org/wiki/Extension:Blackout";,
+       "descriptionmsg": "blackout-desc",
+       "type": "other",
+       "MessagesDirs": {
+               "Blackout": [
+                       "i18n"
+               ]
+       },
+       "AutoloadClasses": {
+               "Blackout": "Blackout.body.php",
+               "SkinProtestSopa": "skins/ProtestSopa.php",
+               "SkinStopSopa": "skins/StopSopa.php",
+               "SkinSopaStrike": "skins/SopaStrike.php",
+               "ProtestSopaTemplate": "skins/ProtestSopa.php",
+               "StopSopaTemplate": "skins/StopSopa.php",
+               "SopaStrikeTemplate": "skins/SopaStrike.php"
+       },
+       "Hooks": {
+               "MediaWikiPerformAction": "Blackout::overrideAction"
+       },
+       "config": {
+               "Blackout": {
+                       "value": {
+                               "Enable": true,
+                               "Skin": "ProtestSopa",
+                               "Whitelist": [
+                                       "Special:Version"
+                               ]
+                       }
+               }
+       },
+       "manifest_version": 2
+}

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

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