Merge "Change 1.26 to 1.27, mostly in doc comments"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 10 Oct 2015 17:01:23 +0000 (17:01 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 10 Oct 2015 17:01:23 +0000 (17:01 +0000)
1  2 
includes/deferred/DeferredUpdates.php

@@@ -44,7 -44,7 +44,7 @@@ interface DeferrableUpdate 
   * @since 1.19
   */
  class DeferredUpdates {
 -      /** @var array Updates to be deferred until the end of the request */
 +      /** @var DeferrableUpdate[] Updates to be deferred until the end of the request */
        private static $updates = array();
        /** @var bool Defer updates fully even in CLI mode */
        private static $forceDeferral = false;
         * Do any deferred updates and clear the list
         *
         * @param string $commit Set to 'commit' to commit after every update to
 +       * @param string $mode Use "enqueue" to use the job queue when possible [Default: run]
         *   prevent lock contention
         */
 -      public static function doUpdates( $commit = '' ) {
 +      public static function doUpdates( $commit = '', $mode = 'run' ) {
                $updates = self::$updates;
  
                while ( count( $updates ) ) {
                        self::clearPendingUpdates();
 -
 -                      /** @var DeferrableUpdate $update */
 +                      /** @var DataUpdate[] $dataUpdates */
 +                      $dataUpdates = array();
 +                      /** @var DeferrableUpdate[] $otherUpdates */
 +                      $otherUpdates = array();
                        foreach ( $updates as $update ) {
 +                              if ( $update instanceof DataUpdate ) {
 +                                      $dataUpdates[] = $update;
 +                              } else {
 +                                      $otherUpdates[] = $update;
 +                              }
 +                      }
 +
 +                      // Delegate DataUpdate execution to the DataUpdate class
 +                      DataUpdate::runUpdates( $dataUpdates, $mode );
 +                      // Execute the non-DataUpdate tasks
 +                      foreach ( $otherUpdates as $update ) {
                                try {
                                        $update->doUpdate();
 -
                                        if ( $commit === 'commit' ) {
                                                wfGetLBFactory()->commitMasterChanges();
                                        }
        /**
         * @note This method is intended for testing purposes
         * @param bool $value Whether to *always* defer updates, even in CLI mode
-        * @since 1.26
+        * @since 1.27
         */
        public static function forceDeferral( $value ) {
                self::$forceDeferral = $value;