Make SVGMetadataExtractor less noisy when it reads SVGs from Adobe Illustrator.
[lhc/web/wiklou.git] / includes / db / CloneDatabase.php
index f3d413b..5410d14 100644 (file)
@@ -85,22 +85,30 @@ class CloneDatabase {
         * Clone the table structure
         */
        public function cloneTableStructure() {
+               
                foreach( $this->tablesToClone as $tbl ) {
                        # Clean up from previous aborted run.  So that table escaping
                        # works correctly across DB engines, we need to change the pre-
                        # fix back and forth so tableName() works right.
-                       $this->changePrefix( $this->oldTablePrefix );
+                       
+                       self::changePrefix( $this->oldTablePrefix );
                        $oldTableName = $this->db->tableName( $tbl );
-                       $this->changePrefix( $this->newTablePrefix );
+                       
+                       self::changePrefix( $this->newTablePrefix );
                        $newTableName = $this->db->tableName( $tbl );
-
-                       if( $this->dropCurrentTables && !in_array( $this->db->getType(), array( 'postgres') ) ) {
-                               $this->db->dropTable( $newTableName, __METHOD__ );
+                       
+                       if( $this->dropCurrentTables && !in_array( $this->db->getType(), array( 'postgres' ) ) ) {
+                               $this->db->dropTable( $tbl, __METHOD__ );
+                               wfDebug( "Dropping {$this->newTablePrefix}{$oldTableName}\n", __METHOD__ );
+                               //Dropping the oldTable because the prefix was changed
                        }
 
                        # Create new table
+                       wfDebug( "Duplicating $oldTableName to $newTableName\n", __METHOD__ );
                        $this->db->duplicateTableStructure( $oldTableName, $newTableName, $this->useTemporaryTables );
+                       
                }
+               
        }
 
        /**
@@ -109,12 +117,12 @@ class CloneDatabase {
         */
        public function destroy( $dropTables = false ) {
                if( $dropTables ) {
-                       $this->changePrefix( $this->newTablePrefix );
+                       self::changePrefix( $this->newTablePrefix );
                        foreach( $this->tablesToClone as $tbl ) {
                                $this->db->dropTable( $tbl );
                        }
                }
-               $this->changePrefix( $this->oldTablePrefix );
+               self::changePrefix( $this->oldTablePrefix );
        }
 
        /**
@@ -123,19 +131,19 @@ class CloneDatabase {
         * @param  $prefix
         * @return void
         */
-       protected function changePrefix( $prefix ) {
+       public static function changePrefix( $prefix ) {
                global $wgDBprefix;
-               wfGetLBFactory()->forEachLB( array( $this, 'changeLBPrefix' ), array( $prefix ) );
+               wfGetLBFactory()->forEachLB( array( 'CloneDatabase', 'changeLBPrefix' ), array( $prefix ) );
                $wgDBprefix = $prefix;
        }
 
        /**
-        * @param  $lb
+        * @param  $lb LoadBalancer
         * @param  $prefix
         * @return void
         */
-       public function changeLBPrefix( $lb, $prefix ) {
-               $lb->forEachOpenConnection( array( $this, 'changeDBPrefix' ), array( $prefix ) );
+       public static function changeLBPrefix( $lb, $prefix ) {
+               $lb->forEachOpenConnection( array( 'CloneDatabase', 'changeDBPrefix' ), array( $prefix ) );
        }
 
        /**
@@ -143,7 +151,7 @@ class CloneDatabase {
         * @param  $prefix
         * @return void
         */
-       public function changeDBPrefix( $db, $prefix ) {
+       public static function changeDBPrefix( $db, $prefix ) {
                $db->tablePrefix( $prefix );
        }
 }