From: Aaron Schulz Date: Sun, 11 Sep 2016 12:19:57 +0000 (-0700) Subject: Make DeferredUpdates::execute() protected X-Git-Tag: 1.31.0-rc.0~5630 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=148f7bf0d1e20f395891eb58cb506ef37d752eaf;p=lhc%2Fweb%2Fwiklou.git Make DeferredUpdates::execute() protected 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 --- diff --git a/includes/deferred/DataUpdate.php b/includes/deferred/DataUpdate.php index 8d26460c9a..d2d8bd7a31 100644 --- a/includes/deferred/DataUpdate.php +++ b/includes/deferred/DataUpdate.php @@ -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(); + } } } diff --git a/includes/deferred/DeferredUpdates.php b/includes/deferred/DeferredUpdates.php index 2b2b2b784e..6921b668ba 100644 --- a/includes/deferred/DeferredUpdates.php +++ b/includes/deferred/DeferredUpdates.php @@ -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();