@@ 21-29 (lines=9) @@ | ||
18 | * @param callable $callback |
|
19 | * @see IDatabase::doAtomicSection() |
|
20 | */ |
|
21 | public function __construct( IDatabase $dbw, $fname, callable $callback ) { |
|
22 | $this->dbw = $dbw; |
|
23 | $this->fname = $fname; |
|
24 | $this->callback = $callback; |
|
25 | ||
26 | if ( $this->dbw->trxLevel() ) { |
|
27 | $this->dbw->onTransactionResolution( [ $this, 'cancelOnRollback' ], $fname ); |
|
28 | } |
|
29 | } |
|
30 | ||
31 | public function doUpdate() { |
|
32 | if ( $this->callback ) { |
@@ 20-28 (lines=9) @@ | ||
17 | * @param string $fname Caller name (usually __METHOD__) |
|
18 | * @param callable $callback Callback that takes (IDatabase, method name string) |
|
19 | */ |
|
20 | public function __construct( IDatabase $dbw, $fname, callable $callback ) { |
|
21 | $this->dbw = $dbw; |
|
22 | $this->fname = $fname; |
|
23 | $this->callback = $callback; |
|
24 | ||
25 | if ( $this->dbw->trxLevel() ) { |
|
26 | $this->dbw->onTransactionResolution( [ $this, 'cancelOnRollback' ], $fname ); |
|
27 | } |
|
28 | } |
|
29 | ||
30 | public function doUpdate() { |
|
31 | if ( !$this->callback ) { |