Expose $wgMaxArticleSize in siteinfo query api
[mediawiki.git] / includes / deferred / AtomicSectionUpdate.php
bloba9921b3242f57bd535b3f84a70b94926a864b985
1 <?php
3 /**
4 * Deferrable Update for closure/callback updates via IDatabase::doAtomicSection()
5 * @since 1.27
6 */
7 class AtomicSectionUpdate implements DeferrableUpdate {
8 /** @var IDatabase */
9 private $dbw;
10 /** @var string */
11 private $fname;
12 /** @var Closure|callable */
13 private $callback;
15 /**
16 * @param IDatabase $dbw
17 * @param string $fname Caller name (usually __METHOD__)
18 * @param callable $callback
19 * @throws InvalidArgumentException
20 * @see IDatabase::doAtomicSection()
22 public function __construct( IDatabase $dbw, $fname, $callback ) {
23 $this->dbw = $dbw;
24 $this->fname = $fname;
25 if ( !is_callable( $callback ) ) {
26 throw new InvalidArgumentException( 'Not a valid callback/closure!' );
28 $this->callback = $callback;
31 public function doUpdate() {
32 $this->dbw->doAtomicSection( $this->fname, $this->callback );