20 private $trxRoundRequirement = self::TRX_ROUND_PRESENT;
28 public function __construct( callable $callback, $fname =
'unknown', $dbws = [] ) {
29 $this->callback = $callback;
30 $this->fname = $fname;
32 $dbws = is_array( $dbws ) ? $dbws : [ $dbws ];
33 foreach ( $dbws as $dbw ) {
34 if ( $dbw && $dbw->trxLevel() ) {
35 $dbw->onTransactionResolution( [ $this,
'cancelOnRollback' ], $fname );
41 if ( $this->callback ) {
42 call_user_func( $this->callback );
51 if ( $trigger === IDatabase::TRIGGER_ROLLBACK ) {
52 $this->callback =
null;
65 $this->trxRoundRequirement = $mode;
69 return $this->trxRoundRequirement;
74class_alias( MWCallableUpdate::class,
'MWCallableUpdate' );