From d74ac507eb5eefc529bca5a4c4213a34f535b30e Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 7 Feb 2004 02:02:42 +0000 Subject: [PATCH] Bureaucratic improvements -- lots of forms to fill in for increased levels of accountability --- includes/SpecialMakesysop.php | 30 +++++++++++++++++++++++++----- languages/Language.php | 2 ++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/includes/SpecialMakesysop.php b/includes/SpecialMakesysop.php index 59960321b5..10122bff9f 100644 --- a/includes/SpecialMakesysop.php +++ b/includes/SpecialMakesysop.php @@ -85,9 +85,11 @@ class MakesysopForm { if( count( $parts ) == 2){ $username = addslashes( $parts[0] ); $usertable = $parts[1] . "wiki.user"; + $dbName = $parts[1] . "wiki"; } else { $username = addslashes( $wpMakesysopUser ); $usertable = "user"; + $dbName = $wgDBname; } $prev = wfIgnoreSQLErrors( TRUE ); $res = wfQuery("SELECT user_id, user_rights FROM $usertable WHERE user_name = '{$username}'", DB_WRITE); @@ -100,25 +102,43 @@ class MakesysopForm { $row = wfFetchObject( $res ); $id = intval( $row->user_id ); + $rightsNotation = array(); if( $row->user_rights ){ $rights = explode(",", $row->user_rights ); if(! in_array("sysop", $rights ) ){ $rights[] = "sysop"; + $rightsNotation[] = "+sysop "; } if ( $wpSetBureaucrat && !in_array( "bureaucrat", $rights ) ) { $rights[] = "bureaucrat"; + $rightsNotation[] = "+bureaucrat "; } $newrights = addslashes( implode( ",", $rights ) ); } else { $newrights = "sysop"; + $rightsNotation[] = "+sysop"; + if ( $wpSetBureaucrat ) { + $rightsNotation[] = "+bureaucrat"; + $newrights .= ",bureaucrat"; + } } - $sql = "UPDATE $usertable SET user_rights = '{$newrights}' WHERE user_id = $id LIMIT 1"; - wfQuery($sql, DB_WRITE); - $wgMemc->delete( "$wgDBname:user:id:$id" ); - - $this->showSuccess(); + if ( count( $rightsNotation ) == 0 ) { + $this->showFail(); + } else { + $sql = "UPDATE $usertable SET user_rights = '{$newrights}' WHERE user_id = $id LIMIT 1"; + wfQuery($sql, DB_WRITE); + $wgMemc->delete( "$dbName:user:id:$id" ); + + $bureaucratLog = wfMsg( "bureaucratlog" ); + $action = wfMsg( "bureaucratlogentry", $wpMakesysopUser, implode( " ", $rightsNotation ) ); + + $log = new LogPage( $bureaucratLog ); + $log->addEntry( $action, "" ); + + $this->showSuccess(); + } } function showSuccess() diff --git a/languages/Language.php b/languages/Language.php index 07d15d5e15..1b3ca3c75f 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1279,6 +1279,8 @@ Type the name of the user in the box and press the button to make the user an ad "makesysopok" => "User '$1' is now a sysop", "makesysopfail" => "User '$1' could not be made into a sysop. (Did you enter the name correctly?)", "setbureaucratflag" => "Set bureaucrat flag", +"bureaucratlog" => "Bureaucrat_log", +"bureaucratlogentry" => " set $1: $2", # Move page # -- 2.20.1