MediaWiki  1.28.0
FileBackend.php
Go to the documentation of this file.
1 <?php
34 
93 abstract class FileBackend implements LoggerAwareInterface {
95  protected $name;
96 
98  protected $domainId;
99 
101  protected $readOnly;
102 
104  protected $parallelize;
105 
107  protected $concurrency;
108 
110  protected $tmpDirectory;
111 
113  protected $lockManager;
115  protected $fileJournal;
117  protected $logger;
119  protected $profiler;
120 
122  protected $obResetFunc;
124  protected $streamMimeFunc;
126  protected $statusWrapper;
127 
129  const ATTR_HEADERS = 1; // files can be tagged with standard HTTP headers
130  const ATTR_METADATA = 2; // files can be stored with metadata key/values
131  const ATTR_UNICODE_PATHS = 4; // files can have Unicode paths (not just ASCII)
132 
163  public function __construct( array $config ) {
164  $this->name = $config['name'];
165  $this->domainId = isset( $config['domainId'] )
166  ? $config['domainId'] // e.g. "my_wiki-en_"
167  : $config['wikiId']; // b/c alias
168  if ( !preg_match( '!^[a-zA-Z0-9-_]{1,255}$!', $this->name ) ) {
169  throw new InvalidArgumentException( "Backend name '{$this->name}' is invalid." );
170  } elseif ( !is_string( $this->domainId ) ) {
171  throw new InvalidArgumentException(
172  "Backend domain ID not provided for '{$this->name}'." );
173  }
174  $this->lockManager = isset( $config['lockManager'] )
175  ? $config['lockManager']
176  : new NullLockManager( [] );
177  $this->fileJournal = isset( $config['fileJournal'] )
178  ? $config['fileJournal']
179  : FileJournal::factory( [ 'class' => 'NullFileJournal' ], $this->name );
180  $this->readOnly = isset( $config['readOnly'] )
181  ? (string)$config['readOnly']
182  : '';
183  $this->parallelize = isset( $config['parallelize'] )
184  ? (string)$config['parallelize']
185  : 'off';
186  $this->concurrency = isset( $config['concurrency'] )
187  ? (int)$config['concurrency']
188  : 50;
189  $this->obResetFunc = isset( $config['obResetFunc'] )
190  ? $config['obResetFunc']
191  : [ $this, 'resetOutputBuffer' ];
192  $this->streamMimeFunc = isset( $config['streamMimeFunc'] )
193  ? $config['streamMimeFunc']
194  : null;
195  $this->statusWrapper = isset( $config['statusWrapper'] ) ? $config['statusWrapper'] : null;
196 
197  $this->profiler = isset( $config['profiler'] ) ? $config['profiler'] : null;
198  $this->logger = isset( $config['logger'] ) ? $config['logger'] : new \Psr\Log\NullLogger();
199  $this->statusWrapper = isset( $config['statusWrapper'] ) ? $config['statusWrapper'] : null;
200  $this->tmpDirectory = isset( $config['tmpDirectory'] ) ? $config['tmpDirectory'] : null;
201  }
202 
203  public function setLogger( LoggerInterface $logger ) {
204  $this->logger = $logger;
205  }
206 
214  final public function getName() {
215  return $this->name;
216  }
217 
224  final public function getDomainId() {
225  return $this->domainId;
226  }
227 
233  final public function getWikiId() {
234  return $this->getDomainId();
235  }
236 
242  final public function isReadOnly() {
243  return ( $this->readOnly != '' );
244  }
245 
251  final public function getReadOnlyReason() {
252  return ( $this->readOnly != '' ) ? $this->readOnly : false;
253  }
254 
261  public function getFeatures() {
262  return self::ATTR_UNICODE_PATHS;
263  }
264 
272  final public function hasFeatures( $bitfield ) {
273  return ( $this->getFeatures() & $bitfield ) === $bitfield;
274  }
275 
424  final public function doOperations( array $ops, array $opts = [] ) {
425  if ( empty( $opts['bypassReadOnly'] ) && $this->isReadOnly() ) {
426  return $this->newStatus( 'backend-fail-readonly', $this->name, $this->readOnly );
427  }
428  if ( !count( $ops ) ) {
429  return $this->newStatus(); // nothing to do
430  }
431 
432  $ops = $this->resolveFSFileObjects( $ops );
433  if ( empty( $opts['force'] ) ) { // sanity
434  unset( $opts['nonLocking'] );
435  }
436 
438  $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
439 
440  return $this->doOperationsInternal( $ops, $opts );
441  }
442 
448  abstract protected function doOperationsInternal( array $ops, array $opts );
449 
461  final public function doOperation( array $op, array $opts = [] ) {
462  return $this->doOperations( [ $op ], $opts );
463  }
464 
475  final public function create( array $params, array $opts = [] ) {
476  return $this->doOperation( [ 'op' => 'create' ] + $params, $opts );
477  }
478 
489  final public function store( array $params, array $opts = [] ) {
490  return $this->doOperation( [ 'op' => 'store' ] + $params, $opts );
491  }
492 
503  final public function copy( array $params, array $opts = [] ) {
504  return $this->doOperation( [ 'op' => 'copy' ] + $params, $opts );
505  }
506 
517  final public function move( array $params, array $opts = [] ) {
518  return $this->doOperation( [ 'op' => 'move' ] + $params, $opts );
519  }
520 
531  final public function delete( array $params, array $opts = [] ) {
532  return $this->doOperation( [ 'op' => 'delete' ] + $params, $opts );
533  }
534 
546  final public function describe( array $params, array $opts = [] ) {
547  return $this->doOperation( [ 'op' => 'describe' ] + $params, $opts );
548  }
549 
662  final public function doQuickOperations( array $ops, array $opts = [] ) {
663  if ( empty( $opts['bypassReadOnly'] ) && $this->isReadOnly() ) {
664  return $this->newStatus( 'backend-fail-readonly', $this->name, $this->readOnly );
665  }
666  if ( !count( $ops ) ) {
667  return $this->newStatus(); // nothing to do
668  }
669 
670  $ops = $this->resolveFSFileObjects( $ops );
671  foreach ( $ops as &$op ) {
672  $op['overwrite'] = true; // avoids RTTs in key/value stores
673  }
674 
676  $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
677 
678  return $this->doQuickOperationsInternal( $ops );
679  }
680 
686  abstract protected function doQuickOperationsInternal( array $ops );
687 
698  final public function doQuickOperation( array $op ) {
699  return $this->doQuickOperations( [ $op ] );
700  }
701 
712  final public function quickCreate( array $params ) {
713  return $this->doQuickOperation( [ 'op' => 'create' ] + $params );
714  }
715 
726  final public function quickStore( array $params ) {
727  return $this->doQuickOperation( [ 'op' => 'store' ] + $params );
728  }
729 
740  final public function quickCopy( array $params ) {
741  return $this->doQuickOperation( [ 'op' => 'copy' ] + $params );
742  }
743 
754  final public function quickMove( array $params ) {
755  return $this->doQuickOperation( [ 'op' => 'move' ] + $params );
756  }
757 
768  final public function quickDelete( array $params ) {
769  return $this->doQuickOperation( [ 'op' => 'delete' ] + $params );
770  }
771 
782  final public function quickDescribe( array $params ) {
783  return $this->doQuickOperation( [ 'op' => 'describe' ] + $params );
784  }
785 
798  abstract public function concatenate( array $params );
799 
818  final public function prepare( array $params ) {
819  if ( empty( $params['bypassReadOnly'] ) && $this->isReadOnly() ) {
820  return $this->newStatus( 'backend-fail-readonly', $this->name, $this->readOnly );
821  }
823  $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
824  return $this->doPrepare( $params );
825  }
826 
831  abstract protected function doPrepare( array $params );
832 
849  final public function secure( array $params ) {
850  if ( empty( $params['bypassReadOnly'] ) && $this->isReadOnly() ) {
851  return $this->newStatus( 'backend-fail-readonly', $this->name, $this->readOnly );
852  }
854  $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
855  return $this->doSecure( $params );
856  }
857 
862  abstract protected function doSecure( array $params );
863 
882  final public function publish( array $params ) {
883  if ( empty( $params['bypassReadOnly'] ) && $this->isReadOnly() ) {
884  return $this->newStatus( 'backend-fail-readonly', $this->name, $this->readOnly );
885  }
887  $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
888  return $this->doPublish( $params );
889  }
890 
895  abstract protected function doPublish( array $params );
896 
908  final public function clean( array $params ) {
909  if ( empty( $params['bypassReadOnly'] ) && $this->isReadOnly() ) {
910  return $this->newStatus( 'backend-fail-readonly', $this->name, $this->readOnly );
911  }
913  $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
914  return $this->doClean( $params );
915  }
916 
921  abstract protected function doClean( array $params );
922 
930  final protected function getScopedPHPBehaviorForOps() {
931  if ( PHP_SAPI != 'cli' ) { // http://bugs.php.net/bug.php?id=47540
932  $old = ignore_user_abort( true ); // avoid half-finished operations
933  return new ScopedCallback( function () use ( $old ) {
934  ignore_user_abort( $old );
935  } );
936  }
937 
938  return null;
939  }
940 
950  abstract public function fileExists( array $params );
951 
960  abstract public function getFileTimestamp( array $params );
961 
971  final public function getFileContents( array $params ) {
972  $contents = $this->getFileContentsMulti(
973  [ 'srcs' => [ $params['src'] ] ] + $params );
974 
975  return $contents[$params['src']];
976  }
977 
992  abstract public function getFileContentsMulti( array $params );
993 
1012  abstract public function getFileXAttributes( array $params );
1013 
1022  abstract public function getFileSize( array $params );
1023 
1037  abstract public function getFileStat( array $params );
1038 
1047  abstract public function getFileSha1Base36( array $params );
1048 
1058  abstract public function getFileProps( array $params );
1059 
1079  abstract public function streamFile( array $params );
1080 
1099  final public function getLocalReference( array $params ) {
1100  $fsFiles = $this->getLocalReferenceMulti(
1101  [ 'srcs' => [ $params['src'] ] ] + $params );
1102 
1103  return $fsFiles[$params['src']];
1104  }
1105 
1120  abstract public function getLocalReferenceMulti( array $params );
1121 
1132  final public function getLocalCopy( array $params ) {
1133  $tmpFiles = $this->getLocalCopyMulti(
1134  [ 'srcs' => [ $params['src'] ] ] + $params );
1135 
1136  return $tmpFiles[$params['src']];
1137  }
1138 
1153  abstract public function getLocalCopyMulti( array $params );
1154 
1171  abstract public function getFileHttpUrl( array $params );
1172 
1185  abstract public function directoryExists( array $params );
1186 
1205  abstract public function getDirectoryList( array $params );
1206 
1220  final public function getTopDirectoryList( array $params ) {
1221  return $this->getDirectoryList( [ 'topOnly' => true ] + $params );
1222  }
1223 
1242  abstract public function getFileList( array $params );
1243 
1258  final public function getTopFileList( array $params ) {
1259  return $this->getFileList( [ 'topOnly' => true ] + $params );
1260  }
1261 
1270  abstract public function preloadCache( array $paths );
1271 
1280  abstract public function clearCache( array $paths = null );
1281 
1296  abstract public function preloadFileStat( array $params );
1297 
1309  final public function lockFiles( array $paths, $type, $timeout = 0 ) {
1310  $paths = array_map( 'FileBackend::normalizeStoragePath', $paths );
1311 
1312  return $this->wrapStatus( $this->lockManager->lock( $paths, $type, $timeout ) );
1313  }
1314 
1322  final public function unlockFiles( array $paths, $type ) {
1323  $paths = array_map( 'FileBackend::normalizeStoragePath', $paths );
1324 
1325  return $this->wrapStatus( $this->lockManager->unlock( $paths, $type ) );
1326  }
1327 
1344  final public function getScopedFileLocks(
1345  array $paths, $type, StatusValue $status, $timeout = 0
1346  ) {
1347  if ( $type === 'mixed' ) {
1348  foreach ( $paths as &$typePaths ) {
1349  $typePaths = array_map( 'FileBackend::normalizeStoragePath', $typePaths );
1350  }
1351  } else {
1352  $paths = array_map( 'FileBackend::normalizeStoragePath', $paths );
1353  }
1354 
1355  return ScopedLock::factory( $this->lockManager, $paths, $type, $status, $timeout );
1356  }
1357 
1374  abstract public function getScopedLocksForOps( array $ops, StatusValue $status );
1375 
1383  final public function getRootStoragePath() {
1384  return "mwstore://{$this->name}";
1385  }
1386 
1394  final public function getContainerStoragePath( $container ) {
1395  return $this->getRootStoragePath() . "/{$container}";
1396  }
1397 
1403  final public function getJournal() {
1404  return $this->fileJournal;
1405  }
1406 
1416  protected function resolveFSFileObjects( array $ops ) {
1417  foreach ( $ops as &$op ) {
1418  $src = isset( $op['src'] ) ? $op['src'] : null;
1419  if ( $src instanceof FSFile ) {
1420  $op['srcRef'] = $src;
1421  $op['src'] = $src->getPath();
1422  }
1423  }
1424  unset( $op );
1425 
1426  return $ops;
1427  }
1428 
1436  final public static function isStoragePath( $path ) {
1437  return ( strpos( $path, 'mwstore://' ) === 0 );
1438  }
1439 
1448  final public static function splitStoragePath( $storagePath ) {
1449  if ( self::isStoragePath( $storagePath ) ) {
1450  // Remove the "mwstore://" prefix and split the path
1451  $parts = explode( '/', substr( $storagePath, 10 ), 3 );
1452  if ( count( $parts ) >= 2 && $parts[0] != '' && $parts[1] != '' ) {
1453  if ( count( $parts ) == 3 ) {
1454  return $parts; // e.g. "backend/container/path"
1455  } else {
1456  return [ $parts[0], $parts[1], '' ]; // e.g. "backend/container"
1457  }
1458  }
1459  }
1460 
1461  return [ null, null, null ];
1462  }
1463 
1471  final public static function normalizeStoragePath( $storagePath ) {
1472  list( $backend, $container, $relPath ) = self::splitStoragePath( $storagePath );
1473  if ( $relPath !== null ) { // must be for this backend
1474  $relPath = self::normalizeContainerPath( $relPath );
1475  if ( $relPath !== null ) {
1476  return ( $relPath != '' )
1477  ? "mwstore://{$backend}/{$container}/{$relPath}"
1478  : "mwstore://{$backend}/{$container}";
1479  }
1480  }
1481 
1482  return null;
1483  }
1484 
1493  final public static function parentStoragePath( $storagePath ) {
1494  $storagePath = dirname( $storagePath );
1495  list( , , $rel ) = self::splitStoragePath( $storagePath );
1496 
1497  return ( $rel === null ) ? null : $storagePath;
1498  }
1499 
1507  final public static function extensionFromPath( $path, $case = 'lowercase' ) {
1508  $i = strrpos( $path, '.' );
1509  $ext = $i ? substr( $path, $i + 1 ) : '';
1510 
1511  if ( $case === 'lowercase' ) {
1512  $ext = strtolower( $ext );
1513  } elseif ( $case === 'uppercase' ) {
1514  $ext = strtoupper( $ext );
1515  }
1516 
1517  return $ext;
1518  }
1519 
1527  final public static function isPathTraversalFree( $path ) {
1528  return ( self::normalizeContainerPath( $path ) !== null );
1529  }
1530 
1540  final public static function makeContentDisposition( $type, $filename = '' ) {
1541  $parts = [];
1542 
1543  $type = strtolower( $type );
1544  if ( !in_array( $type, [ 'inline', 'attachment' ] ) ) {
1545  throw new InvalidArgumentException( "Invalid Content-Disposition type '$type'." );
1546  }
1547  $parts[] = $type;
1548 
1549  if ( strlen( $filename ) ) {
1550  $parts[] = "filename*=UTF-8''" . rawurlencode( basename( $filename ) );
1551  }
1552 
1553  return implode( ';', $parts );
1554  }
1555 
1566  final protected static function normalizeContainerPath( $path ) {
1567  // Normalize directory separators
1568  $path = strtr( $path, '\\', '/' );
1569  // Collapse any consecutive directory separators
1570  $path = preg_replace( '![/]{2,}!', '/', $path );
1571  // Remove any leading directory separator
1572  $path = ltrim( $path, '/' );
1573  // Use the same traversal protection as Title::secureAndSplit()
1574  if ( strpos( $path, '.' ) !== false ) {
1575  if (
1576  $path === '.' ||
1577  $path === '..' ||
1578  strpos( $path, './' ) === 0 ||
1579  strpos( $path, '../' ) === 0 ||
1580  strpos( $path, '/./' ) !== false ||
1581  strpos( $path, '/../' ) !== false
1582  ) {
1583  return null;
1584  }
1585  }
1586 
1587  return $path;
1588  }
1589 
1598  final protected function newStatus() {
1599  $args = func_get_args();
1600  if ( count( $args ) ) {
1601  $sv = call_user_func_array( [ 'StatusValue', 'newFatal' ], $args );
1602  } else {
1603  $sv = StatusValue::newGood();
1604  }
1605 
1606  return $this->wrapStatus( $sv );
1607  }
1608 
1613  final protected function wrapStatus( StatusValue $sv ) {
1614  return $this->statusWrapper ? call_user_func( $this->statusWrapper, $sv ) : $sv;
1615  }
1616 
1621  protected function scopedProfileSection( $section ) {
1622  if ( $this->profiler ) {
1623  call_user_func( [ $this->profiler, 'profileIn' ], $section );
1624  return new ScopedCallback( [ $this->profiler, 'profileOut' ], [ $section ] );
1625  }
1626 
1627  return null;
1628  }
1629 
1630  protected function resetOutputBuffer() {
1631  while ( ob_get_status() ) {
1632  if ( !ob_end_clean() ) {
1633  // Could not remove output buffer handler; abort now
1634  // to avoid getting in some kind of infinite loop.
1635  break;
1636  }
1637  }
1638  }
1639 }
doQuickOperationsInternal(array $ops)
newStatus()
Yields the result of the status wrapper callback on either:
FileJournal $fileJournal
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
describe(array $params, array $opts=[])
Performs a single describe operation.
the array() calling protocol came about after MediaWiki 1.4rc1.
unlockFiles(array $paths, $type)
Unlock the files at the given storage paths in the backend.
doOperations(array $ops, array $opts=[])
This is the main entry point into the backend for write operations.
doPrepare(array $params)
getFileStat(array $params)
Get quick information about a file at a storage path in the backend.
getWikiId()
Alias to getDomainId()
publish(array $params)
Remove measures to block web access to a storage directory and the container it belongs to...
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
secure(array $params)
Take measures to block web access to a storage directory and the container it belongs to...
setLogger(LoggerInterface $logger)
string $domainId
Unique domain name.
Definition: FileBackend.php:98
Simple version of LockManager that does nothing.
scopedProfileSection($section)
const ATTR_HEADERS
Bitfield flags for supported features.
quickMove(array $params)
Performs a single quick move operation.
getFileHttpUrl(array $params)
Return an HTTP URL to a given file that requires no authentication to use.
quickDelete(array $params)
Performs a single quick delete operation.
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
Definition: hooks.txt:177
getFileXAttributes(array $params)
Get metadata about a file at a storage path in the backend.
getScopedPHPBehaviorForOps()
Enter file operation scope.
getName()
Get the unique backend name.
getScopedFileLocks(array $paths, $type, StatusValue $status, $timeout=0)
Lock the files at the given storage paths in the backend.
getFileContentsMulti(array $params)
Like getFileContents() except it takes an array of storage paths and returns a map of storage paths t...
getDirectoryList(array $params)
Get an iterator to list all directories under a storage directory.
getDomainId()
Get the domain identifier used for this backend (possibly empty).
doOperation(array $op, array $opts=[])
Same as doOperations() except it takes a single operation.
static factory(LockManager $manager, array $paths, $type, StatusValue $status, $timeout=0)
Get a ScopedLock object representing a lock on resource paths.
Definition: ScopedLock.php:71
doClean(array $params)
getFileTimestamp(array $params)
Get the last-modified timestamp of the file at a storage path.
int $concurrency
How many operations can be done in parallel.
getLocalReferenceMulti(array $params)
Like getLocalReference() except it takes an array of storage paths and returns a map of storage paths...
static extensionFromPath($path, $case= 'lowercase')
Get the final extension from a storage or FS path.
directoryExists(array $params)
Check if a directory exists at a given storage path.
wrapStatus(StatusValue $sv)
callable $statusWrapper
hasFeatures($bitfield)
Check if the backend medium supports a field of extra features.
resolveFSFileObjects(array $ops)
Convert FSFile 'src' paths to string paths (with an 'srcRef' field set to the FSFile) ...
if($line===false) $args
Definition: cdb.php:64
string $readOnly
Read-only explanation message.
create(array $params, array $opts=[])
Performs a single create operation.
move(array $params, array $opts=[])
Performs a single move operation.
quickStore(array $params)
Performs a single quick store operation.
getContainerStoragePath($container)
Get the storage path for the given container for this backend.
getReadOnlyReason()
Get an explanatory message if this backend is read-only.
static normalizeContainerPath($path)
Validate and normalize a relative storage path.
quickCreate(array $params)
Performs a single quick create operation.
getTopFileList(array $params)
Same as FileBackend::getFileList() except only lists files that are immediately under the given direc...
lockFiles(array $paths, $type, $timeout=0)
Lock the files at the given storage paths in the backend.
__construct(array $config)
Create a new backend instance from configuration.
static isStoragePath($path)
Check if a given path is a "mwstore://" path.
quickCopy(array $params)
Performs a single quick copy operation.
fileExists(array $params)
Check if a file exists at a storage path in the backend.
getFileSha1Base36(array $params)
Get a SHA-1 hash of the file at a storage path in the backend.
$params
callable $obResetFunc
string $tmpDirectory
Temporary file directory.
store(array $params, array $opts=[])
Performs a single store operation.
const ATTR_UNICODE_PATHS
doSecure(array $params)
const ATTR_METADATA
callable $streamMimeFunc
static newGood($value=null)
Factory function for good results.
Definition: StatusValue.php:76
getFileSize(array $params)
Get the size (bytes) of a file at a storage path in the backend.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
doQuickOperations(array $ops, array $opts=[])
Perform a set of independent file operations on some files.
prepare(array $params)
Prepare a storage directory for usage.
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
Definition: hooks.txt:2889
string $name
Unique backend name.
Definition: FileBackend.php:95
getLocalCopy(array $params)
Get a local copy on disk of the file at a storage path in the backend.
LoggerInterface $logger
static normalizeStoragePath($storagePath)
Normalize a storage path by cleaning up directory separators.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
getJournal()
Get the file journal object for this backend.
concatenate(array $params)
Concatenate a list of storage files into a single file system file.
getRootStoragePath()
Get the root storage path of this backend.
Class representing a non-directory file on the file system.
Definition: FSFile.php:29
preloadCache(array $paths)
Preload persistent file stat cache and property cache into in-process cache.
copy(array $params, array $opts=[])
Performs a single copy operation.
doOperationsInternal(array $ops, array $opts)
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at name
Definition: design.txt:12
Base class for all file backend classes (including multi-write backends).
Definition: FileBackend.php:93
getFileList(array $params)
Get an iterator to list all stored files under a storage directory.
object string $profiler
Class name or object With profileIn/profileOut methods.
static isPathTraversalFree($path)
Check if a relative path has no directory traversals.
getScopedLocksForOps(array $ops, StatusValue $status)
Get an array of scoped locks needed for a batch of file operations.
getTopDirectoryList(array $params)
Same as FileBackend::getDirectoryList() except only lists directories that are immediately under the ...
getLocalCopyMulti(array $params)
Like getLocalCopy() except it takes an array of storage paths and returns a map of storage paths to T...
static makeContentDisposition($type, $filename= '')
Build a Content-Disposition header value per RFC 6266.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
Definition: hooks.txt:1046
quickDescribe(array $params)
Performs a single quick describe operation.
string $parallelize
When to do operations in parallel.
streamFile(array $params)
Stream the file at a storage path in the backend.
clean(array $params)
Delete a storage directory if it is empty.
getFileProps(array $params)
Get the properties of the file at a storage path in the backend.
static splitStoragePath($storagePath)
Split a storage path into a backend name, a container name, and a relative file path.
clearCache(array $paths=null)
Invalidate any in-process file stat and property cache.
LockManager $lockManager
doQuickOperation(array $op)
Same as doQuickOperations() except it takes a single operation.
isReadOnly()
Check if this backend is read-only.
preloadFileStat(array $params)
Preload file stat information (concurrently if possible) into in-process cache.
getLocalReference(array $params)
Returns a file system file, identical to the file at a storage path.
getFeatures()
Get the a bitfield of extra features supported by the backend medium.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
Definition: hooks.txt:2491
static factory(array $config, $backend)
Create an appropriate FileJournal object from config.
Definition: FileJournal.php:63
doPublish(array $params)
getFileContents(array $params)
Get the contents of a file at a storage path in the backend.
static parentStoragePath($storagePath)
Get the parent storage directory of a storage path.