# Confusingly, 'Non_unique' is 0 for *unique* indexes,
# and 1 for *non-unique* indexes. Pass the crack, MySQL,
# it's obviously some good stuff!
- return ( $info->Non_unique == 0 );
+ return ( $info[0]->Non_unique == 0 );
}
/**
* @return bool
*/
function checkDupes( $doDelete = false ) {
- global $wgDBname;
-
if( $this->hasUniqueIndex() ) {
- echo "$wgDBname already has a unique index on its user table.\n";
+ echo wfWikiID()." already has a unique index on its user table.\n";
return true;
}
$dupes = $this->getDupes();
$count = count( $dupes );
- echo "Found $count accounts with duplicate records on $wgDBname.\n";
+ echo "Found $count accounts with duplicate records on ".wfWikiID().".\n";
$this->trimmed = 0;
$this->reassigned = 0;
$this->failed = 0;
if( $this->trimmed > 0 ) {
if( $doDelete ) {
- echo "$this->trimmed duplicate user records were deleted from $wgDBname.\n";
+ echo "$this->trimmed duplicate user records were deleted from ".wfWikiID().".\n";
} else {
- echo "$this->trimmed duplicate user accounts were found on $wgDBname which can be removed safely.\n";
+ echo "$this->trimmed duplicate user accounts were found on ".wfWikiID()." which can be removed safely.\n";
}
}
$names = array_map( array( $this, 'lockTable' ), $set );
$tables = implode( ',', $names );
- $result = $this->db->query( "LOCK TABLES $tables", $fname );
+ $this->db->query( "LOCK TABLES $tables", $fname );
}
function lockTable( $table ) {
*/
function unlock() {
$fname = 'UserDupes::unlock';
- $result = $this->db->query( "UNLOCK TABLES", $fname );
+ $this->db->query( "UNLOCK TABLES", $fname );
}
/**
function reassignEditsOn( $table, $field, $from, $to ) {
$fname = 'UserDupes::reassignEditsOn';
echo "reassigning on $table... ";
- $result = $this->db->update( $table,
+ $this->db->update( $table,
array( $field => $to ),
array( $field => $from ),
$fname );
}
-?>
\ No newline at end of file
+?>