+ function UserDupes( &$database ) {
+ $this->db =& $database;
+ }
+
+ /**
+ * Check if this database's user table has already had a unique
+ * user_name index applied.
+ * @return bool
+ */
+ function hasUniqueIndex() {
+ $fname = 'UserDupes::hasUniqueIndex';
+ #if( $wgDatabase->indexExists( 'image', 'PRIMARY' ) ) {
+ $info = $this->db->indexInfo( 'user', 'user_name', $fname );
+ if( !$info ) {
+ echo "WARNING: doesn't seem to have user_name index at all!\n";
+ return false;
+ }
+
+ # 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 );
+ }
+