MediaWiki
REL1_31
AtomicSectionUpdate.php
Go to the documentation of this file.
1
<?php
2
3
use
Wikimedia\Rdbms\IDatabase
;
4
9
class
AtomicSectionUpdate
implements
DeferrableUpdate
,
DeferrableCallback
{
11
private
$dbw
;
13
private
$fname
;
15
private
$callback
;
16
23
public
function
__construct
(
IDatabase
$dbw
,
$fname
, callable
$callback
) {
24
$this->dbw =
$dbw
;
25
$this->fname =
$fname
;
26
$this->callback =
$callback
;
27
28
if
( $this->dbw->trxLevel() ) {
29
$this->dbw->onTransactionResolution( [ $this,
'cancelOnRollback'
],
$fname
);
30
}
31
}
32
33
public
function
doUpdate
() {
34
if
( $this->callback ) {
35
$this->dbw->doAtomicSection( $this->fname, $this->callback );
36
}
37
}
38
39
public
function
cancelOnRollback
( $trigger ) {
40
if
( $trigger === IDatabase::TRIGGER_ROLLBACK ) {
41
$this->callback =
null
;
42
}
43
}
44
45
public
function
getOrigin
() {
46
return
$this->fname
;
47
}
48
}
AtomicSectionUpdate
Deferrable Update for closure/callback updates via IDatabase::doAtomicSection()
Definition
AtomicSectionUpdate.php:9
AtomicSectionUpdate\$callback
callable null $callback
Definition
AtomicSectionUpdate.php:15
AtomicSectionUpdate\doUpdate
doUpdate()
Perform the actual work.
Definition
AtomicSectionUpdate.php:33
AtomicSectionUpdate\$fname
string $fname
Definition
AtomicSectionUpdate.php:13
AtomicSectionUpdate\$dbw
IDatabase $dbw
Definition
AtomicSectionUpdate.php:11
AtomicSectionUpdate\getOrigin
getOrigin()
Definition
AtomicSectionUpdate.php:45
AtomicSectionUpdate\__construct
__construct(IDatabase $dbw, $fname, callable $callback)
Definition
AtomicSectionUpdate.php:23
AtomicSectionUpdate\cancelOnRollback
cancelOnRollback( $trigger)
Definition
AtomicSectionUpdate.php:39
DeferrableCallback
Callback wrapper that has an originating method.
Definition
DeferrableCallback.php:8
DeferrableUpdate
Interface that deferrable updates should implement.
Definition
DeferrableUpdate.php:9
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition
IDatabase.php:38
includes
deferred
AtomicSectionUpdate.php
Generated on Mon Nov 25 2024 15:34:41 for MediaWiki by
1.10.0