Typo
[lhc/web/wiklou.git] / maintenance / cleanupDupes.inc
index 33c5448..bb40800 100644 (file)
 #
 # You should have received a copy of the GNU General Public License along
 # with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 # http://www.gnu.org/copyleft/gpl.html
 
 /**
  * If on the old non-unique indexes, check the cur table for duplicate
  * entries and remove them...
  *
- * @package MediaWiki
- * @subpackage Maintenance
+ * @file
+ * @ingroup Maintenance
  */
 
 function fixDupes( $fixthem = false) {
-       $dbw =& wfGetDB( DB_MASTER );
+       $dbw = wfGetDB( DB_MASTER );
        $cur = $dbw->tableName( 'cur' );
        $old = $dbw->tableName( 'old' );
        $dbw->query( "LOCK TABLES $cur WRITE, $old WRITE" );
@@ -49,12 +49,12 @@ END
                while( $row = $dbw->fetchObject( $res ) ) {
                        $ns = intval( $row->cur_namespace );
                        $title = $dbw->addQuotes( $row->cur_title );
-                       
+
                        # Get the first responding ID; that'll be the one we keep.
                        $id = $dbw->selectField( 'cur', 'cur_id', array(
                                'cur_namespace' => $row->cur_namespace,
                                'cur_title'     => $row->cur_title ) );
-                       
+
                        echo "$ns:$row->cur_title (canonical ID $id)\n";
                        if( $id != $row->id ) {
                                echo "  ** minimum ID $row->id; ";
@@ -74,7 +74,7 @@ END
                                        }
                                }
                        }
-                       
+
                        if( $fixthem ) {
                                $dbw->query( <<<END
 INSERT
@@ -113,19 +113,16 @@ END
 }
 
 function checkDupes( $fixthem = false, $indexonly = false ) {
-       global $wgDBname;
-       $dbw =& wfGetDB( DB_MASTER );
+       $dbw = wfGetDB( DB_MASTER );
        if( $dbw->indexExists( 'cur', 'name_title' ) &&
            $dbw->indexUnique( 'cur', 'name_title' ) ) {
-               echo "$wgDBname: cur table has the current unique index; no duplicate entries.\n";
+               echo wfWikiID().": cur table has the current unique index; no duplicate entries.\n";
        } elseif( $dbw->indexExists( 'cur', 'name_title_dup_prevention' ) ) {
-               echo "$wgDBname: cur table has a temporary name_title_dup_prevention unique index; no duplicate entries.\n";
+               echo wfWikiID().": cur table has a temporary name_title_dup_prevention unique index; no duplicate entries.\n";
        } else {
-               echo "$wgDBname: cur table has the old non-unique index and may have duplicate entries.\n";
+               echo wfWikiID().": cur table has the old non-unique index and may have duplicate entries.\n";
                if( !$indexonly ) {
                        fixDupes( $fixthem );
                }
        }
 }
-
-?>
\ No newline at end of file