MediaSearchWidget: Only resize new results
[lhc/web/wiklou.git] / includes / deferred / DeferredUpdates.php
index 05256ae..bbe8687 100644 (file)
  *
  * @file
  */
+use Wikimedia\Rdbms\IDatabase;
 use MediaWiki\MediaWikiServices;
 use Wikimedia\Rdbms\LBFactory;
+use Wikimedia\Rdbms\LoadBalancer;
 
 /**
  * Class for managing the deferred updates
@@ -335,6 +337,21 @@ class DeferredUpdates {
                return count( self::$preSendUpdates ) + count( self::$postSendUpdates );
        }
 
+       /**
+        * @param integer $stage DeferredUpdates constant (PRESEND, POSTSEND, or ALL)
+        * @since 1.29
+        */
+       public static function getPendingUpdates( $stage = self::ALL ) {
+               $updates = [];
+               if ( $stage === self::ALL || $stage === self::PRESEND ) {
+                       $updates = array_merge( $updates, self::$preSendUpdates );
+               }
+               if ( $stage === self::ALL || $stage === self::POSTSEND ) {
+                       $updates = array_merge( $updates, self::$postSendUpdates );
+               }
+               return $updates;
+       }
+
        /**
         * Clear all pending updates without performing them. Generally, you don't
         * want or need to call this. Unit tests need it though.