$this->database = $database;
$this->name = $name;
$this->id = intval( $id );
- $this->newOptions = array();
+ $this->newOptions = [];
}
/**
if ( $db && $userdb ) {
$row = $userdb->selectRow( 'user',
- array( 'user_id', 'user_name' ),
- array( $field => $value ),
+ [ 'user_id', 'user_name' ],
+ [ $field => $value ],
__METHOD__ );
if ( $row !== false ) {
// Hmm... this shouldn't happen though. :)
return wfGetDB( DB_MASTER );
} else {
- return wfGetDB( DB_MASTER, array(), $database );
+ return wfGetDB( DB_MASTER, [], $database );
}
}
return null;
*/
function getGroups() {
$res = $this->db->select( 'user_groups',
- array( 'ug_group' ),
- array( 'ug_user' => $this->id ),
+ [ 'ug_group' ],
+ [ 'ug_user' => $this->id ],
__METHOD__ );
- $groups = array();
+ $groups = [];
foreach ( $res as $row ) {
$groups[] = $row->ug_group;
}
*/
function addGroup( $group ) {
$this->db->insert( 'user_groups',
- array(
+ [
'ug_user' => $this->id,
'ug_group' => $group,
- ),
+ ],
__METHOD__,
- array( 'IGNORE' ) );
+ [ 'IGNORE' ] );
return true;
}
*/
function removeGroup( $group ) {
$this->db->delete( 'user_groups',
- array(
+ [
'ug_user' => $this->id,
'ug_group' => $group,
- ),
+ ],
__METHOD__ );
return true;
}
public function saveSettings() {
- $rows = array();
+ $rows = [];
foreach ( $this->newOptions as $option => $value ) {
- $rows[] = array(
+ $rows[] = [
'up_user' => $this->id,
'up_property' => $option,
'up_value' => $value,
- );
+ ];
}
$this->db->replace( 'user_properties',
- array( array( 'up_user', 'up_property' ) ),
+ [ [ 'up_user', 'up_property' ] ],
$rows, __METHOD__
);
$this->invalidateCache();
*/
function invalidateCache() {
$this->db->update( 'user',
- array( 'user_touched' => $this->db->timestamp() ),
- array( 'user_id' => $this->id ),
+ [ 'user_touched' => $this->db->timestamp() ],
+ [ 'user_id' => $this->id ],
__METHOD__ );
$wikiId = $this->db->getWikiID();