X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=blobdiff_plain;f=includes%2Fdeferred%2FDataUpdate.php;h=ed9a7462f78e716e98027ff035d27859f30c7c4e;hb=62d8fc872b6cfa20f57816e0a30379d4f5bd3b36;hp=8d26460c9a176709311600277507b94a230adc8a;hpb=64219ef7405b7ae95ca0b770ae53297c6f0c0a08;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/deferred/DataUpdate.php b/includes/deferred/DataUpdate.php index 8d26460c9a..ed9a7462f7 100644 --- a/includes/deferred/DataUpdate.php +++ b/includes/deferred/DataUpdate.php @@ -28,6 +28,10 @@ abstract class DataUpdate implements DeferrableUpdate { /** @var mixed Result from LBFactory::getEmptyTransactionTicket() */ protected $ticket; + /** @var string Short update cause action description */ + protected $causeAction = 'unknown'; + /** @var string Short update cause user description */ + protected $causeAgent = 'unknown'; public function __construct() { // noop @@ -41,15 +45,39 @@ abstract class DataUpdate implements DeferrableUpdate { $this->ticket = $ticket; } + /** + * @param string $action Action type + * @param string $user User name + */ + public function setCause( $action, $user ) { + $this->causeAction = $action; + $this->causeAgent = $user; + } + + /** + * @return string + */ + public function getCauseAction() { + return $this->causeAction; + } + + /** + * @return string + */ + public function getCauseAgent() { + return $this->causeAgent; + } + /** * 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(); + } } }