Porting tocToggle to ResourceLoader
[lhc/web/wiklou.git] / maintenance / upgrade1_5.php
index d26bfd6..0b2836c 100644 (file)
@@ -9,6 +9,21 @@
  * much older versions, etc.
  * Run this, FOLLOWED BY update.php, for upgrading from 1.4.5 release to 1.5.
  *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
  * @file
  * @ingroup Maintenance
  */
@@ -305,6 +320,12 @@ class FiveUpgrade extends Maintenance {
                $this->dbw->insert( $this->chunkTable, $chunk, $this->chunkFunction, $this->chunkOptions );
        }
 
+       /**
+        * Helper function for copyTable array_filter
+        */
+       static private function notUpgradeNull( $x ) {
+               return $x !== MW_UPGRADE_NULL;
+       }
 
        /**
         * Copy and transcode a table to table_temp.
@@ -334,8 +355,7 @@ class FiveUpgrade extends Maintenance {
                $this->setChunkScale( 100, $numRecords, $name_temp, __METHOD__ );
 
                // Pull all records from the second, streaming database connection.
-               $sourceFields = array_keys( array_filter( $fields,
-                       create_function( '$x', 'return $x !== MW_UPGRADE_NULL;' ) ) );
+               $sourceFields = array_keys( array_filter( $fields, 'FiveUpgrade::notUpgradeNull' ) );
                $result = $this->dbr->select( $name,
                        $sourceFields,
                        '',
@@ -617,9 +637,13 @@ CREATE TABLE $pagelinks (
                $this->log( 'Done with links.' );
        }
 
+       function userDupeCallback( $str ) {
+               echo $str;
+       }
+
        function upgradeUser() {
                // Apply unique index, if necessary:
-               $duper = new UserDupes( $this->dbw );
+               $duper = new UserDupes( $this->dbw, array( $this, 'userDupeCallback' ) );
                if ( $duper->hasUniqueIndex() ) {
                        $this->log( "Already have unique user_name index." );
                } else {