}
/** @noinspection PhpUnusedLocalVariableInspection */
- $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
+ $scope = ScopedCallback::newScopedIgnoreUserAbort(); // try to ignore client aborts
return $this->doOperationsInternal( $ops, $opts );
}
}
/** @noinspection PhpUnusedLocalVariableInspection */
- $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
+ $scope = ScopedCallback::newScopedIgnoreUserAbort(); // try to ignore client aborts
return $this->doQuickOperationsInternal( $ops );
}
return $this->newStatus( 'backend-fail-readonly', $this->name, $this->readOnly );
}
/** @noinspection PhpUnusedLocalVariableInspection */
- $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
+ $scope = ScopedCallback::newScopedIgnoreUserAbort(); // try to ignore client aborts
return $this->doPrepare( $params );
}
return $this->newStatus( 'backend-fail-readonly', $this->name, $this->readOnly );
}
/** @noinspection PhpUnusedLocalVariableInspection */
- $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
+ $scope = ScopedCallback::newScopedIgnoreUserAbort(); // try to ignore client aborts
return $this->doSecure( $params );
}
return $this->newStatus( 'backend-fail-readonly', $this->name, $this->readOnly );
}
/** @noinspection PhpUnusedLocalVariableInspection */
- $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
+ $scope = ScopedCallback::newScopedIgnoreUserAbort(); // try to ignore client aborts
return $this->doPublish( $params );
}
return $this->newStatus( 'backend-fail-readonly', $this->name, $this->readOnly );
}
/** @noinspection PhpUnusedLocalVariableInspection */
- $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
+ $scope = ScopedCallback::newScopedIgnoreUserAbort(); // try to ignore client aborts
return $this->doClean( $params );
}
*/
abstract protected function doClean( array $params );
- /**
- * Enter file operation scope.
- * This just makes PHP ignore user aborts/disconnects until the return
- * value leaves scope. This returns null and does nothing in CLI mode.
- *
- * @return ScopedCallback|null
- */
- final protected function getScopedPHPBehaviorForOps() {
- 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;
- }
-
/**
* Check if a file exists at a storage path in the backend.
* This returns false if only a directory exists at the path.
);
}
/** @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
}
}
- /**
- * 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();
}
$failures = [];
/** @noinspection PhpUnusedLocalVariableInspection */
- $scope = $this->getScopedPHPBehaviorForCommit(); // try to ignore client aborts
+ $scope = ScopedCallback::newScopedIgnoreUserAbort(); // try to ignore client aborts
$restore = ( $this->trxRoundId !== false );
$this->trxRoundId = false;
}
}
- /**
- * 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() {
// Avoid connection leaks for sanity
$this->disable();