Follow-up to r51279
[lhc/web/wiklou.git] / maintenance / renamewiki.php
index 6a0cb58..66de326 100644 (file)
@@ -1,11 +1,14 @@
 <?php
-require_once( "commandLine.inc" );
-
 /**
  * Why yes, this *is* another special-purpose Wikimedia maintenance script!
  * Should be fixed up and generalized.
+ *
+ * @file
+ * @ingroup Maintenance
  */
 
+require_once( "commandLine.inc" );
+
 if ( count( $args ) != 2 ) {
        wfDie( "Rename external storage dbs and leave a new one...\n" .
                        "Usage: php renamewiki.php <olddb> <newdb>\n" );
@@ -18,6 +21,8 @@ echo "Sleeping 5 seconds...";
 sleep(5);
 echo "\n";
 
+$maintenance = "$IP/maintenance";
+
 # Initialise external storage
 if ( is_array( $wgDefaultExternalStore ) ) {
        $stores = $wgDefaultExternalStore;
@@ -47,7 +52,7 @@ if ( count( $stores ) ) {
                $extdb->query( "SET table_type=InnoDB" );
                $extdb->query( "CREATE DATABASE {$to}" );
                $extdb->query( "ALTER TABLE {$from}.blobs RENAME TO {$to}.blobs" );
-               $extdb->selectDB( $to );
+               $extdb->selectDB( $from );
                dbsource( "$maintenance/storage/blobs.sql", $extdb );
                $extdb->immediateCommit();
        }
@@ -55,4 +60,3 @@ if ( count( $stores ) ) {
 
 echo "done.\n";
 
-?>
\ No newline at end of file