From: Stanislav Malyshev Date: Tue, 18 Oct 2016 19:33:41 +0000 (-0700) Subject: Allow BatchRowIterator to also set query options. X-Git-Tag: 1.31.0-rc.0~5081^2 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=4dfb6997e9318a25a5c441755dc4ba7af3540743;p=lhc%2Fweb%2Fwiklou.git Allow BatchRowIterator to also set query options. Change-Id: I15927c5b7f1edcfb40edd3cda9257b40d0276073 --- diff --git a/includes/utils/BatchRowIterator.php b/includes/utils/BatchRowIterator.php index 602587ce45..ef2c14a9b7 100644 --- a/includes/utils/BatchRowIterator.php +++ b/includes/utils/BatchRowIterator.php @@ -77,6 +77,11 @@ class BatchRowIterator implements RecursiveIterator { */ private $key; + /** + * @var array Additional query options + */ + protected $options = []; + /** * @param IDatabase $db The database to read from * @param string|array $table The name or names of the table to read from @@ -104,6 +109,14 @@ class BatchRowIterator implements RecursiveIterator { $this->conditions = array_merge( $this->conditions, $conditions ); } + /** + * @param array $options Query options suitable for use with + * IDatabase::select + */ + public function addOptions( array $options ) { + $this->options = array_merge( $this->options, $options ); + } + /** * @param array $conditions Query join conditions suitable for use * with IDatabase::select @@ -199,7 +212,7 @@ class BatchRowIterator implements RecursiveIterator { [ 'LIMIT' => $this->batchSize, 'ORDER BY' => $this->orderBy, - ], + ] + $this->options, $this->joinConditions );