MediaWiki  1.23.3
FileBackend.php
Go to the documentation of this file.
1 <?php
85 abstract class FileBackend {
87  protected $name;
88 
90  protected $wikiId;
91 
93  protected $readOnly;
94 
96  protected $parallelize;
97 
99  protected $concurrency;
100 
102  protected $lockManager;
103 
105  protected $fileJournal;
106 
108  const ATTR_HEADERS = 1;
109  const ATTR_METADATA = 2;
110 
135  public function __construct( array $config ) {
136  $this->name = $config['name'];
137  if ( !preg_match( '!^[a-zA-Z0-9-_]{1,255}$!', $this->name ) ) {
138  throw new FileBackendException( "Backend name `{$this->name}` is invalid." );
139  }
140  if ( !isset( $config['wikiId'] ) ) {
141  $config['wikiId'] = wfWikiID();
142  wfDeprecated( __METHOD__ . ' called without "wikiID".', '1.23' );
143  }
144  if ( isset( $config['lockManager'] ) && !is_object( $config['lockManager'] ) ) {
145  $config['lockManager'] =
146  LockManagerGroup::singleton( $config['wikiId'] )->get( $config['lockManager'] );
147  wfDeprecated( __METHOD__ . ' called with non-object "lockManager".', '1.23' );
148  }
149  $this->wikiId = $config['wikiId']; // e.g. "my_wiki-en_"
150  $this->lockManager = isset( $config['lockManager'] )
151  ? $config['lockManager']
152  : new NullLockManager( array() );
153  $this->fileJournal = isset( $config['fileJournal'] )
154  ? $config['fileJournal']
155  : FileJournal::factory( array( 'class' => 'NullFileJournal' ), $this->name );
156  $this->readOnly = isset( $config['readOnly'] )
157  ? (string)$config['readOnly']
158  : '';
159  $this->parallelize = isset( $config['parallelize'] )
160  ? (string)$config['parallelize']
161  : 'off';
162  $this->concurrency = isset( $config['concurrency'] )
163  ? (int)$config['concurrency']
164  : 50;
165  }
166 
174  final public function getName() {
175  return $this->name;
176  }
177 
185  final public function getWikiId() {
186  return $this->wikiId;
187  }
188 
194  final public function isReadOnly() {
195  return ( $this->readOnly != '' );
196  }
197 
203  final public function getReadOnlyReason() {
204  return ( $this->readOnly != '' ) ? $this->readOnly : false;
205  }
206 
213  public function getFeatures() {
214  return 0;
215  }
216 
224  final public function hasFeatures( $bitfield ) {
225  return ( $this->getFeatures() & $bitfield ) === $bitfield;
226  }
227 
374  final public function doOperations( array $ops, array $opts = array() ) {
375  if ( empty( $opts['bypassReadOnly'] ) && $this->isReadOnly() ) {
376  return Status::newFatal( 'backend-fail-readonly', $this->name, $this->readOnly );
377  }
378  if ( !count( $ops ) ) {
379  return Status::newGood(); // nothing to do
380  }
381  if ( empty( $opts['force'] ) ) { // sanity
382  unset( $opts['nonLocking'] );
383  }
384  foreach ( $ops as &$op ) {
385  if ( isset( $op['disposition'] ) ) { // b/c (MW 1.20)
386  $op['headers']['Content-Disposition'] = $op['disposition'];
387  }
388  }
389  $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
390  return $this->doOperationsInternal( $ops, $opts );
391  }
392 
396  abstract protected function doOperationsInternal( array $ops, array $opts );
397 
409  final public function doOperation( array $op, array $opts = array() ) {
410  return $this->doOperations( array( $op ), $opts );
411  }
412 
423  final public function create( array $params, array $opts = array() ) {
424  return $this->doOperation( array( 'op' => 'create' ) + $params, $opts );
425  }
426 
437  final public function store( array $params, array $opts = array() ) {
438  return $this->doOperation( array( 'op' => 'store' ) + $params, $opts );
439  }
440 
451  final public function copy( array $params, array $opts = array() ) {
452  return $this->doOperation( array( 'op' => 'copy' ) + $params, $opts );
453  }
454 
465  final public function move( array $params, array $opts = array() ) {
466  return $this->doOperation( array( 'op' => 'move' ) + $params, $opts );
467  }
468 
479  final public function delete( array $params, array $opts = array() ) {
480  return $this->doOperation( array( 'op' => 'delete' ) + $params, $opts );
481  }
482 
494  final public function describe( array $params, array $opts = array() ) {
495  return $this->doOperation( array( 'op' => 'describe' ) + $params, $opts );
496  }
497 
608  final public function doQuickOperations( array $ops, array $opts = array() ) {
609  if ( empty( $opts['bypassReadOnly'] ) && $this->isReadOnly() ) {
610  return Status::newFatal( 'backend-fail-readonly', $this->name, $this->readOnly );
611  }
612  if ( !count( $ops ) ) {
613  return Status::newGood(); // nothing to do
614  }
615  foreach ( $ops as &$op ) {
616  $op['overwrite'] = true; // avoids RTTs in key/value stores
617  if ( isset( $op['disposition'] ) ) { // b/c (MW 1.20)
618  $op['headers']['Content-Disposition'] = $op['disposition'];
619  }
620  }
621  $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
622  return $this->doQuickOperationsInternal( $ops );
623  }
624 
629  abstract protected function doQuickOperationsInternal( array $ops );
630 
641  final public function doQuickOperation( array $op ) {
642  return $this->doQuickOperations( array( $op ) );
643  }
644 
655  final public function quickCreate( array $params ) {
656  return $this->doQuickOperation( array( 'op' => 'create' ) + $params );
657  }
658 
669  final public function quickStore( array $params ) {
670  return $this->doQuickOperation( array( 'op' => 'store' ) + $params );
671  }
672 
683  final public function quickCopy( array $params ) {
684  return $this->doQuickOperation( array( 'op' => 'copy' ) + $params );
685  }
686 
697  final public function quickMove( array $params ) {
698  return $this->doQuickOperation( array( 'op' => 'move' ) + $params );
699  }
700 
711  final public function quickDelete( array $params ) {
712  return $this->doQuickOperation( array( 'op' => 'delete' ) + $params );
713  }
714 
725  final public function quickDescribe( array $params ) {
726  return $this->doQuickOperation( array( 'op' => 'describe' ) + $params );
727  }
728 
741  abstract public function concatenate( array $params );
742 
761  final public function prepare( array $params ) {
762  if ( empty( $params['bypassReadOnly'] ) && $this->isReadOnly() ) {
763  return Status::newFatal( 'backend-fail-readonly', $this->name, $this->readOnly );
764  }
765  $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
766  return $this->doPrepare( $params );
767  }
768 
772  abstract protected function doPrepare( array $params );
773 
790  final public function secure( array $params ) {
791  if ( empty( $params['bypassReadOnly'] ) && $this->isReadOnly() ) {
792  return Status::newFatal( 'backend-fail-readonly', $this->name, $this->readOnly );
793  }
794  $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
795  return $this->doSecure( $params );
796  }
797 
801  abstract protected function doSecure( array $params );
802 
821  final public function publish( array $params ) {
822  if ( empty( $params['bypassReadOnly'] ) && $this->isReadOnly() ) {
823  return Status::newFatal( 'backend-fail-readonly', $this->name, $this->readOnly );
824  }
825  $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
826  return $this->doPublish( $params );
827  }
828 
832  abstract protected function doPublish( array $params );
833 
845  final public function clean( array $params ) {
846  if ( empty( $params['bypassReadOnly'] ) && $this->isReadOnly() ) {
847  return Status::newFatal( 'backend-fail-readonly', $this->name, $this->readOnly );
848  }
849  $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
850  return $this->doClean( $params );
851  }
852 
856  abstract protected function doClean( array $params );
857 
865  final protected function getScopedPHPBehaviorForOps() {
866  if ( PHP_SAPI != 'cli' ) { // http://bugs.php.net/bug.php?id=47540
867  $old = ignore_user_abort( true ); // avoid half-finished operations
868  return new ScopedCallback( function () use ( $old ) {
869  ignore_user_abort( $old );
870  } );
871  }
872 
873  return null;
874  }
875 
885  abstract public function fileExists( array $params );
886 
895  abstract public function getFileTimestamp( array $params );
896 
906  final public function getFileContents( array $params ) {
907  $contents = $this->getFileContentsMulti(
908  array( 'srcs' => array( $params['src'] ) ) + $params );
909 
910  return $contents[$params['src']];
911  }
912 
927  abstract public function getFileContentsMulti( array $params );
928 
947  abstract public function getFileXAttributes( array $params );
948 
957  abstract public function getFileSize( array $params );
958 
972  abstract public function getFileStat( array $params );
973 
982  abstract public function getFileSha1Base36( array $params );
983 
993  abstract public function getFileProps( array $params );
994 
1008  abstract public function streamFile( array $params );
1009 
1028  final public function getLocalReference( array $params ) {
1029  $fsFiles = $this->getLocalReferenceMulti(
1030  array( 'srcs' => array( $params['src'] ) ) + $params );
1031 
1032  return $fsFiles[$params['src']];
1033  }
1034 
1049  abstract public function getLocalReferenceMulti( array $params );
1050 
1061  final public function getLocalCopy( array $params ) {
1062  $tmpFiles = $this->getLocalCopyMulti(
1063  array( 'srcs' => array( $params['src'] ) ) + $params );
1064 
1065  return $tmpFiles[$params['src']];
1066  }
1067 
1082  abstract public function getLocalCopyMulti( array $params );
1083 
1100  abstract public function getFileHttpUrl( array $params );
1101 
1114  abstract public function directoryExists( array $params );
1115 
1134  abstract public function getDirectoryList( array $params );
1135 
1149  final public function getTopDirectoryList( array $params ) {
1150  return $this->getDirectoryList( array( 'topOnly' => true ) + $params );
1151  }
1152 
1171  abstract public function getFileList( array $params );
1172 
1187  final public function getTopFileList( array $params ) {
1188  return $this->getFileList( array( 'topOnly' => true ) + $params );
1189  }
1190 
1199  abstract public function preloadCache( array $paths );
1200 
1209  abstract public function clearCache( array $paths = null );
1210 
1222  public function preloadFileStat( array $params ) {
1223  }
1224 
1235  final public function lockFiles( array $paths, $type ) {
1236  $paths = array_map( 'FileBackend::normalizeStoragePath', $paths );
1237 
1238  return $this->lockManager->lock( $paths, $type );
1239  }
1240 
1248  final public function unlockFiles( array $paths, $type ) {
1249  $paths = array_map( 'FileBackend::normalizeStoragePath', $paths );
1250 
1251  return $this->lockManager->unlock( $paths, $type );
1252  }
1253 
1269  final public function getScopedFileLocks( array $paths, $type, Status $status ) {
1270  if ( $type === 'mixed' ) {
1271  foreach ( $paths as &$typePaths ) {
1272  $typePaths = array_map( 'FileBackend::normalizeStoragePath', $typePaths );
1273  }
1274  } else {
1275  $paths = array_map( 'FileBackend::normalizeStoragePath', $paths );
1276  }
1277 
1278  return ScopedLock::factory( $this->lockManager, $paths, $type, $status );
1279  }
1280 
1297  abstract public function getScopedLocksForOps( array $ops, Status $status );
1298 
1306  final public function getRootStoragePath() {
1307  return "mwstore://{$this->name}";
1308  }
1309 
1317  final public function getContainerStoragePath( $container ) {
1318  return $this->getRootStoragePath() . "/{$container}";
1319  }
1320 
1326  final public function getJournal() {
1327  return $this->fileJournal;
1328  }
1329 
1337  final public static function isStoragePath( $path ) {
1338  return ( strpos( $path, 'mwstore://' ) === 0 );
1339  }
1340 
1349  final public static function splitStoragePath( $storagePath ) {
1350  if ( self::isStoragePath( $storagePath ) ) {
1351  // Remove the "mwstore://" prefix and split the path
1352  $parts = explode( '/', substr( $storagePath, 10 ), 3 );
1353  if ( count( $parts ) >= 2 && $parts[0] != '' && $parts[1] != '' ) {
1354  if ( count( $parts ) == 3 ) {
1355  return $parts; // e.g. "backend/container/path"
1356  } else {
1357  return array( $parts[0], $parts[1], '' ); // e.g. "backend/container"
1358  }
1359  }
1360  }
1361 
1362  return array( null, null, null );
1363  }
1364 
1372  final public static function normalizeStoragePath( $storagePath ) {
1373  list( $backend, $container, $relPath ) = self::splitStoragePath( $storagePath );
1374  if ( $relPath !== null ) { // must be for this backend
1375  $relPath = self::normalizeContainerPath( $relPath );
1376  if ( $relPath !== null ) {
1377  return ( $relPath != '' )
1378  ? "mwstore://{$backend}/{$container}/{$relPath}"
1379  : "mwstore://{$backend}/{$container}";
1380  }
1381  }
1382 
1383  return null;
1384  }
1385 
1394  final public static function parentStoragePath( $storagePath ) {
1395  $storagePath = dirname( $storagePath );
1396  list( , , $rel ) = self::splitStoragePath( $storagePath );
1397 
1398  return ( $rel === null ) ? null : $storagePath;
1399  }
1407  final public static function extensionFromPath( $path ) {
1408  $i = strrpos( $path, '.' );
1409 
1410  return strtolower( $i ? substr( $path, $i + 1 ) : '' );
1411  }
1412 
1420  final public static function isPathTraversalFree( $path ) {
1421  return ( self::normalizeContainerPath( $path ) !== null );
1422  }
1423 
1433  final public static function makeContentDisposition( $type, $filename = '' ) {
1434  $parts = array();
1435 
1436  $type = strtolower( $type );
1437  if ( !in_array( $type, array( 'inline', 'attachment' ) ) ) {
1438  throw new FileBackendError( "Invalid Content-Disposition type '$type'." );
1439  }
1440  $parts[] = $type;
1441 
1442  if ( strlen( $filename ) ) {
1443  $parts[] = "filename*=UTF-8''" . rawurlencode( basename( $filename ) );
1444  }
1445 
1446  return implode( ';', $parts );
1447  }
1448 
1459  final protected static function normalizeContainerPath( $path ) {
1460  // Normalize directory separators
1461  $path = strtr( $path, '\\', '/' );
1462  // Collapse any consecutive directory separators
1463  $path = preg_replace( '![/]{2,}!', '/', $path );
1464  // Remove any leading directory separator
1465  $path = ltrim( $path, '/' );
1466  // Use the same traversal protection as Title::secureAndSplit()
1467  if ( strpos( $path, '.' ) !== false ) {
1468  if (
1469  $path === '.' ||
1470  $path === '..' ||
1471  strpos( $path, './' ) === 0 ||
1472  strpos( $path, '../' ) === 0 ||
1473  strpos( $path, '/./' ) !== false ||
1474  strpos( $path, '/../' ) !== false
1475  ) {
1476  return null;
1477  }
1478  }
1479 
1480  return $path;
1481  }
1482 }
1490 class FileBackendException extends MWException {
1491 }
1499 class FileBackendError extends FileBackendException {
1500 }
FileBackend\streamFile
streamFile(array $params)
Stream the file at a storage path in the backend.
FileBackend\splitStoragePath
static splitStoragePath( $storagePath)
Split a storage path into a backend name, a container name, and a relative file path.
Definition: FileBackend.php:1342
LockManager
Class for handling resource locking.
Definition: LockManager.php:45
FileBackend\doPrepare
doPrepare(array $params)
FileBackend\store
store(array $params, array $opts=array())
Performs a single store operation.
Definition: FileBackend.php:430
FileBackend\$lockManager
LockManager $lockManager
Definition: FileBackend.php:96
FileBackend\normalizeContainerPath
static normalizeContainerPath( $path)
Validate and normalize a relative storage path.
Definition: FileBackend.php:1452
FileBackend\doQuickOperationsInternal
doQuickOperationsInternal(array $ops)
FileBackend\getScopedPHPBehaviorForOps
getScopedPHPBehaviorForOps()
Enter file operation scope.
Definition: FileBackend.php:858
FileBackend\$wikiId
string $wikiId
Unique wiki name *.
Definition: FileBackend.php:88
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
FileBackend\preloadFileStat
preloadFileStat(array $params)
Preload file stat information (concurrently if possible) into in-process cache.
Definition: FileBackend.php:1215
FileBackend
Base class for all file backend classes (including multi-write backends).
Definition: FileBackend.php:85
FileBackend\unlockFiles
unlockFiles(array $paths, $type)
Unlock the files at the given storage paths in the backend.
Definition: FileBackend.php:1241
FileBackend\doPublish
doPublish(array $params)
FileBackend\ATTR_HEADERS
const ATTR_HEADERS
Flags for supported features.
Definition: FileBackend.php:101
FileBackend\directoryExists
directoryExists(array $params)
Check if a directory exists at a given storage path.
FileBackend\getLocalReferenceMulti
getLocalReferenceMulti(array $params)
Like getLocalReference() except it takes an array of storage paths and returns a map of storage paths...
FileBackend\getFileStat
getFileStat(array $params)
Get quick information about a file at a storage path in the backend.
FileBackend\getFileXAttributes
getFileXAttributes(array $params)
Get metadata about a file at a storage path in the backend.
FileBackend\publish
publish(array $params)
Remove measures to block web access to a storage directory and the container it belongs to.
Definition: FileBackend.php:814
FileBackend\getName
getName()
Get the unique backend name.
Definition: FileBackend.php:167
FileBackend\getDirectoryList
getDirectoryList(array $params)
Get an iterator to list all directories under a storage directory.
FileBackendError
File backend exception for checked exceptions (e.g.
Definition: FileBackend.php:1492
FileBackend\doOperation
doOperation(array $op, array $opts=array())
Same as doOperations() except it takes a single operation.
Definition: FileBackend.php:402
FileBackend\$readOnly
string $readOnly
Read-only explanation message *.
Definition: FileBackend.php:90
LockManagerGroup\singleton
static singleton( $domain=false)
Definition: LockManagerGroup.php:50
Status\newGood
static newGood( $value=null)
Factory function for good results.
Definition: Status.php:77
$params
$params
Definition: styleTest.css.php:40
FileBackend\copy
copy(array $params, array $opts=array())
Performs a single copy operation.
Definition: FileBackend.php:444
FileBackend\normalizeStoragePath
static normalizeStoragePath( $storagePath)
Normalize a storage path by cleaning up directory separators.
Definition: FileBackend.php:1365
FileBackend\quickMove
quickMove(array $params)
Performs a single quick move operation.
Definition: FileBackend.php:690
FileBackend\getReadOnlyReason
getReadOnlyReason()
Get an explanatory message if this backend is read-only.
Definition: FileBackend.php:196
FileBackend\getFileHttpUrl
getFileHttpUrl(array $params)
Return an HTTP URL to a given file that requires no authentication to use.
FileBackendException
Generic file backend exception for checked and unexpected (e.g.
Definition: FileBackend.php:1483
Status
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition: Status.php:40
FileBackend\getScopedFileLocks
getScopedFileLocks(array $paths, $type, Status $status)
Lock the files at the given storage paths in the backend.
Definition: FileBackend.php:1262
FileBackend\quickDelete
quickDelete(array $params)
Performs a single quick delete operation.
Definition: FileBackend.php:704
FileBackend\getFileContentsMulti
getFileContentsMulti(array $params)
Like getFileContents() except it takes an array of storage paths and returns a map of storage paths t...
MWException
MediaWiki exception.
Definition: MWException.php:26
NullLockManager
Simple version of LockManager that does nothing.
Definition: LockManager.php:253
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1127
FileBackend\getFileTimestamp
getFileTimestamp(array $params)
Get the last-modified timestamp of the file at a storage path.
FileBackend\getFileSize
getFileSize(array $params)
Get the size (bytes) of a file at a storage path in the backend.
FileBackend\doClean
doClean(array $params)
FileBackend\isStoragePath
static isStoragePath( $path)
Check if a given path is a "mwstore://" path.
Definition: FileBackend.php:1330
FileBackend\$concurrency
int $concurrency
How many operations can be done in parallel *.
Definition: FileBackend.php:94
FileJournal
Class for handling file operation journaling.
Definition: FileJournal.php:38
FileBackend\getFileSha1Base36
getFileSha1Base36(array $params)
Get a SHA-1 hash of the file at a storage path in the backend.
FileBackend\getTopFileList
getTopFileList(array $params)
Same as FileBackend::getFileList() except only lists files that are immediately under the given direc...
Definition: FileBackend.php:1180
FileBackend\__construct
__construct(array $config)
Create a new backend instance from configuration.
Definition: FileBackend.php:128
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
FileBackend\hasFeatures
hasFeatures( $bitfield)
Check if the backend medium supports a field of extra features.
Definition: FileBackend.php:217
FileBackend\quickStore
quickStore(array $params)
Performs a single quick store operation.
Definition: FileBackend.php:662
FileBackend\doOperations
doOperations(array $ops, array $opts=array())
This is the main entry point into the backend for write operations.
Definition: FileBackend.php:367
list
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
ScopedCallback
Class for asserting that a callback happens when an dummy object leaves scope.
Definition: ScopedCallback.php:28
FileBackend\quickCreate
quickCreate(array $params)
Performs a single quick create operation.
Definition: FileBackend.php:648
wfWikiID
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
Definition: GlobalFunctions.php:3613
FileBackend\ATTR_METADATA
const ATTR_METADATA
Definition: FileBackend.php:102
FileBackend\quickCopy
quickCopy(array $params)
Performs a single quick copy operation.
Definition: FileBackend.php:676
FileBackend\quickDescribe
quickDescribe(array $params)
Performs a single quick describe operation.
Definition: FileBackend.php:718
FileBackend\getLocalCopyMulti
getLocalCopyMulti(array $params)
Like getLocalCopy() except it takes an array of storage paths and returns a map of storage paths to T...
FileBackend\fileExists
fileExists(array $params)
Check if a file exists at a storage path in the backend.
FileBackend\doQuickOperations
doQuickOperations(array $ops, array $opts=array())
Perform a set of independent file operations on some files.
Definition: FileBackend.php:601
FileBackend\preloadCache
preloadCache(array $paths)
Preload persistent file stat cache and property cache into in-process cache.
FileBackend\$parallelize
string $parallelize
When to do operations in parallel *.
Definition: FileBackend.php:92
FileBackend\prepare
prepare(array $params)
Prepare a storage directory for usage.
Definition: FileBackend.php:754
FileBackend\getScopedLocksForOps
getScopedLocksForOps(array $ops, Status $status)
Get an array of scoped locks needed for a batch of file operations.
FileBackend\doSecure
doSecure(array $params)
FileBackend\doOperationsInternal
doOperationsInternal(array $ops, array $opts)
FileBackend\clearCache
clearCache(array $paths=null)
Invalidate any in-process file stat and property cache.
FileBackend\describe
describe(array $params, array $opts=array())
Performs a single describe operation.
Definition: FileBackend.php:487
FileBackend\getFileList
getFileList(array $params)
Get an iterator to list all stored files under a storage directory.
FileBackend\lockFiles
lockFiles(array $paths, $type)
Lock the files at the given storage paths in the backend.
Definition: FileBackend.php:1228
FileBackend\getRootStoragePath
getRootStoragePath()
Get the root storage path of this backend.
Definition: FileBackend.php:1299
FileBackend\extensionFromPath
static extensionFromPath( $path)
Get the final extension from a storage or FS path.
Definition: FileBackend.php:1400
FileBackend\$name
string $name
Unique backend name *.
Definition: FileBackend.php:86
FileBackend\clean
clean(array $params)
Delete a storage directory if it is empty.
Definition: FileBackend.php:838
FileBackend\getLocalCopy
getLocalCopy(array $params)
Get a local copy on disk of the file at a storage path in the backend.
Definition: FileBackend.php:1054
$path
$path
Definition: NoLocalSettings.php:35
as
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
FileBackend\getFileProps
getFileProps(array $params)
Get the properties of the file at a storage path in the backend.
FileBackend\isPathTraversalFree
static isPathTraversalFree( $path)
Check if a relative path has no directory traversals.
Definition: FileBackend.php:1413
FileBackend\getJournal
getJournal()
Get the file journal object for this backend.
Definition: FileBackend.php:1319
FileBackend\concatenate
concatenate(array $params)
Concatenate a list of storage files into a single file system file.
FileBackend\getTopDirectoryList
getTopDirectoryList(array $params)
Same as FileBackend::getDirectoryList() except only lists directories that are immediately under the ...
Definition: FileBackend.php:1142
FileBackend\getLocalReference
getLocalReference(array $params)
Returns a file system file, identical to the file at a storage path.
Definition: FileBackend.php:1021
name
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
FileBackend\$fileJournal
FileJournal $fileJournal
Definition: FileBackend.php:98
FileBackend\getFeatures
getFeatures()
Get the a bitfield of extra features supported by the backend medium.
Definition: FileBackend.php:206
FileJournal\factory
static factory(array $config, $backend)
Create an appropriate FileJournal object from config.
Definition: FileJournal.php:61
FileBackend\getContainerStoragePath
getContainerStoragePath( $container)
Get the storage path for the given container for this backend.
Definition: FileBackend.php:1310
FileBackend\create
create(array $params, array $opts=array())
Performs a single create operation.
Definition: FileBackend.php:416
FileBackend\getFileContents
getFileContents(array $params)
Get the contents of a file at a storage path in the backend.
Definition: FileBackend.php:899
FileBackend\doQuickOperation
doQuickOperation(array $op)
Same as doQuickOperations() except it takes a single operation.
Definition: FileBackend.php:634
FileBackend\getWikiId
getWikiId()
Get the wiki identifier used for this backend (possibly empty).
Definition: FileBackend.php:178
ScopedLock\factory
static factory(LockManager $manager, array $paths, $type, Status $status, $timeout=0)
Get a ScopedLock object representing a lock on resource paths.
Definition: ScopedLock.php:66
FileBackend\move
move(array $params, array $opts=array())
Performs a single move operation.
Definition: FileBackend.php:458
FileBackend\secure
secure(array $params)
Take measures to block web access to a storage directory and the container it belongs to.
Definition: FileBackend.php:783
FileBackend\parentStoragePath
static parentStoragePath( $storagePath)
Get the parent storage directory of a storage path.
Definition: FileBackend.php:1387
Status\newFatal
static newFatal( $message)
Factory function for fatal errors.
Definition: Status.php:63
FileBackend\isReadOnly
isReadOnly()
Check if this backend is read-only.
Definition: FileBackend.php:187
$type
$type
Definition: testCompression.php:46
FileBackend\makeContentDisposition
static makeContentDisposition( $type, $filename='')
Build a Content-Disposition header value per RFC 6266.
Definition: FileBackend.php:1426