MediaWiki  1.23.8
FileBackendMultiWrite.php
Go to the documentation of this file.
1 <?php
46  protected $backends = array();
47 
49  protected $masterIndex = -1;
50 
52  protected $syncChecks = 0;
53 
55  protected $autoResync = false;
56 
58  protected $noPushDirConts = array();
59 
61  protected $noPushQuickOps = false;
62 
63  /* Possible internal backend consistency checks */
64  const CHECK_SIZE = 1;
65  const CHECK_TIME = 2;
66  const CHECK_SHA1 = 4;
67 
97  public function __construct( array $config ) {
98  parent::__construct( $config );
99  $this->syncChecks = isset( $config['syncChecks'] )
100  ? $config['syncChecks']
102  $this->autoResync = isset( $config['autoResync'] )
103  ? $config['autoResync']
104  : false;
105  $this->noPushQuickOps = isset( $config['noPushQuickOps'] )
106  ? $config['noPushQuickOps']
107  : false;
108  $this->noPushDirConts = isset( $config['noPushDirConts'] )
109  ? $config['noPushDirConts']
110  : array();
111  // Construct backends here rather than via registration
112  // to keep these backends hidden from outside the proxy.
113  $namesUsed = array();
114  foreach ( $config['backends'] as $index => $config ) {
115  if ( isset( $config['template'] ) ) {
116  // Config is just a modified version of a registered backend's.
117  // This should only be used when that config is used only by this backend.
118  $config = $config + FileBackendGroup::singleton()->config( $config['template'] );
119  }
120  $name = $config['name'];
121  if ( isset( $namesUsed[$name] ) ) { // don't break FileOp predicates
122  throw new FileBackendError( "Two or more backends defined with the name $name." );
123  }
124  $namesUsed[$name] = 1;
125  // Alter certain sub-backend settings for sanity
126  unset( $config['readOnly'] ); // use proxy backend setting
127  unset( $config['fileJournal'] ); // use proxy backend journal
128  unset( $config['lockManager'] ); // lock under proxy backend
129  $config['wikiId'] = $this->wikiId; // use the proxy backend wiki ID
130  if ( !empty( $config['isMultiMaster'] ) ) {
131  if ( $this->masterIndex >= 0 ) {
132  throw new FileBackendError( 'More than one master backend defined.' );
133  }
134  $this->masterIndex = $index; // this is the "master"
135  $config['fileJournal'] = $this->fileJournal; // log under proxy backend
136  }
137  // Create sub-backend object
138  if ( !isset( $config['class'] ) ) {
139  throw new FileBackendError( 'No class given for a backend config.' );
140  }
141  $class = $config['class'];
142  $this->backends[$index] = new $class( $config );
143  }
144  if ( $this->masterIndex < 0 ) { // need backends and must have a master
145  throw new FileBackendError( 'No master backend defined.' );
146  }
147  }
148 
149  final protected function doOperationsInternal( array $ops, array $opts ) {
150  $status = Status::newGood();
151 
152  $mbe = $this->backends[$this->masterIndex]; // convenience
153 
154  // Try to lock those files for the scope of this function...
155  if ( empty( $opts['nonLocking'] ) ) {
156  // Try to lock those files for the scope of this function...
157  $scopeLock = $this->getScopedLocksForOps( $ops, $status );
158  if ( !$status->isOK() ) {
159  return $status; // abort
160  }
161  }
162  // Clear any cache entries (after locks acquired)
163  $this->clearCache();
164  $opts['preserveCache'] = true; // only locked files are cached
165  // Get the list of paths to read/write...
166  $relevantPaths = $this->fileStoragePathsForOps( $ops );
167  // Check if the paths are valid and accessible on all backends...
168  $status->merge( $this->accessibilityCheck( $relevantPaths ) );
169  if ( !$status->isOK() ) {
170  return $status; // abort
171  }
172  // Do a consistency check to see if the backends are consistent...
173  $syncStatus = $this->consistencyCheck( $relevantPaths );
174  if ( !$syncStatus->isOK() ) {
175  wfDebugLog( 'FileOperation', get_class( $this ) .
176  " failed sync check: " . FormatJson::encode( $relevantPaths ) );
177  // Try to resync the clone backends to the master on the spot...
178  if ( !$this->autoResync || !$this->resyncFiles( $relevantPaths )->isOK() ) {
179  $status->merge( $syncStatus );
180 
181  return $status; // abort
182  }
183  }
184  // Actually attempt the operation batch on the master backend...
185  $realOps = $this->substOpBatchPaths( $ops, $mbe );
186  $masterStatus = $mbe->doOperations( $realOps, $opts );
187  $status->merge( $masterStatus );
188  // Propagate the operations to the clone backends if there were no unexpected errors
189  // and if there were either no expected errors or if the 'force' option was used.
190  // However, if nothing succeeded at all, then don't replicate any of the operations.
191  // If $ops only had one operation, this might avoid backend sync inconsistencies.
192  if ( $masterStatus->isOK() && $masterStatus->successCount > 0 ) {
193  foreach ( $this->backends as $index => $backend ) {
194  if ( $index !== $this->masterIndex ) { // not done already
195  $realOps = $this->substOpBatchPaths( $ops, $backend );
196  $status->merge( $backend->doOperations( $realOps, $opts ) );
197  }
198  }
199  }
200  // Make 'success', 'successCount', and 'failCount' fields reflect
201  // the overall operation, rather than all the batches for each backend.
202  // Do this by only using success values from the master backend's batch.
203  $status->success = $masterStatus->success;
204  $status->successCount = $masterStatus->successCount;
205  $status->failCount = $masterStatus->failCount;
206 
207  return $status;
208  }
209 
216  public function consistencyCheck( array $paths ) {
217  $status = Status::newGood();
218  if ( $this->syncChecks == 0 || count( $this->backends ) <= 1 ) {
219  return $status; // skip checks
220  }
221 
222  $mBackend = $this->backends[$this->masterIndex];
223  foreach ( $paths as $path ) {
224  $params = array( 'src' => $path, 'latest' => true );
225  $mParams = $this->substOpPaths( $params, $mBackend );
226  // Stat the file on the 'master' backend
227  $mStat = $mBackend->getFileStat( $mParams );
228  if ( $this->syncChecks & self::CHECK_SHA1 ) {
229  $mSha1 = $mBackend->getFileSha1Base36( $mParams );
230  } else {
231  $mSha1 = false;
232  }
233  // Check if all clone backends agree with the master...
234  foreach ( $this->backends as $index => $cBackend ) {
235  if ( $index === $this->masterIndex ) {
236  continue; // master
237  }
238  $cParams = $this->substOpPaths( $params, $cBackend );
239  $cStat = $cBackend->getFileStat( $cParams );
240  if ( $mStat ) { // file is in master
241  if ( !$cStat ) { // file should exist
242  $status->fatal( 'backend-fail-synced', $path );
243  continue;
244  }
245  if ( $this->syncChecks & self::CHECK_SIZE ) {
246  if ( $cStat['size'] != $mStat['size'] ) { // wrong size
247  $status->fatal( 'backend-fail-synced', $path );
248  continue;
249  }
250  }
251  if ( $this->syncChecks & self::CHECK_TIME ) {
252  $mTs = wfTimestamp( TS_UNIX, $mStat['mtime'] );
253  $cTs = wfTimestamp( TS_UNIX, $cStat['mtime'] );
254  if ( abs( $mTs - $cTs ) > 30 ) { // outdated file somewhere
255  $status->fatal( 'backend-fail-synced', $path );
256  continue;
257  }
258  }
259  if ( $this->syncChecks & self::CHECK_SHA1 ) {
260  if ( $cBackend->getFileSha1Base36( $cParams ) !== $mSha1 ) { // wrong SHA1
261  $status->fatal( 'backend-fail-synced', $path );
262  continue;
263  }
264  }
265  } else { // file is not in master
266  if ( $cStat ) { // file should not exist
267  $status->fatal( 'backend-fail-synced', $path );
268  }
269  }
270  }
271  }
272 
273  return $status;
274  }
275 
282  public function accessibilityCheck( array $paths ) {
283  $status = Status::newGood();
284  if ( count( $this->backends ) <= 1 ) {
285  return $status; // skip checks
286  }
287 
288  foreach ( $paths as $path ) {
289  foreach ( $this->backends as $backend ) {
290  $realPath = $this->substPaths( $path, $backend );
291  if ( !$backend->isPathUsableInternal( $realPath ) ) {
292  $status->fatal( 'backend-fail-usable', $path );
293  }
294  }
295  }
296 
297  return $status;
298  }
299 
307  public function resyncFiles( array $paths ) {
308  $status = Status::newGood();
309 
310  $mBackend = $this->backends[$this->masterIndex];
311  foreach ( $paths as $path ) {
312  $mPath = $this->substPaths( $path, $mBackend );
313  $mSha1 = $mBackend->getFileSha1Base36( array( 'src' => $mPath, 'latest' => true ) );
314  $mStat = $mBackend->getFileStat( array( 'src' => $mPath, 'latest' => true ) );
315  if ( $mStat === null || ( $mSha1 !== false && !$mStat ) ) { // sanity
316  $status->fatal( 'backend-fail-internal', $this->name );
317  continue; // file is not available on the master backend...
318  }
319  // Check of all clone backends agree with the master...
320  foreach ( $this->backends as $index => $cBackend ) {
321  if ( $index === $this->masterIndex ) {
322  continue; // master
323  }
324  $cPath = $this->substPaths( $path, $cBackend );
325  $cSha1 = $cBackend->getFileSha1Base36( array( 'src' => $cPath, 'latest' => true ) );
326  $cStat = $cBackend->getFileStat( array( 'src' => $cPath, 'latest' => true ) );
327  if ( $cStat === null || ( $cSha1 !== false && !$cStat ) ) { // sanity
328  $status->fatal( 'backend-fail-internal', $cBackend->getName() );
329  continue; // file is not available on the clone backend...
330  }
331  if ( $mSha1 === $cSha1 ) {
332  // already synced; nothing to do
333  } elseif ( $mSha1 !== false ) { // file is in master
334  if ( $this->autoResync === 'conservative'
335  && $cStat && $cStat['mtime'] > $mStat['mtime']
336  ) {
337  $status->fatal( 'backend-fail-synced', $path );
338  continue; // don't rollback data
339  }
340  $fsFile = $mBackend->getLocalReference(
341  array( 'src' => $mPath, 'latest' => true ) );
342  $status->merge( $cBackend->quickStore(
343  array( 'src' => $fsFile->getPath(), 'dst' => $cPath )
344  ) );
345  } elseif ( $mStat === false ) { // file is not in master
346  if ( $this->autoResync === 'conservative' ) {
347  $status->fatal( 'backend-fail-synced', $path );
348  continue; // don't delete data
349  }
350  $status->merge( $cBackend->quickDelete( array( 'src' => $cPath ) ) );
351  }
352  }
353  }
354 
355  return $status;
356  }
357 
364  protected function fileStoragePathsForOps( array $ops ) {
365  $paths = array();
366  foreach ( $ops as $op ) {
367  if ( isset( $op['src'] ) ) {
368  // For things like copy/move/delete with "ignoreMissingSource" and there
369  // is no source file, nothing should happen and there should be no errors.
370  if ( empty( $op['ignoreMissingSource'] )
371  || $this->fileExists( array( 'src' => $op['src'] ) )
372  ) {
373  $paths[] = $op['src'];
374  }
375  }
376  if ( isset( $op['srcs'] ) ) {
377  $paths = array_merge( $paths, $op['srcs'] );
378  }
379  if ( isset( $op['dst'] ) ) {
380  $paths[] = $op['dst'];
381  }
382  }
383 
384  return array_values( array_unique( array_filter( $paths, 'FileBackend::isStoragePath' ) ) );
385  }
386 
395  protected function substOpBatchPaths( array $ops, FileBackendStore $backend ) {
396  $newOps = array(); // operations
397  foreach ( $ops as $op ) {
398  $newOp = $op; // operation
399  foreach ( array( 'src', 'srcs', 'dst', 'dir' ) as $par ) {
400  if ( isset( $newOp[$par] ) ) { // string or array
401  $newOp[$par] = $this->substPaths( $newOp[$par], $backend );
402  }
403  }
404  $newOps[] = $newOp;
405  }
406 
407  return $newOps;
408  }
409 
417  protected function substOpPaths( array $ops, FileBackendStore $backend ) {
418  $newOps = $this->substOpBatchPaths( array( $ops ), $backend );
419 
420  return $newOps[0];
421  }
422 
430  protected function substPaths( $paths, FileBackendStore $backend ) {
431  return preg_replace(
432  '!^mwstore://' . preg_quote( $this->name ) . '/!',
433  StringUtils::escapeRegexReplacement( "mwstore://{$backend->getName()}/" ),
434  $paths // string or array
435  );
436  }
437 
444  protected function unsubstPaths( $paths ) {
445  return preg_replace(
446  '!^mwstore://([^/]+)!',
447  StringUtils::escapeRegexReplacement( "mwstore://{$this->name}" ),
448  $paths // string or array
449  );
450  }
451 
452  protected function doQuickOperationsInternal( array $ops ) {
453  $status = Status::newGood();
454  // Do the operations on the master backend; setting Status fields...
455  $realOps = $this->substOpBatchPaths( $ops, $this->backends[$this->masterIndex] );
456  $masterStatus = $this->backends[$this->masterIndex]->doQuickOperations( $realOps );
457  $status->merge( $masterStatus );
458  // Propagate the operations to the clone backends...
459  if ( !$this->noPushQuickOps ) {
460  foreach ( $this->backends as $index => $backend ) {
461  if ( $index !== $this->masterIndex ) { // not done already
462  $realOps = $this->substOpBatchPaths( $ops, $backend );
463  $status->merge( $backend->doQuickOperations( $realOps ) );
464  }
465  }
466  }
467  // Make 'success', 'successCount', and 'failCount' fields reflect
468  // the overall operation, rather than all the batches for each backend.
469  // Do this by only using success values from the master backend's batch.
470  $status->success = $masterStatus->success;
471  $status->successCount = $masterStatus->successCount;
472  $status->failCount = $masterStatus->failCount;
473 
474  return $status;
475  }
476 
481  protected function replicateContainerDirChanges( $path ) {
482  list( , $shortCont, ) = self::splitStoragePath( $path );
483 
484  return !in_array( $shortCont, $this->noPushDirConts );
485  }
486 
487  protected function doPrepare( array $params ) {
488  $status = Status::newGood();
489  $replicate = $this->replicateContainerDirChanges( $params['dir'] );
490  foreach ( $this->backends as $index => $backend ) {
491  if ( $replicate || $index == $this->masterIndex ) {
492  $realParams = $this->substOpPaths( $params, $backend );
493  $status->merge( $backend->doPrepare( $realParams ) );
494  }
495  }
496 
497  return $status;
498  }
499 
500  protected function doSecure( array $params ) {
501  $status = Status::newGood();
502  $replicate = $this->replicateContainerDirChanges( $params['dir'] );
503  foreach ( $this->backends as $index => $backend ) {
504  if ( $replicate || $index == $this->masterIndex ) {
505  $realParams = $this->substOpPaths( $params, $backend );
506  $status->merge( $backend->doSecure( $realParams ) );
507  }
508  }
509 
510  return $status;
511  }
512 
513  protected function doPublish( array $params ) {
514  $status = Status::newGood();
515  $replicate = $this->replicateContainerDirChanges( $params['dir'] );
516  foreach ( $this->backends as $index => $backend ) {
517  if ( $replicate || $index == $this->masterIndex ) {
518  $realParams = $this->substOpPaths( $params, $backend );
519  $status->merge( $backend->doPublish( $realParams ) );
520  }
521  }
522 
523  return $status;
524  }
525 
526  protected function doClean( array $params ) {
527  $status = Status::newGood();
528  $replicate = $this->replicateContainerDirChanges( $params['dir'] );
529  foreach ( $this->backends as $index => $backend ) {
530  if ( $replicate || $index == $this->masterIndex ) {
531  $realParams = $this->substOpPaths( $params, $backend );
532  $status->merge( $backend->doClean( $realParams ) );
533  }
534  }
535 
536  return $status;
537  }
538 
539  public function concatenate( array $params ) {
540  // We are writing to an FS file, so we don't need to do this per-backend
541  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
542 
543  return $this->backends[$this->masterIndex]->concatenate( $realParams );
544  }
545 
546  public function fileExists( array $params ) {
547  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
548 
549  return $this->backends[$this->masterIndex]->fileExists( $realParams );
550  }
551 
552  public function getFileTimestamp( array $params ) {
553  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
554 
555  return $this->backends[$this->masterIndex]->getFileTimestamp( $realParams );
556  }
557 
558  public function getFileSize( array $params ) {
559  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
560 
561  return $this->backends[$this->masterIndex]->getFileSize( $realParams );
562  }
563 
564  public function getFileStat( array $params ) {
565  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
566 
567  return $this->backends[$this->masterIndex]->getFileStat( $realParams );
568  }
569 
570  public function getFileXAttributes( array $params ) {
571  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
572 
573  return $this->backends[$this->masterIndex]->getFileXAttributes( $realParams );
574  }
575 
576  public function getFileContentsMulti( array $params ) {
577  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
578  $contentsM = $this->backends[$this->masterIndex]->getFileContentsMulti( $realParams );
579 
580  $contents = array(); // (path => FSFile) mapping using the proxy backend's name
581  foreach ( $contentsM as $path => $data ) {
582  $contents[$this->unsubstPaths( $path )] = $data;
583  }
584 
585  return $contents;
586  }
587 
588  public function getFileSha1Base36( array $params ) {
589  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
590 
591  return $this->backends[$this->masterIndex]->getFileSha1Base36( $realParams );
592  }
593 
594  public function getFileProps( array $params ) {
595  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
596 
597  return $this->backends[$this->masterIndex]->getFileProps( $realParams );
598  }
599 
600  public function streamFile( array $params ) {
601  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
602 
603  return $this->backends[$this->masterIndex]->streamFile( $realParams );
604  }
605 
606  public function getLocalReferenceMulti( array $params ) {
607  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
608  $fsFilesM = $this->backends[$this->masterIndex]->getLocalReferenceMulti( $realParams );
609 
610  $fsFiles = array(); // (path => FSFile) mapping using the proxy backend's name
611  foreach ( $fsFilesM as $path => $fsFile ) {
612  $fsFiles[$this->unsubstPaths( $path )] = $fsFile;
613  }
614 
615  return $fsFiles;
616  }
617 
618  public function getLocalCopyMulti( array $params ) {
619  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
620  $tempFilesM = $this->backends[$this->masterIndex]->getLocalCopyMulti( $realParams );
621 
622  $tempFiles = array(); // (path => TempFSFile) mapping using the proxy backend's name
623  foreach ( $tempFilesM as $path => $tempFile ) {
624  $tempFiles[$this->unsubstPaths( $path )] = $tempFile;
625  }
626 
627  return $tempFiles;
628  }
629 
630  public function getFileHttpUrl( array $params ) {
631  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
632 
633  return $this->backends[$this->masterIndex]->getFileHttpUrl( $realParams );
634  }
635 
636  public function directoryExists( array $params ) {
637  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
638 
639  return $this->backends[$this->masterIndex]->directoryExists( $realParams );
640  }
641 
642  public function getDirectoryList( array $params ) {
643  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
644 
645  return $this->backends[$this->masterIndex]->getDirectoryList( $realParams );
646  }
647 
648  public function getFileList( array $params ) {
649  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
650 
651  return $this->backends[$this->masterIndex]->getFileList( $realParams );
652  }
653 
654  public function getFeatures() {
655  return $this->backends[$this->masterIndex]->getFeatures();
656  }
657 
658  public function clearCache( array $paths = null ) {
659  foreach ( $this->backends as $backend ) {
660  $realPaths = is_array( $paths ) ? $this->substPaths( $paths, $backend ) : null;
661  $backend->clearCache( $realPaths );
662  }
663  }
664 
665  public function preloadCache( array $paths ) {
666  $realPaths = $this->substPaths( $paths, $this->backends[$this->masterIndex] );
667  $this->backends[$this->masterIndex]->preloadCache( $realPaths );
668  }
669 
670  public function preloadFileStat( array $params ) {
671  $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
672  $this->backends[$this->masterIndex]->preloadFileStat( $realParams );
673  }
674 
675  public function getScopedLocksForOps( array $ops, Status $status ) {
676  $realOps = $this->substOpBatchPaths( $ops, $this->backends[$this->masterIndex] );
677  $fileOps = $this->backends[$this->masterIndex]->getOperationsInternal( $realOps );
678  // Get the paths to lock from the master backend
679  $paths = $this->backends[$this->masterIndex]->getPathsToLockForOpsInternal( $fileOps );
680  // Get the paths under the proxy backend's name
681  $pbPaths = array(
684  );
685 
686  // Actually acquire the locks
687  return array( $this->getScopedFileLocks( $pbPaths, 'mixed', $status ) );
688  }
689 }
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
FileBackendMultiWrite\unsubstPaths
unsubstPaths( $paths)
Substitute the backend of internal storage paths with the proxy backend's name.
Definition: FileBackendMultiWrite.php:438
FileBackendMultiWrite\getFileList
getFileList(array $params)
Get an iterator to list all stored files under a storage directory.
Definition: FileBackendMultiWrite.php:642
FileBackendMultiWrite\doClean
doClean(array $params)
Definition: FileBackendMultiWrite.php:520
FileBackendMultiWrite\getFileXAttributes
getFileXAttributes(array $params)
Get metadata about a file at a storage path in the backend.
Definition: FileBackendMultiWrite.php:564
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
Base class for all file backend classes (including multi-write backends).
Definition: FileBackend.php:85
FileBackendMultiWrite\getLocalCopyMulti
getLocalCopyMulti(array $params)
Like getLocalCopy() except it takes an array of storage paths and returns a map of storage paths to T...
Definition: FileBackendMultiWrite.php:612
LockManager\LOCK_UW
const LOCK_UW
Definition: LockManager.php:59
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:2483
FileBackendMultiWrite\$autoResync
string bool $autoResync
Definition: FileBackendMultiWrite.php:51
FileBackendError
File backend exception for checked exceptions (e.g.
Definition: FileBackend.php:1492
wfDebugLog
wfDebugLog( $logGroup, $text, $dest='all')
Send a line to a supplementary debug log file, if configured, or main debug log if not.
Definition: GlobalFunctions.php:1040
FileBackendMultiWrite\doPublish
doPublish(array $params)
Definition: FileBackendMultiWrite.php:507
FileBackendMultiWrite\$masterIndex
int $masterIndex
Index of master backend *.
Definition: FileBackendMultiWrite.php:47
FileBackendMultiWrite\getFileProps
getFileProps(array $params)
Get the properties of the file at a storage path in the backend.
Definition: FileBackendMultiWrite.php:588
StringUtils\escapeRegexReplacement
static escapeRegexReplacement( $string)
Escape a string to make it suitable for inclusion in a preg_replace() replacement parameter.
Definition: StringUtils.php:296
Status\newGood
static newGood( $value=null)
Factory function for good results.
Definition: Status.php:77
$params
$params
Definition: styleTest.css.php:40
FileBackendMultiWrite\$backends
array $backends
Prioritized list of FileBackendStore objects.
Definition: FileBackendMultiWrite.php:45
FileBackendMultiWrite\substPaths
substPaths( $paths, FileBackendStore $backend)
Substitute the backend of storage paths with an internal backend's name.
Definition: FileBackendMultiWrite.php:424
FileBackendMultiWrite\directoryExists
directoryExists(array $params)
Check if a directory exists at a given storage path.
Definition: FileBackendMultiWrite.php:630
FileBackendMultiWrite\getFileStat
getFileStat(array $params)
Get quick information about a file at a storage path in the backend.
Definition: FileBackendMultiWrite.php:558
FileBackendMultiWrite\CHECK_TIME
const CHECK_TIME
Definition: FileBackendMultiWrite.php:59
FileBackendStore\doPublish
doPublish(array $params)
Definition: FileBackendStore.php:508
FileBackendGroup\singleton
static singleton()
Definition: FileBackendGroup.php:43
Status
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition: Status.php:40
FileBackendStore\doSecure
doSecure(array $params)
Definition: FileBackendStore.php:473
FileBackendStore\doPrepare
doPrepare(array $params)
Definition: FileBackendStore.php:438
FileBackendMultiWrite\doOperationsInternal
doOperationsInternal(array $ops, array $opts)
Definition: FileBackendMultiWrite.php:143
FileBackendMultiWrite\getFileSize
getFileSize(array $params)
Get the size (bytes) of a file at a storage path in the backend.
Definition: FileBackendMultiWrite.php:552
FileBackend\getScopedFileLocks
getScopedFileLocks(array $paths, $type, Status $status)
Lock the files at the given storage paths in the backend.
Definition: FileBackend.php:1262
FormatJson\encode
static encode( $value, $pretty=false, $escaping=0)
Returns the JSON representation of a value.
Definition: FormatJson.php:104
FileBackendMultiWrite\getLocalReferenceMulti
getLocalReferenceMulti(array $params)
Like getLocalReference() except it takes an array of storage paths and returns a map of storage paths...
Definition: FileBackendMultiWrite.php:600
FileBackendMultiWrite\clearCache
clearCache(array $paths=null)
Invalidate any in-process file stat and property cache.
Definition: FileBackendMultiWrite.php:652
FileBackendMultiWrite\$noPushQuickOps
bool $noPushQuickOps
Definition: FileBackendMultiWrite.php:55
FileBackendMultiWrite\getScopedLocksForOps
getScopedLocksForOps(array $ops, Status $status)
Get an array of scoped locks needed for a batch of file operations.
Definition: FileBackendMultiWrite.php:669
FileBackendMultiWrite\preloadFileStat
preloadFileStat(array $params)
Preload file stat information (concurrently if possible) into in-process cache.
Definition: FileBackendMultiWrite.php:664
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
FileBackendMultiWrite\doQuickOperationsInternal
doQuickOperationsInternal(array $ops)
Definition: FileBackendMultiWrite.php:446
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
FileBackendMultiWrite\fileExists
fileExists(array $params)
Check if a file exists at a storage path in the backend.
Definition: FileBackendMultiWrite.php:540
FileBackendMultiWrite\CHECK_SHA1
const CHECK_SHA1
Definition: FileBackendMultiWrite.php:60
FileBackendMultiWrite\getFeatures
getFeatures()
Get the a bitfield of extra features supported by the backend medium.
Definition: FileBackendMultiWrite.php:648
FileBackendMultiWrite\getFileSha1Base36
getFileSha1Base36(array $params)
Get a SHA-1 hash of the file at a storage path in the backend.
Definition: FileBackendMultiWrite.php:582
FileBackendMultiWrite\concatenate
concatenate(array $params)
Concatenate a list of storage files into a single file system file.
Definition: FileBackendMultiWrite.php:533
FileBackend\doQuickOperations
doQuickOperations(array $ops, array $opts=array())
Perform a set of independent file operations on some files.
Definition: FileBackend.php:601
FileBackendMultiWrite\resyncFiles
resyncFiles(array $paths)
Check that a set of files are consistent across all internal backends and re-synchronize those files ...
Definition: FileBackendMultiWrite.php:301
FileBackendStore
Base class for all backends using particular storage medium.
Definition: FileBackendStore.php:38
FileBackendMultiWrite\replicateContainerDirChanges
replicateContainerDirChanges( $path)
Definition: FileBackendMultiWrite.php:475
FileBackendMultiWrite
Proxy backend that mirrors writes to several internal backends.
Definition: FileBackendMultiWrite.php:42
FileBackendMultiWrite\getDirectoryList
getDirectoryList(array $params)
Get an iterator to list all directories under a storage directory.
Definition: FileBackendMultiWrite.php:636
FileBackendMultiWrite\getFileHttpUrl
getFileHttpUrl(array $params)
Return an HTTP URL to a given file that requires no authentication to use.
Definition: FileBackendMultiWrite.php:624
FileBackendStore\doClean
doClean(array $params)
Definition: FileBackendStore.php:543
FileBackendMultiWrite\CHECK_SIZE
const CHECK_SIZE
Definition: FileBackendMultiWrite.php:58
FileBackendMultiWrite\doPrepare
doPrepare(array $params)
Definition: FileBackendMultiWrite.php:481
FileBackendMultiWrite\fileStoragePathsForOps
fileStoragePathsForOps(array $ops)
Get a list of file storage paths to read or write for a list of operations.
Definition: FileBackendMultiWrite.php:358
FileBackendMultiWrite\substOpPaths
substOpPaths(array $ops, FileBackendStore $backend)
Same as substOpBatchPaths() but for a single operation.
Definition: FileBackendMultiWrite.php:411
FileBackend\$name
string $name
Unique backend name *.
Definition: FileBackend.php:86
FileBackendMultiWrite\getFileContentsMulti
getFileContentsMulti(array $params)
Like getFileContents() except it takes an array of storage paths and returns a map of storage paths t...
Definition: FileBackendMultiWrite.php:570
TS_UNIX
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
Definition: GlobalFunctions.php:2426
$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
FileBackendMultiWrite\__construct
__construct(array $config)
Construct a proxy backend that consists of several internal backends.
Definition: FileBackendMultiWrite.php:91
FileBackendMultiWrite\consistencyCheck
consistencyCheck(array $paths)
Check that a set of files are consistent across all internal backends.
Definition: FileBackendMultiWrite.php:210
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
FileBackendMultiWrite\accessibilityCheck
accessibilityCheck(array $paths)
Check that a set of file paths are usable across all internal backends.
Definition: FileBackendMultiWrite.php:276
FileBackendMultiWrite\$syncChecks
int $syncChecks
Bitfield *.
Definition: FileBackendMultiWrite.php:49
LockManager\LOCK_EX
const LOCK_EX
Definition: LockManager.php:60
FileBackendMultiWrite\doSecure
doSecure(array $params)
Definition: FileBackendMultiWrite.php:494
FileBackendMultiWrite\streamFile
streamFile(array $params)
Stream the file at a storage path in the backend.
Definition: FileBackendMultiWrite.php:594
FileBackendMultiWrite\$noPushDirConts
array $noPushDirConts
Definition: FileBackendMultiWrite.php:53
FileBackendMultiWrite\preloadCache
preloadCache(array $paths)
Preload persistent file stat cache and property cache into in-process cache.
Definition: FileBackendMultiWrite.php:659
FileBackendMultiWrite\getFileTimestamp
getFileTimestamp(array $params)
Get the last-modified timestamp of the file at a storage path.
Definition: FileBackendMultiWrite.php:546
FileBackendMultiWrite\substOpBatchPaths
substOpBatchPaths(array $ops, FileBackendStore $backend)
Substitute the backend name in storage path parameters for a set of operations with that of a given i...
Definition: FileBackendMultiWrite.php:389