Remove ur_user index. We can just use the user_namespace to load all blocked namespac...
[lhc/web/wiklou.git] / maintenance / archives / upgradeWatchlist.php
index 31aee3a..9788aa5 100644 (file)
@@ -1,9 +1,22 @@
-<?
+<?php
+/**
+ * @file
+ * @deprecated
+ * @ingroup MaintenanceArchive
+ */
+
+/** */
+print "This script is obsolete!";
+print "It is retained in the source here in case some of its
+code might be useful for ad-hoc conversion tasks, but it is
+not maintained and probably won't even work as is.";
+exit();
+
 # Convert watchlists to new format
 
 global $IP;
-include_once( "../LocalSettings.php" );
-include_once( "$IP/Setup.php" );
+require_once( "../LocalSettings.php" );
+require_once( "$IP/Setup.php" );
 
 $wgTitle = Title::newFromText( "Rebuild links script" );
 set_time_limit(0);
@@ -12,19 +25,19 @@ $wgDBuser                   = "wikiadmin";
 $wgDBpassword          = $wgDBadminpassword;
 
 $sql = "DROP TABLE IF EXISTS watchlist";
-wfQuery( $sql, DB_WRITE );
+wfQuery( $sql, DB_MASTER );
 $sql = "CREATE TABLE watchlist (
   wl_user int(5) unsigned NOT NULL,
   wl_page int(8) unsigned NOT NULL,
   UNIQUE KEY (wl_user, wl_page)
-) TYPE=MyISAM PACK_KEYS=1";
-wfQuery( $sql, DB_WRITE );
+) ENGINE=MyISAM PACK_KEYS=1";
+wfQuery( $sql, DB_MASTER );
 
 $lc = new LinkCache;
 
 # Now, convert!
 $sql = "SELECT user_id,user_watch FROM user";
-$res = wfQuery( $sql, DB_READ );
+$res = wfQuery( $sql, DB_SLAVE );
 $nu = wfNumRows( $res );
 $sql = "INSERT into watchlist (wl_user,wl_page) VALUES ";
 $i = $n = 0;
@@ -40,7 +53,7 @@ while( $row = wfFetchObject( $res ) ) {
 }
 echo "$n users done.\n";
 if( $i ) {
-       wfQuery( $sql, DB_WRITE );
+       wfQuery( $sql, DB_MASTER );
 }
 
 
@@ -49,6 +62,6 @@ if( $i ) {
 $sql = "ALTER TABLE watchlist
   ADD INDEX wl_user (wl_user),
   ADD INDEX wl_page (wl_page)";
-#wfQuery( $sql, DB_WRITE );
+#wfQuery( $sql, DB_MASTER );
+
 
-?>