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

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

Convert AccessControl to use extension registration

Bug: T171576
Change-Id: Ieeb9484651d7d67d9171692d70e0ad862c3d171f
---
M AccessControl.php
A extension.json
2 files changed, 38 insertions(+), 54 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AccessControl 
refs/changes/67/367667/1

diff --git a/AccessControl.php b/AccessControl.php
index 9c3b317..951b4a9 100644
--- a/AccessControl.php
+++ b/AccessControl.php
@@ -1,56 +1,11 @@
 <?php
-
-/**
- * MediaWiki extension that enables group access restriction on a page-by-page
- * basis
- *
- * Version pre-0.1 (2005-05-03) by Josh Greenberg
- * Version 0.1 to 0.9 (2010-06-27) by Martin Gondermann
- * Version 1.0 to 2.5 by Aleš Kapica
- * Version 2.6 by Siebrand Mazeland and Thomas Mulhall
- *
- * @package MediaWiki
- * @subpackage Extensions
- * @author Aleš Kapica
- * @copyright 2008-2014 Aleš Kapica
- * @license GNU General Public Licence 2.0 or later
- */
-
-// Ensure that the script cannot be executed outside of MediaWiki
-if ( !defined( 'MEDIAWIKI' ) ) {
-       echo "This file is an extension to the MediaWiki software and cannot be 
used standalone.\n";
-       die();
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'AccessControl' );
+       $wgMessageDirs['AccessControl'] = __DIR__ . '/i18n';
+       wfWarn(
+               'Deprecated PHP entry point used for AccessControl extension. 
Pleae use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );
+} else {
+       die( 'This version of the AccessControl extension requires MediaWiki 
1.25+' );
 }
-
-// Register extension with MediaWiki
-$wgExtensionCredits['parserhook'][] = [
-       'path' => __FILE__,
-       'name' => 'AccessControl',
-       'author' => [
-               '[https://www.mediawiki.org/wiki/m:User:Want Aleš Kapica]'
-       ],
-       'url' => 'https://www.mediawiki.org/wiki/Extension:AccessControl',
-       'version' => '2.6',
-       'descriptionmsg' => 'accesscontrol-desc',
-       'license-name' => 'GPL-2.0+'
-];
-
-// Set extension specific parameters
-// sysop users can read all restricted pages
-$wgAdminCanReadAll = true;
-// do not redirect from page in search results to restricted pages
-$wgAccessControlRedirect = true;
-
-// Load extension's class
-$wgAutoloadClasses['AccessControlHooks'] = __DIR__ . 
'/AccessControl.hooks.php';
-
-// Register extension's messages
-$wgMessagesDirs['AccessControl'] = __DIR__ . '/i18n';
-
-// Register hooks
-// Hook the ParserFirstCallInit for
-$wgHooks['ParserFirstCallInit'][] = 
'AccessControlHooks::accessControlExtension';
-// Hook the userCan function for bypassing the cache
-$wgHooks['userCan'][] = 'AccessControlHooks::onUserCan';
-// Hook the UnknownAction function for information user about restrictions
-$wgHooks['UnknownAction'][] = 'AccessControlHooks::onUnknownAction';
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..9a8faea
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,29 @@
+{
+       "name": "AccessControl",
+       "version": "2.6",
+       "author": [
+               "[https://www.mediawiki.org/wiki/m:User:Want Aleš Kapica]"
+       ],
+       "type": "parserhook",
+       "url": "https://www.mediawiki.org/wiki/Extension:AccessControl";,
+       "descriptionmsg": "accesscontrol-desc",
+       "license-name": "GPL-2.0+",
+       "AutoloadClasses": {
+               "AccessControlHooks": "AccessControl.hooks.php"
+       },
+       "MessagesDirs": {
+               "AccessControl": [
+                       "i18n"
+               ]
+       },
+       "config": {
+               "AdminCanReadAll": true,
+               "AccessControlRedirect": true
+       },
+       "Hooks": {
+               "ParserFirstCallInit": 
"AccessControlHooks::accessControlExtension",
+               "userCan": "AccessControlHooks::onUserCan",
+               "UnknownAction": "AccessControlHooks::onUnknownAction"
+       },
+       "manifest_version": 1
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieeb9484651d7d67d9171692d70e0ad862c3d171f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AccessControl
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 <[email protected]>

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

Reply via email to