(bug 42483) Avoid serializing database object in update.php
authorBrad Jorsch <bjorsch@wikimedia.org>
Mon, 3 Dec 2012 20:24:37 +0000 (15:24 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Mon, 3 Dec 2012 20:27:25 +0000 (15:27 -0500)
Change I96b4cfd4 changed the data being stored in updatelog, trying to
store the mangled parameters (which may included an added copy of the
DatabaseUpdater object itself) instead of the input parameters. This
causes warnings because database objects cannot be effectively
serialized.

Go back to storing the original input parameters instead.

Change-Id: I96e6dffed98772ebb9b812773ff2f608e7e40cb1

includes/installer/DatabaseUpdater.php

index 312b796..b200dcf 100644 (file)
@@ -321,9 +321,10 @@ abstract class DatabaseUpdater {
                foreach( $updates as $funcList ) {
                        $func = $funcList[0];
                        $arg = $funcList[1];
+                       $origParams = $funcList[2];
                        $ret = call_user_func_array( $func, $arg );
                        flush();
-                       $this->updatesSkipped[] = $arg;
+                       $this->updatesSkipped[] = $origParams;
                }
        }
 
@@ -380,6 +381,7 @@ abstract class DatabaseUpdater {
                $updatesDone = array();
                $updatesSkipped = array();
                foreach ( $updates as $params ) {
+                       $origParams = $params;
                        $func = array_shift( $params );
                        if( !is_array( $func ) && method_exists( $this, $func ) ) {
                                $func = array( $this, $func );
@@ -389,9 +391,9 @@ abstract class DatabaseUpdater {
                        $ret = call_user_func_array( $func, $params );
                        flush();
                        if( $ret !== false ) {
-                               $updatesDone[] = $params;
+                               $updatesDone[] = $origParams;
                        } else {
-                               $updatesSkipped[] = array( $func, $params );
+                               $updatesSkipped[] = array( $func, $params, $origParams );
                        }
                }
                $this->updatesSkipped = array_merge( $this->updatesSkipped, $updatesSkipped );