Merge "Align search result CSS with Wikimedia UI color palette"
[lhc/web/wiklou.git] / includes / installer / DatabaseUpdater.php
index 6f066ce..6a8a99f 100644 (file)
@@ -32,8 +32,6 @@ require_once __DIR__ . '/../../maintenance/Maintenance.php';
  * @since 1.17
  */
 abstract class DatabaseUpdater {
-       protected static $updateCounter = 0;
-
        /**
         * Array of updates to perform on the database
         *
@@ -222,12 +220,11 @@ abstract class DatabaseUpdater {
         *
         * @since 1.17
         *
-        * @param array $update The update to run. Format is the following:
-        *                first item is the callback function, it also can be a
-        *                simple string with the name of a function in this class,
-        *                following elements are parameters to the function.
-        *                Note that callback functions will receive this object as
-        *                first parameter.
+        * @param array $update The update to run. Format is [ $callback, $params... ]
+        *   $callback is the method to call; either a DatabaseUpdater method name or a callable.
+        *   Must be serializable (ie. no anonymous functions allowed). The rest of the parameters
+        *   (if any) will be passed to the callback. The first parameter passed to the callback
+        *   is always this object.
         */
        public function addExtensionUpdate( array $update ) {
                $this->extensionUpdates[] = $update;
@@ -424,8 +421,6 @@ abstract class DatabaseUpdater {
         * @param array $what What updates to perform
         */
        public function doUpdates( $what = [ 'core', 'extensions', 'stats' ] ) {
-               global $wgVersion;
-
                $this->db->setSchemaVars( $this->getSchemaVars() );
 
                $what = array_flip( $what );
@@ -442,12 +437,9 @@ abstract class DatabaseUpdater {
                        $this->checkStats();
                }
 
-               $this->setAppliedUpdates( $wgVersion, $this->updates );
-
                if ( $this->fileHandle ) {
                        $this->skipSchema = false;
                        $this->writeSchemaUpdateFile();
-                       $this->setAppliedUpdates( "$wgVersion-schema", $this->updatesSkipped );
                }
        }
 
@@ -483,23 +475,6 @@ abstract class DatabaseUpdater {
                $this->updates = array_merge( $this->updates, $updatesDone );
        }
 
-       /**
-        * @param string $version
-        * @param array $updates
-        */
-       protected function setAppliedUpdates( $version, $updates = [] ) {
-               $this->db->clearFlag( DBO_DDLMODE );
-               if ( !$this->canUseNewUpdatelog() ) {
-                       return;
-               }
-               $key = "updatelist-$version-" . time() . self::$updateCounter;
-               self::$updateCounter++;
-               $this->db->insert( 'updatelog',
-                       [ 'ul_key' => $key, 'ul_value' => serialize( $updates ) ],
-                       __METHOD__ );
-               $this->db->setFlag( DBO_DDLMODE );
-       }
-
        /**
         * Helper function: check if the given key is present in the updatelog table.
         * Obviously, only use this for updates that occur after the updatelog table was