MediaWiki
REL1_32
MWCallableUpdate.php
Go to the documentation of this file.
1
<?php
2
3
use
Wikimedia\Rdbms\IDatabase
;
4
8
class
MWCallableUpdate
implements
DeferrableUpdate
,
DeferrableCallback
{
10
private
$callback
;
12
private
$fname
;
13
20
public
function
__construct
( callable $callback,
$fname
=
'unknown'
, $dbws = [] ) {
21
$this->callback = $callback;
22
$this->fname =
$fname
;
23
24
$dbws = is_array( $dbws ) ? $dbws : [ $dbws ];
25
foreach
( $dbws as $dbw ) {
26
if
( $dbw && $dbw->trxLevel() ) {
27
$dbw->onTransactionResolution( [ $this,
'cancelOnRollback'
],
$fname
);
28
}
29
}
30
}
31
32
public
function
doUpdate
() {
33
if
( $this->callback ) {
34
call_user_func( $this->callback );
35
}
36
}
37
38
public
function
cancelOnRollback
( $trigger ) {
39
if
( $trigger === IDatabase::TRIGGER_ROLLBACK ) {
40
$this->callback =
null
;
41
}
42
}
43
44
public
function
getOrigin
() {
45
return
$this->fname
;
46
}
47
}
$fname
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
Definition
Setup.php:121
MWCallableUpdate
Deferrable Update for closure/callback.
Definition
MWCallableUpdate.php:8
MWCallableUpdate\$fname
string $fname
Definition
MWCallableUpdate.php:12
MWCallableUpdate\cancelOnRollback
cancelOnRollback( $trigger)
Definition
MWCallableUpdate.php:38
MWCallableUpdate\$callback
callable null $callback
Definition
MWCallableUpdate.php:10
MWCallableUpdate\getOrigin
getOrigin()
Definition
MWCallableUpdate.php:44
MWCallableUpdate\doUpdate
doUpdate()
Perform the actual work.
Definition
MWCallableUpdate.php:32
MWCallableUpdate\__construct
__construct(callable $callback, $fname='unknown', $dbws=[])
Definition
MWCallableUpdate.php:20
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
MWCallableUpdate.php
Generated on Mon Nov 25 2024 15:57:00 for MediaWiki by
1.10.0