);
}
/** @noinspection PhpUnusedLocalVariableInspection */
- $scope = $this->getScopedPHPBehaviorForCommit(); // try to ignore client aborts
+ $scope = ScopedCallback::newScopedIgnoreUserAbort(); // try to ignore client aborts
// Run pre-commit callbacks and suppress post-commit callbacks, aborting on failure
do {
$count = 0; // number of callbacks executed this iteration
$this->indexAliases = $aliases;
}
+ /**
+ * @param string $prefix
+ * @deprecated Since 1.33
+ */
public function setDomainPrefix( $prefix ) {
+ $this->setLocalDomainPrefix( $prefix );
+ }
+
+ public function setLocalDomainPrefix( $prefix ) {
$this->localDomain = new DatabaseDomain(
$this->localDomain->getDatabase(),
null,
);
$this->forEachLB( function ( ILoadBalancer $lb ) use ( $prefix ) {
- $lb->setDomainPrefix( $prefix );
+ $lb->setLocalDomainPrefix( $prefix );
+ } );
+ }
+
+ public function redefineLocalDomain( $domain ) {
+ $this->closeAll();
+
+ $this->localDomain = DatabaseDomain::newFromId( $domain );
+
+ $this->forEachLB( function ( ILoadBalancer $lb ) {
+ $lb->redefineLocalDomain( $this->localDomain );
} );
}
}
}
- /**
- * Make PHP ignore user aborts/disconnects until the returned
- * value leaves scope. This returns null and does nothing in CLI mode.
- *
- * @return ScopedCallback|null
- */
- final protected function getScopedPHPBehaviorForCommit() {
- if ( PHP_SAPI != 'cli' ) { // https://bugs.php.net/bug.php?id=47540
- $old = ignore_user_abort( true ); // avoid half-finished operations
- return new ScopedCallback( function () use ( $old ) {
- ignore_user_abort( $old );
- } );
- }
-
- return null;
- }
-
function __destruct() {
$this->destroy();
}