[MediaWiki-commits] [Gerrit] Convert to extension registration - change (mediawiki...TorBlock)

2016-07-24 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Convert to extension registration
..


Convert to extension registration

Bug: T87984
Change-Id: I12303c00445fc761b467371ace2646982d9a61e5
---
M TorBlock.php
A extension.json
M includes/TorBlockHooks.php
3 files changed, 113 insertions(+), 122 deletions(-)

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



diff --git a/TorBlock.php b/TorBlock.php
index 7811687..707ef2c 100644
--- a/TorBlock.php
+++ b/TorBlock.php
@@ -1,125 +1,15 @@
 http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Extensions
- * @link http://www.mediawiki.org/wiki/Extension:TorBlock Documentation
- *
- * @author Andrew Garrett 
- * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
- */
-
-if ( !defined( 'MEDIAWIKI' ) ) {
-   die();
+if ( function_exists( 'wfLoadExtension' ) ) {
+   wfLoadExtension( 'TorBlock' );
+   // Keep i18n globals so mergeMessageFileList.php doesn't break
+   $wgMessagesDirs['TorBlock'] = __DIR__ . '/i18n';
+   /* wfWarn(
+   'Deprecated PHP entry point used for TorBlock extension. ' .
+   'Please use wfLoadExtension instead, ' .
+   'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+   ); */
+   return;
+} else {
+   die( 'This version of the TorBlock extension requires MediaWiki 1.28+' 
);
 }
-
-$wgExtensionCredits['antispam'][] = array(
-   'path'   => __FILE__,
-   'name'   => 'TorBlock',
-   'author' => 'Andrew Garrett',
-   'descriptionmsg' => 'torblock-desc',
-   'url'=> 'https://www.mediawiki.org/wiki/Extension:TorBlock',
-   'license-name'   => 'GPL-2.0+',
-);
-
-$wgMessagesDirs['TorBlock'] = __DIR__ . '/i18n';
-$wgAutoloadClasses['TorBlockHooks'] = __DIR__ . '/includes/TorBlockHooks.php';
-$wgAutoloadClasses['TorExitNodes'] = __DIR__ . '/includes/TorExitNodes.php';
-
-$wgHooks['getUserPermissionsErrorsExpensive'][] = 
'TorBlockHooks::onGetUserPermissionsErrorsExpensive';
-$wgHooks['AbortAutoblock'][] = 'TorBlockHooks::onAbortAutoblock';
-$wgHooks['GetAutoPromoteGroups'][] = 'TorBlockHooks::onGetAutoPromoteGroups';
-$wgHooks['GetBlockedStatus'][] = 'TorBlockHooks::onGetBlockedStatus';
-$wgHooks['AutopromoteCondition'][] = 'TorBlockHooks::onAutopromoteCondition';
-$wgHooks['RecentChange_save'][] = 'TorBlockHooks::onRecentChangeSave';
-$wgHooks['ListDefinedTags'][] = 'TorBlockHooks::onListDefinedTags';
-$wgHooks['ChangeTagsListActive'][] = 'TorBlockHooks::onListDefinedTags';
-$wgHooks['AbuseFilter-filterAction'][] = 
'TorBlockHooks::onAbuseFilterFilterAction';
-$wgHooks['AbuseFilter-builder'][] = 'TorBlockHooks::onAbuseFilterBuilder';
-$wgHooks['EmailUserPermissionsErrors'][] = 
'TorBlockHooks::onEmailUserPermissionsErrors';
-$wgHooks['OtherBlockLogLink'][] = 'TorBlockHooks::onOtherBlockLogLink';
-
-// Define new autopromote condition
-define( 'APCOND_TOR', 'tor' ); // Numbers won't work, we'll get collisions
-
-/**
- * Permission keys that bypass Tor blocks.
- * Array of permission keys.
- */
-$wgTorBypassPermissions = array( 'torunblocked', /*'autoconfirmed'*/ );
-$wgAvailableRights[] = 'torunblocked';
-$wgGrantPermissions['basic']['torunblocked'] = true;
-$wgGroupPermissions['user']['torunblocked'] = true;
-
-/**
- * Whether to load Tor blocks if they aren't stored in memcached.
- * Set to false on high-load sites, and use a cron job with the included
- * maintenance script
- */
-$wgTorLoadNodes = true;
-
-/**
- * Actions tor users are allowed to do.
- * E.g. to allow account creation, add createaccount.
- */
-$wgTorAllowedActions = array( 'read' );
-
-/**
- * Autoconfirm limits for tor users.
- * Both regular limits, AND Tor limits must be passed.
- */
-$wgTorAutoConfirmAge = 0;
-$wgTorAutoConfirmCount = 0;
-
-/**
- * IPs to check for tor exits to.
- * (i.e. all IPs which can be used to access the site.
- */
-$wgTorIPs = array( '208.80.152.2' );
-
-/**
- * Onionoo server to use to poll information from for exit nodes.
- */
-$wgTorOnionooServer = 'https://onionoo.torproject.org';
-
-/**
- * Path to the CA file for the Onionoo server.
- * Set to false or any other invalid value to disable.
- */
-$wgTorOnionooCA = __DIR__ . "/torproject.crt";
-
-/**
- * Path to the CA file for the Tor Project.
- * Set to false or any other invalid value to disable.
- */
-$wgTorProjectCA = __DIR__ . "/torproject.crt";
-
-/**
- * Disable existing blocks of Tor nodes
- */
-$wgTorDisableAdminBlocks = true;
-
-/** Mark tor edits as such */
-$wgTorTagChanges = true;
-
-/**
- * Proxy to use, if not the default proxy
- */
-$wgTorBlockProxy = false;
diff --git a/extension.json b/extension.json
new file mode 100644
index 000..3ee59e9
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,95 @@
+{
+   "name": "TorBlock",
+   "author": "Andrew Garrett",
+   "url"

[MediaWiki-commits] [Gerrit] Convert to extension registration. - change (mediawiki...TorBlock)

2015-05-24 Thread Lewis Cawte (Code Review)
Lewis Cawte has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/213314

Change subject: Convert to extension registration.
..

Convert to extension registration.

Bug: T87984
Change-Id: I12303c00445fc761b467371ace2646982d9a61e5
---
M TorBlock.php
A extension.json
2 files changed, 95 insertions(+), 125 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TorBlock 
refs/changes/14/213314/1

diff --git a/TorBlock.php b/TorBlock.php
index baf46b1..bbb1200 100644
--- a/TorBlock.php
+++ b/TorBlock.php
@@ -1,126 +1,13 @@
 http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Extensions
- * @link http://www.mediawiki.org/wiki/Extension:TorBlock Documentation
- *
- * @author Andrew Garrett 
- * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
- */
-
-if ( !defined( 'MEDIAWIKI' ) ) {
-   die();
-}
-
-$wgExtensionCredits['antispam'][] = array(
-   'path'   => __FILE__,
-   'name'   => 'TorBlock',
-   'author' => 'Andrew Garrett',
-   'descriptionmsg' => 'torblock-desc',
-   'url'=> 'https://www.mediawiki.org/wiki/Extension:TorBlock',
-   'license-name'   => 'GPL-2.0+',
-);
-
-$wgMessagesDirs['TorBlock'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['TorBlock'] =  __DIR__ . "/TorBlock.i18n.php";
-$wgAutoloadClasses['TorBlockHooks'] = __DIR__ . '/includes/TorBlockHooks.php';
-$wgAutoloadClasses['TorExitNodes'] = __DIR__ . '/includes/TorExitNodes.php';
-
-$wgHooks['getUserPermissionsErrorsExpensive'][] = 
'TorBlockHooks::onGetUserPermissionsErrorsExpensive';
-$wgHooks['AbortAutoblock'][] = 'TorBlockHooks::onAbortAutoblock';
-$wgHooks['GetAutoPromoteGroups'][] = 'TorBlockHooks::onGetAutoPromoteGroups';
-$wgHooks['GetBlockedStatus'][] = 'TorBlockHooks::onGetBlockedStatus';
-$wgHooks['AutopromoteCondition'][] = 'TorBlockHooks::onAutopromoteCondition';
-$wgHooks['RecentChange_save'][] = 'TorBlockHooks::onRecentChangeSave';
-$wgHooks['ListDefinedTags'][] = 'TorBlockHooks::onListDefinedTags';
-$wgHooks['ChangeTagsListActive'][] = 'TorBlockHooks::onListDefinedTags';
-$wgHooks['AbuseFilter-filterAction'][] = 
'TorBlockHooks::onAbuseFilterFilterAction';
-$wgHooks['AbuseFilter-builder'][] = 'TorBlockHooks::onAbuseFilterBuilder';
-$wgHooks['EmailUserPermissionsErrors'][] = 
'TorBlockHooks::onEmailUserPermissionsErrors';
-$wgHooks['OtherBlockLogLink'][] = 'TorBlockHooks::onOtherBlockLogLink';
-
-// Define new autopromote condition
-define( 'APCOND_TOR', 'tor' ); // Numbers won't work, we'll get collisions
-
-/**
- * Permission keys that bypass Tor blocks.
- * Array of permission keys.
- */
-$wgTorBypassPermissions = array( 'torunblocked', /*'autoconfirmed', 
'proxyunbannable'*/ );
-$wgAvailableRights[] = 'torunblocked';
-
-$wgGroupPermissions['user']['torunblocked'] = true;
-
-/**
- * Whether to load Tor blocks if they aren't stored in memcached.
- * Set to false on high-load sites, and use a cron job with the included
- * maintenance script
- */
-$wgTorLoadNodes = true;
-
-/**
- * Actions tor users are allowed to do.
- * E.g. to allow account creation, add createaccount.
- */
-$wgTorAllowedActions = array( 'read' );
-
-/**
- * Autoconfirm limits for tor users.
- * Both regular limits, AND Tor limits must be passed.
- */
-$wgTorAutoConfirmAge = 0;
-$wgTorAutoConfirmCount = 0;
-
-/**
- * IPs to check for tor exits to.
- * (i.e. all IPs which can be used to access the site.
- */
-$wgTorIPs = array( '208.80.152.2' );
-
-/**
- * Onionoo server to use to poll information from for exit nodes.
- */
-$wgTorOnionooServer = 'https://onionoo.torproject.org';
-
-/**
- * Path to the CA file for the Onionoo server.
- * Set to false or any other invalid value to disable.
- */
-$wgTorOnionooCA = __DIR__ . "/torproject.crt";
-
-/**
- * Path to the CA file for the Tor Project.
- * Set to false or any other invalid value to disable.
- */
-$wgTorProjectCA = __DIR__ . "/torproject.crt";
-
-/**
- * Disable existing blocks of Tor nodes
- */
-$wgTorDisableAdminBlocks = true;
-
-/** Mark tor edits as such */
-$wgTorTagChanges = true;
-
-/**
- * Proxy to use, if not the default proxy
- */
-$wgTorBlockProxy = false;
+if ( function_exists( 'wfLoadExtension' ) ) {
+   wfLoadExtension( 'TorBlock' );
+   // Keep i18n globals so mergeMessageFileList.php doesn't break
+   $wgMessagesDirs['TorBlock'] = __DIR__ . '/i18n';
+   wfWarn(
+   'Deprecated PHP entry point used for FooBar extension. Please 
use wfLoadExtension instead, ' .
+   'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+   );
+   return;
+} else {
+   die( 'This version of the FooBar extension requires MediaWiki 1.25+' );
+}
\ No newline at end of file
diff --git a/extension.json b/extension.json
new file mode 100644
index 000..275dedd
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,83 @@
+{
+