* @file
* @ingroup FileBackend
*/
+use Wikimedia\AtEase\AtEase;
use Wikimedia\Timestamp\ConvertibleTimestamp;
/**
unset( $params['latest'] ); // sanity
// Check that the specified temp file is valid...
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$ok = ( is_file( $tmpPath ) && filesize( $tmpPath ) == 0 );
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
if ( !$ok ) { // not present or not empty
$status->fatal( 'backend-fail-opentemp', $tmpPath );
protected function doGetFileContentsMulti( array $params ) {
$contents = [];
foreach ( $this->doGetLocalReferenceMulti( $params ) as $path => $fsFile ) {
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$contents[$path] = $fsFile ? file_get_contents( $fsFile->getPath() ) : false;
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
}
return $contents;
*
* @file
*/
+
+use Wikimedia\AtEase\AtEase;
use Wikimedia\Timestamp\ConvertibleTimestamp;
/**
is_int( $header ) ? HttpStatus::header( $header ) : header( $header );
};
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$info = stat( $this->path );
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
if ( !is_array( $info ) ) {
if ( $sendErrors ) {
* @ingroup FileBackend
*/
+use Wikimedia\AtEase\AtEase;
+
/**
* Simulation of a backend storage in memory.
*
return $status;
}
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$data = file_get_contents( $params['src'] );
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
if ( $data === false ) { // source doesn't exist?
$status->fatal( 'backend-fail-store', $params['src'], $params['dst'] );
* @author Russ Nelson
*/
+use Wikimedia\AtEase\AtEase;
+
/**
* @brief Class for an OpenStack Swift (or Ceph RGW) based file backend.
*
return $status;
}
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$sha1Hash = sha1_file( $params['src'] );
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
if ( $sha1Hash === false ) { // source doesn't exist?
$status->fatal( 'backend-fail-store', $params['src'], $params['dst'] );
* @param FileBackendStore $backend
* @param array $params
* @param LoggerInterface $logger PSR logger instance
- * @throws FileBackendError
+ * @throws InvalidArgumentException
*/
final public function __construct(
FileBackendStore $backend, array $params, LoggerInterface $logger
* @ingroup FileBackend
*/
+use Wikimedia\AtEase\AtEase;
+
/**
* Store a file into the backend from a file on the file system.
* Parameters for this operation are outlined in FileBackend::doOperations().
}
protected function getSourceSha1Base36() {
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$hash = sha1_file( $this->params['src'] );
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
if ( $hash !== false ) {
$hash = Wikimedia\base_convert( $hash, 16, 36, 31 );
}
* @ingroup FileBackend
*/
+use Wikimedia\AtEase\AtEase;
+
/**
* Class representing a non-directory file on the file system
*
* @return string|bool TS_MW timestamp or false on failure
*/
public function getTimestamp() {
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$timestamp = filemtime( $this->path );
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
if ( $timestamp !== false ) {
$timestamp = wfTimestamp( TS_MW, $timestamp );
}
return $this->sha1Base36;
}
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$this->sha1Base36 = sha1_file( $this->path );
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
if ( $this->sha1Base36 !== false ) {
$this->sha1Base36 = Wikimedia\base_convert( $this->sha1Base36, 16, 36, 31 );
* @ingroup FileBackend
*/
+use Wikimedia\AtEase\AtEase;
+
/**
* This class is used to hold the location and do limited manipulation
* of files stored temporarily (this will be whatever wfTempDir() returns)
protected static $pathsCollect = null;
/**
- * Do not call directly. Use TempFSFileFactory.
+ * Do not call directly. Use TempFSFileFactory
+ *
+ * @param string $path
*/
public function __construct( $path ) {
parent::__construct( $path );
*/
public function purge() {
$this->canDelete = false; // done
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$ok = unlink( $this->path );
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
unset( self::$pathsCollect[$this->path] );
*/
public static function purgeAllOnShutdown() {
foreach ( self::$pathsCollect as $path => $unused ) {
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
unlink( $path );
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
}
}