jenkins-bot has submitted this change and it was merged. (
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, 45 insertions(+), 39 deletions(-)
Approvals:
Gergő Tisza: Looks good to me, but someone else must approve
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/AccessControl.php b/AccessControl.php
index 9c3b317..9c44ab4 100644
--- a/AccessControl.php
+++ b/AccessControl.php
@@ -1,5 +1,4 @@
<?php
-
/**
* MediaWiki extension that enables group access restriction on a page-by-page
* basis
@@ -15,42 +14,14 @@
* @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. '
.
+ 'Please 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.29+' );
}
-
-// 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..8497f39
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,35 @@
+{
+ "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": {
+ "value": true,
+ "description": "Sysop users can read all restricted
pages"
+ },
+ "AccessControlRedirect": {
+ "value": true,
+ "description": "Do not redirect from page in search
results to restricted pages"
+ }
+ },
+ "Hooks": {
+ "ParserFirstCallInit":
"AccessControlHooks::accessControlExtension",
+ "userCan": "AccessControlHooks::onUserCan",
+ "UnknownAction": "AccessControlHooks::onUnknownAction"
+ },
+ "manifest_version": 2
+}
--
To view, visit https://gerrit.wikimedia.org/r/367667
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ieeb9484651d7d67d9171692d70e0ad862c3d171f
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/AccessControl
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 <[email protected]>
Gerrit-Reviewer: Gergő Tisza <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Mainframe98 <[email protected]>
Gerrit-Reviewer: MarcoAurelio <[email protected]>
Gerrit-Reviewer: Reception123 <[email protected]>
Gerrit-Reviewer: Want <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits