array(10000,10000) );
-# Navigation links for the user sidebar.
-# 'text' is the name of the MediaWiki message that contains the label of this link
-# 'href' is the name of the MediaWiki message that contains the link target of this link.
-# Link targets starting with http are considered remote links. Ones not starting with
-# http are considered as names of local wiki pages.
+/** Navigation links for the user sidebar.
+ * 'text' is the name of the MediaWiki message that contains the label of this link
+ * 'href' is the name of the MediaWiki message that contains the link target of this link.
+ * Link targets starting with http are considered remote links. Ones not starting with
+ * http are considered as names of local wiki pages.
+ */
$wgNavigationLinks = array (
array( 'text'=>'mainpage', 'href'=>'mainpage' ),
array( 'text'=>'portal', 'href'=>'portal-url' ),
if( $istemplate )
$headline = $sk->editSectionScriptForOther($templatetitle, $templatesection, $headline);
else
- $headline = $sk->editSectionScript($this->title, $sectionCount+1,$headline);
+ $headline = $sk->editSectionScript($this->mTitle, $sectionCount+1,$headline);
}
# give headline the correct <h#> tag
$user = $dbr->tableName( 'user' );
$user_rights = $dbr->tableName( 'user_rights' );
$userspace = Namespace::getUser();
- return "SELECT r.user_rights as type,{$userspace} as namespace,".
- "u.user_name as title, u.user_name as value ".
- "FROM {$user} u,{$user_rights} r WHERE r.user_id=u.user_id AND r.user_rights LIKE '%sysop%'";
+ return "SELECT ur_rights as type,{$userspace} as namespace,".
+ "user_name as title, user_name as value ".
+ "FROM {$user} ,{$user_rights} WHERE user_id=ur_uid AND ur_rights LIKE '%sysop%'";
}
}
$user = $dbr->tableName( 'user' );
$user_rights = $dbr->tableName( 'user_rights' );
$userspace = Namespace::getUser();
- return "SELECT r.user_rights as type, $userspace as namespace, u.user_name as title, " .
- "u.user_name as value FROM $user u LEFT JOIN $user_rights r ON u.user_id = r.user_id";
+ return "SELECT ur_rights as type, $userspace as namespace, user_name as title, " .
+ "user_name as value FROM $user LEFT JOIN $user_rights ON user_id = ur_uid";
}
function sortDescending() {
}
if ( $username{0} == "#" ) {
$id = intval( substr( $username, 1 ) );
- $sql = "SELECT user_id,user_rights FROM $user_rights WHERE user_id=$id FOR UPDATE";
+ $sql = "SELECT ur_uid,ur_rights FROM $user_rights WHERE ur_uid=$id FOR UPDATE";
} else {
$encName = $dbw->strencode( $username );
- $sql = "SELECT u.user_id, user_rights FROM $usertable u LEFT JOIN $user_rights r ON u.user_id=r.user_id WHERE user_name = '{$username}' FOR UPDATE";
+ $sql = "SELECT ur_uid, ur_rights FROM $usertable LEFT JOIN $user_rights ON user_id=ur_uid WHERE user_name = '{$username}' FOR UPDATE";
}
$prev = $dbw->ignoreErrors( TRUE );
}
$row = $dbw->fetchObject( $res );
- $id = intval( $row->user_id );
+ $id = intval( $row->ur_uid );
$rightsNotation = array();
if ( $wgUser->isDeveloper() ) {
$newrights = (string)$this->mRights;
$rightsNotation[] = "=$this->mRights";
} else {
- if( $row->user_rights ){
- $rights = explode(",", $row->user_rights );
+ if( $row->ur_rights ){
+ $rights = explode(",", $row->ur_rights );
if(! in_array("sysop", $rights ) ){
$rights[] = "sysop";
$rightsNotation[] = "+sysop ";
} else {
#$sql = "UPDATE $user_rights SET user_rights = '{$newrights}' WHERE user_id = $id LIMIT 1";
#$dbw->query($sql);
- $dbw->replace( $user_rights, array( array( 'user_id', 'user_rights' )),
- array( 'user_id' => $id, 'user_rights' => $newrights ) , $fname );
+ $dbw->replace( $user_rights, array( array( 'ur_uid', 'ur_rights' )),
+ array( 'ur_uid' => $id, 'ur_rights' => $newrights ) , $fname );
$wgMemc->delete( "$dbName:user:id:$id" );
$log = new LogPage( 'rights' );
$row = $dbr->fetchObject( $res );
$total = $row->total;
- $sql = "SELECT COUNT(user_id) AS total FROM $user_rights WHERE user_rights LIKE '%sysop%'";
+ $sql = "SELECT COUNT(ur_uid) AS total FROM $user_rights WHERE ur_rights LIKE '%sysop%'";
$res = $dbr->query( $sql, $fname );
$row = $dbr->fetchObject( $res );
$admins = $row->total;
$this->mToken = $s->user_token;
$this->mRights = explode( ",", strtolower(
- $dbr->selectField( 'user_rights', 'user_rights', array( 'user_id' => $this->mId ) )
+ $dbr->selectField( 'user_rights', 'ur_rights', array( 'ur_uid' => $this->mId ) )
) );
// Get groups id
- $res = $dbr->select( 'user_groups', array( 'group_id' ), array( 'user_id' => $this->mId ) );
+ $res = $dbr->select( 'user_groups', array( 'ug_gid' ), array( 'ug_uid' => $this->mId ) );
while($group = $dbr->fetchRow($res)) {
$this->mGroups[] = $group[0];
}
'user_id' => $this->mId
), $fname
);
- $dbw->set( 'user_rights', 'user_rights', implode( ',', $this->mRights ),
- 'user_id='. $this->mId, $fname );
+ $dbw->set( 'user_rights', 'ur_rights', implode( ',', $this->mRights ),
+ 'ur_uid='. $this->mId, $fname );
$wgMemc->delete( "$wgDBname:user:id:$this->mId" );
// delete old groups
- $dbw->delete( 'user_groups', array( 'user_id' => $this->mId), $fname);
+ $dbw->delete( 'user_groups', array( 'ug_uid' => $this->mId), $fname);
// save new ones
foreach ($this->mGroups as $group) {
$dbw->replace( 'user_groups',
- array(array('user_id','group_id')),
+ array(array('ug_uid','ug_gid')),
array(
- 'user_id' => $this->mId,
- 'group_id' => $group
+ 'ug_uid' => $this->mId,
+ 'ug_gid' => $group
), $fname
);
}
$this->mId = $dbw->insertId();
$dbw->insert( 'user_rights',
array(
- 'user_id' => $this->mId,
- 'user_rights' => implode( ',', $this->mRights )
+ 'ur_uid' => $this->mId,
+ 'ur_rights' => implode( ',', $this->mRights )
), $fname
);
foreach ($this->mGroups as $group) {
$dbw->insert( 'user_groups',
array(
- 'user_id' => $this->mId,
- 'group_id' => $group
+ 'ug_uid' => $this->mId,
+ 'ug_gid' => $group
), $fname
);
}
--- /dev/null
+
+ALTER TABLE user_groups
+ CHANGE user_id ug_uid INT(5) UNSIGNED NOT NULL DEFAULT '0',
+ CHANGE group_id ug_gid INT(5) UNSIGNED NOT NULL DEFAULT '0';
+
+ALTER TABLE user_rights
+ CHANGE user_id ur_uid INT(5) UNSIGNED NOT NULL,
+ CHANGE user_rights ur_rights TINYBLOB NOT NULL DEFAULT '';
+
-- database but keep user rights local to the wiki.
CREATE TABLE user_rights (
- user_id int(5) unsigned NOT NULL,
- user_rights tinyblob NOT NULL default '',
+ ur_uid int(5) unsigned NOT NULL,
+ ur_rights tinyblob NOT NULL default '',
UNIQUE KEY user_id (user_id)
) PACK_KEYS=1;
-- Relation table between user and groups
CREATE TABLE user_groups (
- user_id int(5) unsigned NOT NULL default '0',
- group_id int(5) unsigned NOT NULL default '0',
- PRIMARY KEY (user_id,group_id)
+ ug_uid int(5) unsigned NOT NULL default '0',
+ ug_gid int(5) unsigned NOT NULL default '0',
+ PRIMARY KEY (ug_uid,ug_gid)
);
-- TODO: de-blob this; it should be a property table
CREATE TABLE user_rights (
- user_id int(5) unsigned NOT NULL,
- user_rights tinyblob NOT NULL default '',
+ ur_uid int(5) unsigned NOT NULL,
+ ur_rights tinyblob NOT NULL default '',
UNIQUE KEY user_id (user_id)
);
-- Relation table between user and groups
CREATE TABLE user_groups (
- user_id int(5) unsigned NOT NULL default '0',
- group_id int(5) unsigned NOT NULL default '0',
- PRIMARY KEY (user_id,group_id)
+ ug_uid int(5) unsigned NOT NULL default '0',
+ ug_gid int(5) unsigned NOT NULL default '0',
+ PRIMARY KEY (ug_uid,ug_gid)
);
array( 'recentchanges', 'rc_patrolled', 'patch-rc-patrol.sql' ),
array( 'user', 'user_real_name', 'patch-user-realname.sql' ),
array( 'user', 'user_token', 'patch-user_token.sql' ),
+ array( 'user_rights', 'ur_uid', 'patch-rename-user_groups-and_rights.sql' ),
);
function add_table( $name, $patch ) {