Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2738
1.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 9:11 PM
2014-11-21 21:11:56 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
1.patch
View Options
Index: Makesysop/SpecialMakesysop.php
===================================================================
--- Makesysop/SpecialMakesysop.php (revision 13659)
+++ Makesysop/SpecialMakesysop.php (working copy)
@@ -201,38 +201,39 @@
$res = $dbw->query( $sql, $fname );
$row = false;
- $groups = array();
+ $oldGroups = array();
while ( $row = $dbw->fetchObject( $res ) ) {
- $groups[$row->ug_group] = true;
+ $oldGroups[] = $row->ug_group;
}
$dbw->freeResult( $res );
+ $newGroups = $oldGroups;
- $rightsNotation = array();
- $wasSysop = !empty( $groups['sysop'] );
- $wasBureaucrat = !empty( $groups['bureaucrat'] );
+ $wasSysop = in_array( 'sysop', $oldGroups );
+ $wasBureaucrat = in_array( 'bureaucrat', $oldGroups );
- if ( $this->mSetBureaucrat ) {
- if ( $wasBureaucrat ) {
- $this->showFail( 'already_bureaucrat' );
- return;
- } else {
- $dbw->insert( $user_groups, array( 'ug_user' => $id, 'ug_group' => 'bureaucrat' ), $fname );
- $rightsNotation[] = "+bureaucrat";
- }
- } elseif ( $wasSysop ) {
+ $addedGroups = array();
+ if ( ( $this->mSetBureaucrat ) && ( $wasBureaucrat ) ) {
+ $this->showFail( 'already_bureaucrat' );
+ return;
+ } elseif ( ( !$this->mSetBureaucrat ) && ( $wasSysop ) ) {
$this->showFail( 'already_sysop' );
return;
- }
- if ( !$wasSysop ) {
+ } elseif ( !$wasSysop ) {
$dbw->insert( $user_groups, array( 'ug_user' => $id, 'ug_group' => 'sysop' ), $fname );
- $rightsNotation[] = "+sysop";
+ $addedGroups[] = "sysop";
}
+ if ( ( $this->mSetBureaucrat ) && ( !$wasBureaucrat ) ) {
+ $dbw->insert( $user_groups, array( 'ug_user' => $id, 'ug_group' => 'bureaucrat' ), $fname );
+ $addedGroups[] = "bureaucrat";
+ }
$wgMemc->delete( "$dbName:user:id:$id" );
-
+
+ $newGroups = array_merge($newGroups, $addedGroups);
+
$log = new LogPage( 'rights' );
- $log->addEntry( 'rights', Title::makeTitle( NS_USER, $this->mUser ),
- implode( " ", $rightsNotation ) );
+ $log->addEntry( 'rights', Title::makeTitle( NS_USER, $this->mUser ), '',
+ array( $this->makeGroupNameList( $oldGroups ), $this->makeGroupNameList( $newGroups ) ) );
$this->showSuccess();
}
@@ -254,6 +255,11 @@
$wgOut->setPagetitle( wfMsg( "makesysoptitle" ) );
$this->showForm( wfMsg( $msg, $this->mUser ) );
}
+
+ function makeGroupNameList( $ids ) {
+ return implode( ', ', $ids );
+ }
+
}
/**
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2312
Default Alt Text
1.patch (2 KB)
Attached To
Mode
T7585: Makesysop outputs a completely different log entry than Userrights
Attached
Detach File
Event Timeline
Log In to Comment