父节点
a701815540
当前提交
d9601bbcb9
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0"?>
|
||||
<ruleset>
|
||||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
|
||||
<exclude name="Generic.Files.LineLength.TooLong" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingParamName" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingParamTag" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.ParamNameNoMatch" />
|
||||
<exclude name="Squiz.Scope.MethodScope.Missing" />
|
||||
</rule>
|
||||
<file>.</file>
|
||||
<arg name="extensions" value="php,php5,inc"/>
|
||||
<arg name="encoding" value="UTF-8"/>
|
||||
</ruleset>
|
|
@ -246,4 +246,4 @@ $specialPageAliases['zh-hans'] = [
|
|||
/** Traditional Chinese (中文(繁體)) */
|
||||
$specialPageAliases['zh-hant'] = [
|
||||
'GlobalUserrights' => [ '全域用戶組權限' ],
|
||||
];
|
||||
];
|
||||
|
|
|
@ -2,15 +2,18 @@
|
|||
"require-dev": {
|
||||
"jakub-onderka/php-parallel-lint": "1.0.0",
|
||||
"jakub-onderka/php-console-highlighter": "0.3.2",
|
||||
"mediawiki/minus-x": "0.3.2"
|
||||
"mediawiki/minus-x": "0.3.2",
|
||||
"mediawiki/mediawiki-codesniffer": "28.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": [
|
||||
"parallel-lint . --exclude vendor --exclude node_modules",
|
||||
"minus-x check ."
|
||||
"minus-x check .",
|
||||
"phpcs -p -s"
|
||||
],
|
||||
"fix": [
|
||||
"minus-x fix ."
|
||||
"minus-x fix .",
|
||||
"phpcbf"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
"GlobalUserrightsAlias": "GlobalUserrights.alias.php"
|
||||
},
|
||||
"AutoloadClasses": {
|
||||
"GlobalUserrights": "GlobalUserrights_body.php",
|
||||
"GlobalUserrightsHooks": "GlobalUserrightsHooks.php",
|
||||
"GlobalUserGroupMembership": "GlobalUserGroupMembership.php",
|
||||
"GlobalRightsLogFormatter": "GlobalRightsLogFormatter.php"
|
||||
"GlobalUserrights": "includes/GlobalUserrights.php",
|
||||
"GlobalUserrightsHooks": "includes/GlobalUserrightsHooks.php",
|
||||
"GlobalUserGroupMembership": "includes/GlobalUserGroupMembership.php",
|
||||
"GlobalRightsLogFormatter": "includes/GlobalRightsLogFormatter.php"
|
||||
},
|
||||
"Hooks": {
|
||||
"LoadExtensionSchemaUpdates": "GlobalUserrightsHooks::onLoadExtensionSchemaUpdates",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @file
|
||||
* @ingroup Extensions
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
|
||||
* @license GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
/**
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @file
|
||||
* @ingroup Extensions
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
|
||||
* @license GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
use Wikimedia\Rdbms\IDatabase;
|
||||
|
@ -33,7 +33,7 @@ class GlobalUserGroupMembership extends UserGroupMembership {
|
|||
|
||||
/**
|
||||
* @param int $userId The ID of the user who belongs to the group
|
||||
* @param string $group The internal group name
|
||||
* @param string|null $group The internal group name
|
||||
* @param string|null $expiry Timestamp of expiry in TS_MW format, or null if no expiry
|
||||
*/
|
||||
public function __construct( $userId = 0, $group = null, $expiry = null ) {
|
||||
|
@ -161,7 +161,7 @@ class GlobalUserGroupMembership extends UserGroupMembership {
|
|||
if ( $allowUpdate ) {
|
||||
if ( $this->expiry ) {
|
||||
$conds[] = 'gug_expiry IS NULL OR gug_expiry != ' .
|
||||
$dbw->addQuotes( $dbw->timestamp( $this->expiry ) );
|
||||
$dbw->addQuotes( $dbw->timestamp( $this->expiry ) );
|
||||
} else {
|
||||
$conds[] = 'gug_expiry IS NOT NULL';
|
||||
}
|
||||
|
@ -307,10 +307,9 @@ class GlobalUserGroupMembership extends UserGroupMembership {
|
|||
* @throws MWException
|
||||
*/
|
||||
public static function getLink( $ugm, IContextSource $context, $format, $userName = null ) {
|
||||
|
||||
if ( $format !== 'wiki' && $format !== 'html' ) {
|
||||
throw new MWException( 'GlobalUserGroupMembership::getLink() $format parameter should be ' .
|
||||
"'wiki' or 'html'" );
|
||||
"'wiki' or 'html'" );
|
||||
}
|
||||
|
||||
if ( $ugm instanceof GlobalUserGroupMembership ) {
|
|
@ -6,13 +6,12 @@
|
|||
* @ingroup Extensions
|
||||
* @author Nathaniel Herman <redwwjd@yahoo.com>
|
||||
* @copyright Copyright © 2008 Nathaniel Herman
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
|
||||
* @license GPL-2.0-or-later
|
||||
* @note Some of the code based on stuff by Lukasz 'TOR' Garczewski, as well as SpecialUserrights.php and CentralAuth
|
||||
*/
|
||||
|
||||
class GlobalUserrights extends UserrightsPage {
|
||||
|
||||
/* Constructor */
|
||||
public function __construct() {
|
||||
SpecialPage::__construct( 'GlobalUserrights' );
|
||||
}
|
||||
|
@ -37,7 +36,7 @@ class GlobalUserrights extends UserrightsPage {
|
|||
|
||||
$uid = $uidLookup->centralIdFromLocalUser( $user );
|
||||
|
||||
$oldUGMs = GlobalUserrightsHooks::getGroupMemberships( $uid );
|
||||
$oldUGMs = GlobalUserrightsHooks::getGroupMemberships( $uid );
|
||||
$oldGroups = GlobalUserrightsHooks::getGroups( $uid );
|
||||
$newGroups = $oldGroups;
|
||||
|
||||
|
@ -62,7 +61,7 @@ class GlobalUserrights extends UserrightsPage {
|
|||
|
||||
// get rid of duplicate groups there might be
|
||||
$newGroups = array_unique( $newGroups );
|
||||
$newUGMs = GlobalUserrightsHooks::getGroupMemberships( $uid );
|
||||
$newUGMs = GlobalUserrightsHooks::getGroupMemberships( $uid );
|
||||
|
||||
// Ensure that caches are cleared
|
||||
$user->invalidateCache();
|
||||
|
@ -84,7 +83,7 @@ class GlobalUserrights extends UserrightsPage {
|
|||
*
|
||||
* @param int $uid central Id
|
||||
* @param string $group name of the group to add
|
||||
* @param string $expiry expiration of the group membership
|
||||
* @param string|null $expiry expiration of the group membership
|
||||
* @return bool
|
||||
*/
|
||||
function addGroup( $uid, $group, $expiry = null ) {
|
||||
|
@ -133,12 +132,12 @@ class GlobalUserrights extends UserrightsPage {
|
|||
) {
|
||||
// make sure $oldUGMs and $newUGMs are in the same order, and serialise
|
||||
// each UGM object to a simplified array
|
||||
$oldUGMs = array_map( function( $group ) use ( $oldUGMs ) {
|
||||
$oldUGMs = array_map( function ( $group ) use ( $oldUGMs ) {
|
||||
return isset( $oldUGMs[$group] ) ?
|
||||
self::serialiseUgmForLog( $oldUGMs[$group] ) :
|
||||
null;
|
||||
}, $oldGroups );
|
||||
$newUGMs = array_map( function( $group ) use ( $newUGMs ) {
|
||||
$newUGMs = array_map( function ( $group ) use ( $newUGMs ) {
|
||||
return isset( $newUGMs[$group] ) ?
|
||||
self::serialiseUgmForLog( $newUGMs[$group] ) :
|
||||
null;
|
|
@ -47,7 +47,7 @@ class GlobalUserrightsHooks {
|
|||
* @return bool
|
||||
*/
|
||||
public static function onUserEffectiveGroups( User $user, &$groups ) {
|
||||
$groups = array_merge( $groups, GlobalUserrightsHooks::getGroups( $user ) );
|
||||
$groups = array_merge( $groups, self::getGroups( $user ) );
|
||||
$groups = array_unique( $groups );
|
||||
|
||||
return true;
|
||||
|
@ -161,9 +161,9 @@ class GlobalUserrightsHooks {
|
|||
*/
|
||||
public static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) {
|
||||
$dir = __DIR__;
|
||||
$updater->addExtensionTable( 'global_user_groups', $dir . '/global_user_groups.sql' );
|
||||
$updater->addExtensionTable( 'global_user_groups', $dir . '/../sql/global_user_groups.sql' );
|
||||
|
||||
$dir .= '/db_patches';
|
||||
$dir .= '/../db_patches';
|
||||
|
||||
// Update the table with the new definitions
|
||||
// This ensures backwards compatibility
|
正在加载...
在新工单中引用