21 private $trxRoundRequirement = self::TRX_ROUND_PRESENT;
29 public function __construct( callable $callback, $fname = ISQLPlatform::CALLER_UNKNOWN, $dbws = [] ) {
30 $this->callback = $callback;
31 $this->fname = $fname;
33 $dbws = is_array( $dbws ) ? $dbws : [ $dbws ];
34 foreach ( $dbws as $dbw ) {
35 if ( $dbw && $dbw->trxLevel() ) {
36 $dbw->onTransactionResolution( [ $this,
'cancelOnRollback' ], $fname );
42 if ( $this->callback ) {
43 call_user_func( $this->callback );
52 if ( $trigger === IDatabase::TRIGGER_ROLLBACK ) {
53 $this->callback =
null;
66 $this->trxRoundRequirement = $mode;
70 return $this->trxRoundRequirement;
75class_alias( MWCallableUpdate::class,
'MWCallableUpdate' );