no need for position:absolute
[lhc/web/wiklou.git] / maintenance / importPhase2.php
index 66c02d8..e53097b 100644 (file)
 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 # http://www.gnu.org/copyleft/gpl.html
 
+/**
+ * @todo document
+ * @deprecated
+ * @package MediaWiki
+ * @subpackage Maintenance
+ */
+
+/** */
+die( "This import script is not currently maintained.
+If you need it you'll have to modify it as necessary.\n");
+
 if ( ! is_readable( "../LocalSettings.php" ) ) {
        print "A copy of your installation's LocalSettings.php\n" .
          "must exist in the source directory.\n";
@@ -48,6 +59,11 @@ require_once( "rebuildlinks.inc" );
 require_once( "rebuildrecentchanges.inc" );
 require_once( "rebuildtextindex.inc" );
 
+/**
+ * @todo document
+ * @package MediaWiki
+ * @subpackage Maintenance
+ */
 class Phase2Importer {
        var $olddb, $titleCache;
        
@@ -88,44 +104,44 @@ class Phase2Importer {
        # MySQL copies everything over to the new database and tweaks a few things.
        function importCurData() {
                print "Clearing pages from default install, if any...\n";
-               wfQuery( "DELETE FROM cur", DB_WRITE );
+               wfQuery( "DELETE FROM cur", DB_MASTER );
                
                print "Importing current revision data...\n";
                wfQuery( "INSERT INTO cur (cur_id,cur_namespace,cur_title,cur_text,cur_comment,
                        cur_user,cur_user_text,cur_timestamp,cur_restrictions,cur_counter,
-                       cur_is_redirect,cur_minor_edit,cur_is_new,cur_random,cur_touched,inverse_timestamp)
+                       cur_is_redirect,cur_minor_edit,cur_is_new,cur_random,cur_touched)
                        SELECT cur_id,0,cur_title,cur_text,cur_comment,
                                cur_user,cur_user_text,cur_timestamp,REPLACE(cur_restrictions,'is_',''),cur_counter,
-                               cur_text like '#redirect%',cur_minor_edit,0,RAND(),NOW()+0,99999999999999-cur_timestamp
-                       FROM {$this->olddb}.cur", DB_WRITE );
+                               cur_text like '#redirect%',cur_minor_edit,0,RAND(),NOW()+0,
+                       FROM {$this->olddb}.cur", DB_MASTER );
                $n = mysql_affected_rows();
                print "$n rows imported.\n";
        }
 
        function importOldData() {
                print "Clearing old revision data from default install, if any...\n";
-               wfQuery( "DELETE FROM old", DB_WRITE );
+               wfQuery( "DELETE FROM old", DB_MASTER );
 
                print "Importing old revision data...\n";
                wfQuery( "INSERT INTO old (old_id,old_namespace,old_title,old_text,old_comment,
-                       old_user,old_user_text,old_timestamp,old_minor_edit,old_flags,inverse_timestamp)
+                       old_user,old_user_text,old_timestamp,old_minor_edit,old_flags)
                        SELECT old_id,0,old_title,old_text,old_comment,
-                               old_user,old_user_text,old_timestamp,old_minor_edit,'',99999999999999-old_timestamp
-                       FROM {$this->olddb}.old", DB_WRITE );
+                               old_user,old_user_text,old_timestamp,old_minor_edit,''
+                       FROM {$this->olddb}.old", DB_MASTER );
                $n = mysql_affected_rows();
                print "$n rows imported.\n";
        }
 
        function importUserData() {
                print "Clearing users from default install, if any...\n";
-               wfQuery( "DELETE FROM user", DB_WRITE );
+               wfQuery( "DELETE FROM user", DB_MASTER );
 
                print "Importing user data...\n";
                wfQuery( "INSERT INTO $newdb.user (user_id,user_name,user_rights,
                        user_password,user_newpassword,user_email,user_options,user_touched)
                        SELECT user_id,user_name,REPLACE(user_rights,'is_',''),
                                MD5(CONCAT(user_id,'-',MD5(user_password))),'',user_email,user_options,NOW()+0
-                       FROM {$this->olddb}.user", DB_WRITE );
+                       FROM {$this->olddb}.user", DB_MASTER );
                $n = mysql_affected_rows();
                print "$n rows imported.\n";
        }
@@ -133,10 +149,10 @@ class Phase2Importer {
        # A little less clean...
        function importWatchlists() {
                print "Clearing watchlists from default install, if any...\n";
-               wfQuery( "DELETE FROM watchlist", DB_WRITE );
+               wfQuery( "DELETE FROM watchlist", DB_MASTER );
 
                print "Importing watchlists...";
-               $res = wfQuery( "SELECT user_id,user_watch FROM {$this->olddb}.user WHERE user_watch != ''", DB_WRITE );
+               $res = wfQuery( "SELECT user_id,user_watch FROM {$this->olddb}.user WHERE user_watch != ''", DB_MASTER );
                $total = wfNumRows( $res );
                $n = 0;
                print " ($total total)\n";
@@ -151,7 +167,7 @@ class Phase2Importer {
                                } else {
                                        $ns = $title->getNamespace();
                                        $t = wfStrencode( $title->getDBkey() );
-                                       wfQuery( "INSERT INTO watchlist(wl_user,wl_namespace,wl_title) VALUES ($id,$ns,'$t')", DB_WRITE );
+                                       wfQuery( "INSERT INTO watchlist(wl_user,wl_namespace,wl_title) VALUES ($id,$ns,'$t')", DB_MASTER );
                                }
                        }
                        if( ++$n % 50 == 0 ) {
@@ -164,14 +180,14 @@ class Phase2Importer {
        function importLinkData() {
                # MUST BE CALLED BEFORE! fixCurTitles()
                print "Clearing links from default install, if any...\n";
-               wfQuery( "DELETE FROM links", DB_WRITE );
-               wfQuery( "DELETE FROM brokenlinks", DB_WRITE );
+               wfQuery( "DELETE FROM links", DB_MASTER );
+               wfQuery( "DELETE FROM brokenlinks", DB_MASTER );
 
                print "Importing live links...";
                wfQuery( "INSERT INTO links (l_from, l_to)
                                        SELECT DISTINCT linked_from,cur_id
                                        FROM {$this->olddb}.linked,{$this->olddb}.cur
-                                       WHERE linked_to=cur_title", DB_WRITE );
+                                       WHERE linked_to=cur_title", DB_MASTER );
                $n = mysql_affected_rows();
                print "$n rows imported.\n";
                
@@ -179,7 +195,7 @@ class Phase2Importer {
                wfQuery( "INSERT INTO brokenlinks (bl_from, bl_to)
                                        SELECT DISTINCT cur_id,unlinked_to
                                        FROM {$this->olddb}.unlinked,{$this->olddb}.cur
-                                       WHERE unlinked_from=cur_title", DB_WRITE );
+                                       WHERE unlinked_from=cur_title", DB_MASTER );
                $n = mysql_affected_rows();
                print "$n rows imported.\n";
        }
@@ -195,7 +211,7 @@ class Phase2Importer {
        
        function fixTitles( $table ) {
                print "Fixing titles in $table...";
-               $res = wfQuery( "SELECT DISTINCT {$table}_title AS title FROM $table", DB_WRITE );
+               $res = wfQuery( "SELECT DISTINCT {$table}_title AS title FROM $table", DB_MASTER );
                $total = wfNumRows( $res );
                $n = 0;
                print " ($total total)\n";
@@ -209,7 +225,7 @@ class Phase2Importer {
                                $ns = $title->getNamespace();
                                $t = wfStrencode( $title->getDBkey() );
                                wfQuery( "UPDATE $table SET {$table}_namespace=$ns,{$table}_title='$t'
-                                                               WHERE {$table}_namespace=0 AND {$table}_title='$xt'", DB_WRITE );
+                                                               WHERE {$table}_namespace=0 AND {$table}_title='$xt'", DB_MASTER );
                        }
                        if( ++$n % 50 == 0 ) {
                                print "$n\n";
@@ -265,7 +281,7 @@ class Phase2Importer {
                if ( "yes" == $s || "on" == $s ) { $nops["hover"] = 1; }
        
                $c = $ops["cols"];
-               if ( $c < 20 || c > 200 ) { $nops["cols"] = 80; }
+               if ( $c < 20 || $c > 200 ) { $nops["cols"] = 80; }
                else { $nops["cols"] = $c; }
                $r = $ops["rows"];
                if ( $r < 5 || $r > 100 ) { $nops["rows"] = 20; }
@@ -288,7 +304,7 @@ class Phase2Importer {
 
        function fixUserOptions() {
                print "Fixing user options...";
-               $res = wfQuery( "SELECT user_id,user_options FROM user", DB_WRITE );
+               $res = wfQuery( "SELECT user_id,user_options FROM user", DB_MASTER );
                $total = wfNumRows( $res );
                $n = 0;
                print " ($total total)\n";
@@ -296,7 +312,7 @@ class Phase2Importer {
                while( $row = wfFetchObject( $res ) ) {
                        $id = IntVal( $row->user_id );
                        $option = wfStrencode( $this->rewriteUserOptions( $row->user_options ) );
-                       wfQuery( "UPDATE user SET user_options='$option' WHERE user_id=$id LIMIT 1", DB_WRITE );
+                       wfQuery( "UPDATE user SET user_options='$option' WHERE user_id=$id LIMIT 1", DB_MASTER );
                        if( ++$n % 50 == 0 ) {
                                print "$n\n";
                        }
@@ -306,6 +322,11 @@ class Phase2Importer {
        
 }
 
+/**
+ * @todo document
+ * @package MediaWiki
+ * @subpackage Maintenance
+ */
 class TitleCache {
        var $hash = array();
        
@@ -346,4 +367,4 @@ $wgTitle = Title::newFromText( "Conversion script" );
 $importer = new Phase2Importer( $olddb );
 $importer->importAll();
 
-?>
\ No newline at end of file
+?>