Make DeferredUpdates::execute() protected
authorAaron Schulz <aschulz@wikimedia.org>
Sun, 11 Sep 2016 12:19:57 +0000 (05:19 -0700)
committerKrinkle <krinklemail@gmail.com>
Tue, 13 Sep 2016 04:11:24 +0000 (04:11 +0000)
Update the only caller, which is a deprecated wrapper method.
Locking down this internal method makes it secure against
misuse with regards to recursion checks.

Change-Id: I3ed52dbe4c0ad52c7b5de92e81bfdc98a1737bcf

includes/deferred/DataUpdate.php
includes/deferred/DeferredUpdates.php

index 8d26460..d2d8bd7 100644 (file)
@@ -45,11 +45,12 @@ abstract class DataUpdate implements DeferrableUpdate {
         * Convenience method, calls doUpdate() on every DataUpdate in the array.
         *
         * @param DataUpdate[] $updates A list of DataUpdate instances
-        * @param string $mode Use "enqueue" to use the job queue when possible [Default: run]
         * @throws Exception
         * @deprecated Since 1.28 Use DeferredUpdates::execute()
         */
-       public static function runUpdates( array $updates, $mode = 'run' ) {
-               DeferredUpdates::execute( $updates, $mode, DeferredUpdates::ALL );
+       public static function runUpdates( array $updates ) {
+               foreach ( $updates as $update ) {
+                       $update->doUpdate();
+               }
        }
 }
index 2b2b2b7..6921b66 100644 (file)
@@ -146,13 +146,15 @@ class DeferredUpdates {
        }
 
        /**
+        * Immediately run/queue a list of updates
+        *
         * @param DeferrableUpdate[] &$queue List of DeferrableUpdate objects
         * @param string $mode Use "enqueue" to use the job queue when possible
         * @param integer $stage Class constant (PRESEND, POSTSEND) (since 1.28)
         * @throws ErrorPageError Happens on top-level calls
         * @throws Exception Happens on second-level calls
         */
-       public static function execute( array &$queue, $mode, $stage ) {
+       protected static function execute( array &$queue, $mode, $stage ) {
                $services = MediaWikiServices::getInstance();
                $stats = $services->getStatsdDataFactory();
                $lbFactory = $services->getDBLoadBalancerFactory();