From f98c133919920e5fa2ce48efc64a6d4930521e3a Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sun, 1 May 2005 18:24:20 +0000 Subject: [PATCH] Major changes to user groups: * Added "static groups" feature to remove memcached/DB load time * Added i18n support, allowing names and descriptions to be optionally drawn from wfMsg/wfMsgForContent * Fixed Special:Groups, it is now half-decent. Too many changes to list here. --- includes/DefaultSettings.php | 8 + includes/Group.php | 232 +++++++++++++++--- includes/HTMLForm.php | 23 +- includes/LogPage.php | 5 +- includes/SpecialGroups.php | 191 +++++++++++--- includes/SpecialPage.php | 2 +- includes/SpecialUserrights.php | 8 +- includes/User.php | 4 - languages/Language.php | 32 ++- .../patch-userlevels-defaultgroups.sql | 10 +- 10 files changed, 408 insertions(+), 107 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 859f5497d4..47ea2bd952 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -541,6 +541,14 @@ $wgBlockExpiryOptions = "2 hours,1 day,3 days,1 week,2 weeks,1 month,3 months,6 $wgAutoblockExpiry = 86400; # Number of seconds before autoblock entries expire +/** + * Static user groups serialized record + * To avoid database access, you can set this to a user groups record as returned + * by Special:Groups with the magic parameter showrecord=1. This will however mean + * that you won't be able to edit them at runtime. + */ +$wgStaticGroups = false; + # Proxy scanner settings # diff --git a/includes/Group.php b/includes/Group.php index 88b5166628..037761616d 100644 --- a/includes/Group.php +++ b/includes/Group.php @@ -41,40 +41,74 @@ class Group { function loadFromDatabase() { global $wgCommandLineMode; $fname = 'Group::loadFromDatabase'; + + // See if it's already loaded if ( $this->dataLoaded || $wgCommandLineMode ) { return; } + // If we're using static groups, don't touch the database, use the + // internal arrays + $staticGroups =& Group::getStaticGroups(); + if ( $staticGroups ) { + if ( $this->id ) { + $this = $staticGroups[$this->id]; + } else { + $this->id = Group::idFromName( $this->name ); + $this = $staticGroups[$this->id]; + } + return; + } + + // Now go for the database + // be sure it's an integer $this->id = IntVal($this->id); if($this->id) { + // By ID $dbr =& wfGetDB( DB_SLAVE ); $r = $dbr->selectRow('group', array('group_id', 'group_name', 'group_description', 'group_rights'), array( 'group_id' => $this->id ), $fname ); - $this->id = $r->group_id; - $this->name = $r->group_name; - $this->description = $r->group_description; - $this->rights = $r->group_rights; - $this->dataLoaded = true; + if ( $r ) { + $this->loadFromRow( $r ); + } else { + $this->id = 0; + $this->dataLoaded = true; + } } else { + // By name $dbr =& wfGetDB( DB_SLAVE ); $r = $dbr->selectRow('group', array('group_id', 'group_name', 'group_description', 'group_rights'), array( 'group_name' => $this->name ), $fname ); - $this->id = $r->group_id; - $this->name = $r->group_name; - $this->description = $r->group_description; - $this->rights = $r->group_rights; - $this->dataLoaded = true; + if ( $r ) { + $this->loadFromRow( $r ); + } else { + $this->id = 0; + $this->dataLoaded = true; + } } } + + /** Initialise from a result row */ + function loadFromRow( &$row ) { + $this->id = $row->group_id; + $this->name = $row->group_name; + $this->description = $row->group_description; + $this->rights = $row->group_rights; + $this->dataLoaded = true; + } /** Initialise a new row in the database */ function addToDatabase() { + if ( Group::getStaticGroups() ) { + wfDebugDieBacktrace( "Can't modify groups in static mode" ); + } + $fname = 'Group::addToDatabase'; $dbw =& wfGetDB( DB_MASTER ); $dbw->insert( 'group', @@ -89,9 +123,12 @@ class Group { /** Save the group datas into database */ function save() { - $fname = 'Group::save'; + if ( Group::getStaticGroups() ) { + wfDebugDieBacktrace( "Can't modify groups in static mode" ); + } if($this->id == 0) { return; } - + + $fname = 'Group::save'; $dbw =& wfGetDB( DB_MASTER ); $dbw->update( 'group', @@ -104,6 +141,23 @@ class Group { ), $fname ); } + + /** Delete a group */ + function delete() { + if ( Group::getStaticGroups() ) { + wfDebugDieBacktrace( "Can't modify groups in static mode" ); + } + if($this->id == 0) { return; } + + $fname = 'Group::delete'; + $dbw =& wfGetDB( DB_MASTER ); + + // First remove all users from the group + $dbw->delete( 'user_group', array( 'ug_group' => $this->id ), $fname ); + + // Now delete the group + $dbw->delete( 'group', array( 'group_id' => $this->id ), $fname ); + } // Factories /** @@ -114,27 +168,31 @@ class Group { global $wgMemc, $wgDBname; $fname = 'Group::newFromId'; + $staticGroups =& Group::getStaticGroups(); + if ( $staticGroups ) { + if ( array_key_exists( $id, $staticGroups ) ) { + return $staticGroups[$id]; + } else { + return null; + } + } + $key = "$wgDBname:groups:id:$id"; if( $group = $wgMemc->get( $key ) ) { wfDebug( "$fname loaded group $id from cache\n" ); return $group; } - $g = new Group(); - $name = $g->nameFromId(IntVal($id)); + $group = new Group(); + $group->id = $id; + $group->loadFromDatabase(); - if($name == '') { + if ( !$group->id ) { wfDebug( "$fname can't find group $id\n" ); return null; } else { - $group = $g->newFromName($name); - if( $group ) { - wfDebug( "$fname caching group $id (name $name)\n" ); - $group->loadFromDatabase(); - $wgMemc->add( $key, $group, 3600 ); - } else { - wfDebug( "$fname failed to laod group id $d (name $name)\n" ); - } + wfDebug( "$fname caching group $id (name {$group->name})\n" ); + $wgMemc->add( $key, $group, 3600 ); return $group; } } @@ -144,30 +202,77 @@ class Group { function newFromName($name) { $fname = 'Group::newFromName'; $g = new Group(); - - $g->setId( $g->idFromName($name) ); + $g->name = $name; + $g->loadFromDatabase(); + if( $g->getId() != 0 ) { return $g; } else { - return; + return null; } } + /** + * Get an array of Group objects, one for each valid group + * + * @static + */ + function &getAllGroups() { + $staticGroups =& Group::getStaticGroups(); + if ( $staticGroups ) { + return $staticGroups; + } + + $fname = 'Group::getAllGroups'; + wfProfileIn( $fname ); + + $dbr =& wfGetDB( DB_SLAVE ); + $groupTable = $dbr->tableName( 'group' ); + $sql = "SELECT group_id, group_name, group_description, group_rights FROM $groupTable"; + $res = $dbr->query($sql, $fname); + + $groups = array(); + + while($row = $dbr->fetchObject( $res ) ) { + $group = new Group; + $group->loadFromRow( $row ); + $groups[$row->group_id] = $group; + } + + wfProfileOut( $fname ); + return $groups; + } + + /** + * Get static groups, if they have been defined in LocalSettings.php + * + * @static + */ + function &getStaticGroups() { + global $wgStaticGroups; + if ( $wgStaticGroups === false ) { + return $wgStaticGroups; + } + + if ( !is_array( $wgStaticGroups ) ) { + $wgStaticGroups = unserialize( $wgStaticGroups ); + } + + return $wgStaticGroups; + } + + // Converters /** * @param integer $id Group database id * @return string Group database name */ function nameFromId($id) { - $fname = 'Group::nameFromId'; - $dbr =& wfGetDB( DB_SLAVE ); - $r = $dbr->selectRow( 'group', array( 'group_name' ), array( 'group_id' => $id ), $fname ); - if ($dbr == null) - return; - if($r === false) { + $group = Group::newFromId( $id ); + if ( is_null( $group ) ) { return ''; } else { - return $r->group_name; + return $group->getName(); } } @@ -177,6 +282,18 @@ class Group { */ function idFromName($name) { $fname = 'Group::idFromName'; + + $staticGroups =& Group::getStaticGroups(); + if ( $staticGroups ) { + foreach( $staticGroups as $id => $group ) { + if ( $group->getName() === $name ) { + return $group->getID(); + } + } + return 0; + } + + $dbr =& wfGetDB( DB_SLAVE ); $r = $dbr->selectRow( 'group', array( 'group_id' ), array( 'group_name' => $name ), $fname ); @@ -191,7 +308,18 @@ class Group { function getName() { $this->loadFromDatabase(); return $this->name; - } + } + + function getExpandedName() { + $this->loadFromDatabase(); + return $this->getMessage( $this->name ); + } + + function getNameForContent() { + $this->loadFromDatabase(); + return $this->getMessageForContent( $this->name ); + } + function setName($name) { $this->loadFromDatabase(); $this->name = $name; @@ -201,9 +329,16 @@ class Group { function setId($id) { $this->id = IntVal($id); $this->dataLoaded = false; - } + } - function getDescription() { return $this->description; } + function getDescription() { + return $this->description; + } + + function getExpandedDescription() { + return $this->getMessage( $this->description ); + } + function setDescription($desc) { $this->loadFromDatabase(); $this->description = $desc; @@ -214,5 +349,28 @@ class Group { $this->loadFromDatabase(); $this->rights = $rights; } + + /** + * Gets a message if the text starts with a colon, otherwise returns the text itself + */ + function getMessage( $text ) { + if ( strlen( $text ) && $text{0} == ':' ) { + return wfMsg( substr( $text, 1 ) ); + } else { + return $text; + } + } + + /** + * As for getMessage but for content + */ + function getMessageForContent( $text ) { + if ( strlen( $text ) && $text{0} == ':' ) { + return wfMsgForContent( substr( $text, 1 ) ); + } else { + return $text; + } + } + } -?> \ No newline at end of file +?> diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 3ff08b0811..54bbb81e15 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -95,34 +95,33 @@ class HTMLForm { } // end class -/** Build a select with all existent groups +// functions used by SpecialUserrights.php and SpecialGroups.php + +/** Build a select with all defined groups * @param string $selectname Name of this element. Name of form is automaticly prefixed. * @param array $selected Array of element selected when posted. Multiples will only show them. * @param boolean $multiple A multiple elements select. * @param integer $size Number of element to be shown ignored for non multiple (default 6). * @param boolean $reverse If true, multiple select will hide selected elements (default false). */ -function HTMLSelectGroups($selectname, $selected=array(), $multiple=false, $size=6, $reverse=false) { - $dbr =& wfGetDB( DB_SLAVE ); - $group = $dbr->tableName( 'group' ); - $sql = "SELECT group_id, group_name FROM $group"; - $res = $dbr->query($sql,'wfSpecialAdmin'); +function HTMLSelectGroups($selectname, $selectmsg, $selected=array(), $multiple=false, $size=6, $reverse=false) { + $groups =& Group::getAllGroups(); - $out = wfMsg($selectname); + $out = wfMsg($selectmsg); $out .= '\n"; diff --git a/includes/LogPage.php b/includes/LogPage.php index a94f9653ca..1345503ad4 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -149,6 +149,9 @@ class LogPage { 'protect/protect' => 'protectedarticle', 'protect/unprotect' => 'unprotectedarticle', 'rights/rights' => 'bureaucratlogentry', + 'rights/addgroup' => 'addgrouplogentry', + 'rights/rngroup' => 'renamegrouplogentry', + 'rights/chgroup' => 'changegrouplogentry', 'delete/delete' => 'deletedarticle', 'delete/restore' => 'undeletedarticle', 'upload/upload' => 'uploadedimage', @@ -200,8 +203,6 @@ class LogPage { * @param array $params Parameters passed later to wfMsg.* functions */ function addEntry( $action, &$target, $comment, $params = array() ) { - global $wgLang, $wgUser; - if ( !is_array( $params ) ) { $params = array( $params ); } diff --git a/includes/SpecialGroups.php b/includes/SpecialGroups.php index ce617f1af6..cf49628800 100644 --- a/includes/SpecialGroups.php +++ b/includes/SpecialGroups.php @@ -25,18 +25,41 @@ function wfSpecialGroups($par=null) { * @subpackage SpecialPage */ class GroupsForm extends HTMLForm { - var $mPosted, $mRequest, $mSaveprefs; + var $mPosted, $mRequest, $mSaveprefs, $mChangeAllowed; + var $mNewName, $mDescription, $mOldName, $mRights, $mId; + var $mAdd, $mEdit; + /** Escaped local url name*/ - var $action; + var $action, $location; /** Constructor*/ function GroupsForm ( &$request ) { + global $wgUser; + $this->mPosted = $request->wasPosted(); $this->mRequest = $request; $this->mName = 'groups'; - + + $this->mNewName = trim( $request->getText('editgroup-name') ); + $this->mOldName = trim( $request->getText('editgroup-oldname' ) ); + $this->mDescription = trim( $request->getText( 'editgroup-description' ) ); + $this->mRights = $request->getArray( 'editgroup-getrights' ); + $this->mId = $this->mRequest->getInt('id'); + $this->mEdit = $request->getCheck('edit'); + $this->mAdd = $request->getCheck('add'); + + $titleObj = Title::makeTitle( NS_SPECIAL, 'Groups' ); $this->action = $titleObj->escapeLocalURL(); + if ( $this->mAdd ) { + $this->location = $titleObj->getLocalURL( "add=1&id={$this->mId}" ); + } elseif ( $this->mEdit ) { + $this->location = $titleObj->getLocalURL( "edit=1&id={$this->mId}" ); + } else { + $this->location = $this->action; + } + + $this->mChangeAllowed = $wgUser->isAllowed( 'grouprights' ) && !Group::getStaticGroups(); } /** @@ -44,55 +67,99 @@ class GroupsForm extends HTMLForm { * Depending on the submit button used : Call a form or a saving function. */ function execute() { - // show the general form - $this->switchForm(); - if ( $this->mPosted ) { - // show some more forms - if($this->mRequest->getCheck('seditgroup')) { - $this->editGroupForm( $this->mRequest->getVal($this->mName.'-group-edit') ); } - if($this->mRequest->getCheck('saddgroup')) { - $this->editGroupForm( ); } + global $wgOut; + if ( $this->mRequest->getBool( 'showrecord' ) ) { + $this->showRecord(); + } elseif ( $this->mPosted && $this->mChangeAllowed && $this->mRequest->getCheck('savegroup') ) { // save settings - if($this->mRequest->getCheck('savegroup')) { - $this->saveGroup($this->mRequest->getVal('editgroup-name'), - $this->mRequest->getVal('editgroup-oldname'), - $this->mRequest->getVal('editgroup-description'), - $this->mRequest->getArray('editgroup-getrights')); + $this->saveGroup(); + } elseif ( $this->mEdit ) { + if ( $this->mPosted ) { + $wgOut->redirect( $this->location ); + } else { + $this->switchForm(); + $this->editGroupForm( $this->mId ); + } + } elseif ( $this->mAdd ) { + if ( $this->mPosted ) { + $wgOut->redirect( $this->location ); + } else { + $this->switchForm(); + $this->editGroupForm( ); + } + } else { + $this->showAllGroups(); + if ( $this->mChangeAllowed ) { + $this->switchForm(); } } } -// save things !! /** * Save a group - * @param string $newname Group name. - * @param string $oldname Old (current) group name. - * @param string $description Group description. - * - * @todo FIXME : doesnt validate anything. Log is incorrect. + * @todo FIXME : Log is incorrect. */ - function saveGroup($newname, $oldname, $description, $rights) { - $newame = trim($newname); + function saveGroup() { + global $wgOut; + + $this->mNewName = trim($this->mNewName); - if($oldname == '') { - // We create a new group + if ( $this->mNewName == '' ) { + $this->editGroupForm( $this->mGroupID, 'groups-noname' ); + return false; + } + + if($this->mOldName == '') { + // Check if the group already exists + $add = true; + $g = Group::newFromName( $this->mNewName ); + if ( $g ) { + $this->editGroupForm( 0, 'groups-already-exists' ); + return; + } + + // Create a new group $g = new group(); $g->addToDatabase(); } else { - $g = Group::newFromName($oldname); + $add = false; + $g = Group::newFromName($this->mOldName); + if ( !$g ) { + $this->editGroupForm( 0, 'groups-noname' ); + return; + } } // save stuff - $g->setName($newname); - $g->setDescription($description); - if(isset($rights)) { $g->setRights( implode(',',$rights) ); } + $g->setName($this->mNewName); + $g->setDescription($this->mDescription); + if( is_array( $this->mRights ) ) { + $g->setRights( implode(',',$this->mRights) ); + } $g->save(); - + + // Make the log entry $log = new LogPage( 'rights' ); - $log->addEntry( 'rights', Title::makeTitle( NS_SPECIAL, $g->getName()) , ' '.$g->getRights() ); + $dummyTitle = Title::makeTitle( 0, '' ); + if ( $add ) { + $log->addEntry( 'addgroup', $dummyTitle, '', array( $g->getNameForContent() ) ); + } else { + if ( $this->mOldName != $this->mNewName ) { + // Abbreviated action name, must be less than 10 bytes + $log->addEntry( 'rngroup', $dummyTitle, '', array( Group::getMessageForContent( $this->mOldName ), + $g->getNameForContent() ) ); + } else { + $log->addEntry( 'chgroup', $dummyTitle, '', array( $g->getNameForContent() ) ); + } + } + // Success, go back to all groups page + $titleObj = Title::makeTitle( NS_SPECIAL, 'Groups' ); + $url = $titleObj->getLocalURL(); + + $wgOut->redirect( $url ); } /** @@ -105,9 +172,9 @@ class GroupsForm extends HTMLForm { // group selection $wgOut->addHTML( "
action\" method=\"post\">\n" ); $wgOut->addHTML( $this->fieldset( 'lookup-group', - HTMLSelectGroups($this->mName.'-group-edit', array(0 => $this->mRequest->getVal($this->mName.'-group-edit')) ) . - ' ' . - '
' + HTMLSelectGroups('id', $this->mName.'-group-edit', array(0 => $this->mRequest->getVal('id')) ) . + ' ' . + '
' )); $wgOut->addHTML( "
\n" ); } @@ -115,11 +182,17 @@ class GroupsForm extends HTMLForm { /** * Edit a group properties and rights. * @param string $groupname Name of a group to be edited. + * @param string $error message name of the error to display */ - function editGroupForm($groupID = 0) { + function editGroupForm($groupID = 0, $error = '') { global $wgOut; - if($this->mRequest->getVal('seditgroup')) { + if ( $error ) { + $errText = wfMsg( $error ); + $wgOut->addHTML( "

$errText

" ); + } + + if($this->mRequest->getVal('edit')) { // fetch data if we edit a group $g = Group::newFromID($groupID); $fieldname = 'editgroup'; @@ -134,8 +207,10 @@ class GroupsForm extends HTMLForm { $wgOut->addHTML( "
action\" method=\"post\">\n". - ''); + '\n" ); + $wgOut->addHTML( $this->fieldset( $fieldname, + '

' . wfMsg( 'groups-editgroup-preamble' ) . "

\n" . $this->textbox( 'editgroup-name', $gName ) . $this->textareabox( 'editgroup-description', $gDescription ) . '
'. @@ -146,5 +221,45 @@ class GroupsForm extends HTMLForm { $wgOut->addHTML( "\n" ); } + + function showAllGroups() { + global $wgOut; + $groups =& Group::getAllGroups(); + + $groupsExisting = wfMsg( 'groups-existing' ); + $groupsHeader = wfMsg( 'groups-tableheader' ); + + $s = "{| border=1 +|+'''$groupsExisting''' +|- +!$groupsHeader +"; + foreach ( $groups as $group ) { + $s .= "|-\n| " . $group->getId() . ' || ' . + $group->getExpandedName() . ' || ' . + $group->getExpandedDescription() . ' || '. + // Insert spaces to make it wrap + str_replace( ',', ', ', $group->getRights() ) . "\n"; + } + $s .= "|}\n"; + $wgOut->addWikiText( $s ); + } + + function showRecord() { + global $wgOut; + + $groups =& Group::getAllGroups(); + $rec = serialize( $groups ); + // Escape it for PHP + $rec = str_replace( array( '\\', "'" ), array( '\\\\', "\\'" ), $rec ); + // Escape it for HTML + $rec = htmlspecialchars( $rec ); + $s = "

Copy the following into LocalSettings.php:

\n" . + ""; + $wgOut->addHTML( $s ); + } + } // end class GroupsForm ?> diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 05aabb69db..7c2cb87031 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -78,7 +78,7 @@ $wgSpecialPages = array( 'Unlockdb' => new SpecialPage( 'Unlockdb', 'siteadmin' ), # 'Sitesettings' => new SpecialPage( 'Sitesettings', 'siteadmin' ), 'Userrights' => new SpecialPage( 'Userrights', 'userrights' ), - 'Groups' => new SpecialPage( 'Groups', 'grouprights' ), + 'Groups' => new SpecialPage( 'Groups' ), ); global $wgUseValidation ; diff --git a/includes/SpecialUserrights.php b/includes/SpecialUserrights.php index 5e96460732..c04c3e974d 100644 --- a/includes/SpecialUserrights.php +++ b/includes/SpecialUserrights.php @@ -56,8 +56,8 @@ class UserrightsForm extends HTMLForm { // save settings if($this->mRequest->getCheck('saveusergroups')) { $this->saveUserGroups($this->mRequest->getVal('user-editname'), - $this->mRequest->getArray($this->mName.'-groupsmember'), - $this->mRequest->getArray($this->mName.'-groupsavailable')); + $this->mRequest->getArray('member'), + $this->mRequest->getArray('available')); } } } @@ -146,9 +146,9 @@ class UserrightsForm extends HTMLForm { $wgOut->addHTML( $this->fieldset( 'editusergroup', wfMsg('editing', $this->mRequest->getVal('user-editname')).".
\n" . '
'. - HTMLSelectGroups($this->mName.'-groupsmember', $groups,true,6). + HTMLSelectGroups('member', $this->mName.'-groupsmember', $groups,true,6). ''. - HTMLSelectGroups($this->mName.'-groupsavailable', $groups,true,6,true). + HTMLSelectGroups('available', $this->mName.'-groupsavailable', $groups,true,6,true). '
'."\n". '

'.wfMsg('userrights-groupshelp').'

'."\n". '' diff --git a/includes/User.php b/includes/User.php index 69a8fae71a..35cfca3926 100644 --- a/includes/User.php +++ b/includes/User.php @@ -806,10 +806,6 @@ class User { */ function isBot() { $this->loadFromDatabase(); - - # Why was this here? I need a UID=0 conversion script [TS] - # if ( 0 == $this->mId ) { return false; } - return in_array( 'bot', $this->mRights ); } diff --git a/languages/Language.php b/languages/Language.php index 3417b99dcd..e1f5947d36 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -900,11 +900,21 @@ See [[Project:User preferences help]] for help deciphering the options.", 'editusergroup' => 'Edit User Groups', # group editing -'groups-editgroup' => 'Edit group', -'groups-addgroup' => 'Add group', -'groups-editgroup-name' => 'Group name: ', +'groups-editgroup' => 'Edit group', +'groups-addgroup' => 'Add group', +'groups-editgroup-preamble' => 'If the name or description starts with a colon, the +remainder will be treated as a message name, and hence the text will be localised +using the MediaWiki namespace', +'groups-editgroup-name' => 'Group name: ', 'groups-editgroup-description' => 'Group description (max 255 characters):
', -'savegroup' => 'Save Group', +'savegroup' => 'Save Group', +'groups-tableheader' => 'ID || Name || Description || Rights', +'groups-existing' => 'Existing groups', +'groups-noname' => 'Please specify a valid group name', +'groups-already-exists' => 'A group of that name already exists', +'addgrouplogentry' => 'Added group $2', +'changegrouplogentry' => 'Changed group $2', +'renamegrouplogentry' => 'Renamed group $2 to $3', # user groups editing # @@ -915,6 +925,20 @@ See [[Project:User preferences help]] for help deciphering the options.", 'userrights-groupshelp' => 'Select groups you want the user to be removed from or added to. Unselected groups will not be changed. You can deselect a group with CTRL + Left Click', +# Default group names and descriptions +# +'group-anon-name' => 'Anonymous', +'group-anon-desc' => 'Anonymous users', +'group-loggedin-name' => 'Logged in', +'group-loggedin-desc' => 'General logged in users', +'group-admin-name' => 'Administrator', +'group-admin-desc' => 'Trusted users able to block users and delete articles', +'group-bureaucrat-name' => 'Bureaucrat', +'group-bureaucrat-desc' => 'The bureaucrat group is able to make sysops', +'group-steward-name' => 'Steward', +'group-steward-desc' => 'Full access', + + # Recent changes # 'changes' => 'changes', diff --git a/maintenance/archives/patch-userlevels-defaultgroups.sql b/maintenance/archives/patch-userlevels-defaultgroups.sql index c4edb8eada..ef1ef68c0d 100644 --- a/maintenance/archives/patch-userlevels-defaultgroups.sql +++ b/maintenance/archives/patch-userlevels-defaultgroups.sql @@ -5,26 +5,26 @@ INSERT INTO /*$wgDBprefix*/`group` (group_id,group_name,group_description,group_rights) VALUES ( - 1,'Anonymous','Anonymous users', + 1,':group-anon-name',':group-anon-desc', 'read,edit,createaccount' ); INSERT INTO /*$wgDBprefix*/`group` (group_id,group_name,group_description,group_rights) VALUES ( - 2,'Logged in','General logged in users', + 2,':group-loggedin-name',':group-loggedin-desc', 'read,edit,move,upload,validate,createaccount' ); INSERT INTO /*$wgDBprefix*/`group` (group_id,group_name,group_description,group_rights) VALUES ( - 3,'Administrator','Trusted users able to block users and delete articles', + 3,':group-admin-name',':group-loggedin-desc', 'read,edit,move,upload,validate,createaccount,delete,undelete,protect,block,upload,asksql,rollback,patrol,editinterface,import,sysop' ); INSERT INTO /*$wgDBprefix*/`group` (group_id,group_name,group_description,group_rights) VALUES ( - 4,'Bureaucrat','The bureaucrat group is able to make sysops. They have no other rights.', + 4,':group-bureaucrat-name',':group-bureaucrat-desc', 'read,edit,move,upload,validate,createaccount,delete,undelete,protect,block,upload,asksql,rollback,patrol,editinterface,import,sysop,makesysop' ); INSERT INTO /*$wgDBprefix*/`group` (group_id,group_name,group_description,group_rights) VALUES ( - 5,'Steward','Full access', + 5,':group-steward-name',':group-steward-desc', 'read,edit,move,upload,validate,createaccount,delete,undelete,protect,block,upload,asksql,rollback,patrol,editinterface,import,sysop,makesysop,userrights,grouprights,siteadmin' ); -- 2.20.1