Merge "Whitelist the <wbr> element."
[mediawiki.git] / includes / filebackend / FileOp.php
blob33a5c9e583a9604673be25096c0d79967c5df9b9
1 <?php
2 /**
3 * Helper class for representing operations with transaction support.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
21 * @ingroup FileBackend
22 * @author Aaron Schulz
25 /**
26 * FileBackend helper class for representing operations.
27 * Do not use this class from places outside FileBackend.
29 * Methods called from FileOpBatch::attempt() should avoid throwing
30 * exceptions at all costs. FileOp objects should be lightweight in order
31 * to support large arrays in memory and serialization.
33 * @ingroup FileBackend
34 * @since 1.19
36 abstract class FileOp {
37 /** @var Array */
38 protected $params = array();
39 /** @var FileBackendStore */
40 protected $backend;
42 protected $state = self::STATE_NEW; // integer
43 protected $failed = false; // boolean
44 protected $async = false; // boolean
45 protected $batchId; // string
47 protected $doOperation = true; // boolean; operation is not a no-op
48 protected $sourceSha1; // string
49 protected $overwriteSameCase; // boolean
50 protected $destExists; // boolean
52 /* Object life-cycle */
53 const STATE_NEW = 1;
54 const STATE_CHECKED = 2;
55 const STATE_ATTEMPTED = 3;
57 /**
58 * Build a new batch file operation transaction
60 * @param FileBackendStore $backend
61 * @param Array $params
62 * @throws MWException
64 final public function __construct( FileBackendStore $backend, array $params ) {
65 $this->backend = $backend;
66 list( $required, $optional ) = $this->allowedParams();
67 // @todo normalizeAnyStoragePaths() calls are overzealous, use a parameter list
68 foreach ( $required as $name ) {
69 if ( isset( $params[$name] ) ) {
70 // Normalize paths so the paths to the same file have the same string
71 $this->params[$name] = self::normalizeAnyStoragePaths( $params[$name] );
72 } else {
73 throw new MWException( "File operation missing parameter '$name'." );
76 foreach ( $optional as $name ) {
77 if ( isset( $params[$name] ) ) {
78 // Normalize paths so the paths to the same file have the same string
79 $this->params[$name] = self::normalizeAnyStoragePaths( $params[$name] );
82 $this->params = $params;
85 /**
86 * Normalize $item or anything in $item that is a valid storage path
88 * @param string $item|array
89 * @return string|Array
91 protected function normalizeAnyStoragePaths( $item ) {
92 if ( is_array( $item ) ) {
93 $res = array();
94 foreach ( $item as $k => $v ) {
95 $k = self::normalizeIfValidStoragePath( $k );
96 $v = self::normalizeIfValidStoragePath( $v );
97 $res[$k] = $v;
99 return $res;
100 } else {
101 return self::normalizeIfValidStoragePath( $item );
106 * Normalize a string if it is a valid storage path
108 * @param string $path
109 * @return string
111 protected static function normalizeIfValidStoragePath( $path ) {
112 if ( FileBackend::isStoragePath( $path ) ) {
113 $res = FileBackend::normalizeStoragePath( $path );
114 return ( $res !== null ) ? $res : $path;
116 return $path;
120 * Set the batch UUID this operation belongs to
122 * @param string $batchId
123 * @return void
125 final public function setBatchId( $batchId ) {
126 $this->batchId = $batchId;
130 * Get the value of the parameter with the given name
132 * @param string $name
133 * @return mixed Returns null if the parameter is not set
135 final public function getParam( $name ) {
136 return isset( $this->params[$name] ) ? $this->params[$name] : null;
140 * Check if this operation failed precheck() or attempt()
142 * @return bool
144 final public function failed() {
145 return $this->failed;
149 * Get a new empty predicates array for precheck()
151 * @return Array
153 final public static function newPredicates() {
154 return array( 'exists' => array(), 'sha1' => array() );
158 * Get a new empty dependency tracking array for paths read/written to
160 * @return Array
162 final public static function newDependencies() {
163 return array( 'read' => array(), 'write' => array() );
167 * Update a dependency tracking array to account for this operation
169 * @param array $deps Prior path reads/writes; format of FileOp::newPredicates()
170 * @return Array
172 final public function applyDependencies( array $deps ) {
173 $deps['read'] += array_fill_keys( $this->storagePathsRead(), 1 );
174 $deps['write'] += array_fill_keys( $this->storagePathsChanged(), 1 );
175 return $deps;
179 * Check if this operation changes files listed in $paths
181 * @param array $paths Prior path reads/writes; format of FileOp::newPredicates()
182 * @return boolean
184 final public function dependsOn( array $deps ) {
185 foreach ( $this->storagePathsChanged() as $path ) {
186 if ( isset( $deps['read'][$path] ) || isset( $deps['write'][$path] ) ) {
187 return true; // "output" or "anti" dependency
190 foreach ( $this->storagePathsRead() as $path ) {
191 if ( isset( $deps['write'][$path] ) ) {
192 return true; // "flow" dependency
195 return false;
199 * Get the file journal entries for this file operation
201 * @param array $oPredicates Pre-op info about files (format of FileOp::newPredicates)
202 * @param array $nPredicates Post-op info about files (format of FileOp::newPredicates)
203 * @return Array
205 final public function getJournalEntries( array $oPredicates, array $nPredicates ) {
206 if ( !$this->doOperation ) {
207 return array(); // this is a no-op
209 $nullEntries = array();
210 $updateEntries = array();
211 $deleteEntries = array();
212 $pathsUsed = array_merge( $this->storagePathsRead(), $this->storagePathsChanged() );
213 foreach ( array_unique( $pathsUsed ) as $path ) {
214 $nullEntries[] = array( // assertion for recovery
215 'op' => 'null',
216 'path' => $path,
217 'newSha1' => $this->fileSha1( $path, $oPredicates )
220 foreach ( $this->storagePathsChanged() as $path ) {
221 if ( $nPredicates['sha1'][$path] === false ) { // deleted
222 $deleteEntries[] = array(
223 'op' => 'delete',
224 'path' => $path,
225 'newSha1' => ''
227 } else { // created/updated
228 $updateEntries[] = array(
229 'op' => $this->fileExists( $path, $oPredicates ) ? 'update' : 'create',
230 'path' => $path,
231 'newSha1' => $nPredicates['sha1'][$path]
235 return array_merge( $nullEntries, $updateEntries, $deleteEntries );
239 * Check preconditions of the operation without writing anything.
240 * This must update $predicates for each path that the op can change
241 * except when a failing status object is returned.
243 * @param Array $predicates
244 * @return Status
246 final public function precheck( array &$predicates ) {
247 if ( $this->state !== self::STATE_NEW ) {
248 return Status::newFatal( 'fileop-fail-state', self::STATE_NEW, $this->state );
250 $this->state = self::STATE_CHECKED;
251 $status = $this->doPrecheck( $predicates );
252 if ( !$status->isOK() ) {
253 $this->failed = true;
255 return $status;
259 * @return Status
261 protected function doPrecheck( array &$predicates ) {
262 return Status::newGood();
266 * Attempt the operation
268 * @return Status
270 final public function attempt() {
271 if ( $this->state !== self::STATE_CHECKED ) {
272 return Status::newFatal( 'fileop-fail-state', self::STATE_CHECKED, $this->state );
273 } elseif ( $this->failed ) { // failed precheck
274 return Status::newFatal( 'fileop-fail-attempt-precheck' );
276 $this->state = self::STATE_ATTEMPTED;
277 if ( $this->doOperation ) {
278 $status = $this->doAttempt();
279 if ( !$status->isOK() ) {
280 $this->failed = true;
281 $this->logFailure( 'attempt' );
283 } else { // no-op
284 $status = Status::newGood();
286 return $status;
290 * @return Status
292 protected function doAttempt() {
293 return Status::newGood();
297 * Attempt the operation in the background
299 * @return Status
301 final public function attemptAsync() {
302 $this->async = true;
303 $result = $this->attempt();
304 $this->async = false;
305 return $result;
309 * Get the file operation parameters
311 * @return Array (required params list, optional params list)
313 protected function allowedParams() {
314 return array( array(), array() );
318 * Adjust params to FileBackendStore internal file calls
320 * @param Array $params
321 * @return Array (required params list, optional params list)
323 protected function setFlags( array $params ) {
324 return array( 'async' => $this->async ) + $params;
328 * Get a list of storage paths read from for this operation
330 * @return Array
332 public function storagePathsRead() {
333 return array();
337 * Get a list of storage paths written to for this operation
339 * @return Array
341 public function storagePathsChanged() {
342 return array();
346 * Check for errors with regards to the destination file already existing.
347 * Also set the destExists, overwriteSameCase and sourceSha1 member variables.
348 * A bad status will be returned if there is no chance it can be overwritten.
350 * @param Array $predicates
351 * @return Status
353 protected function precheckDestExistence( array $predicates ) {
354 $status = Status::newGood();
355 // Get hash of source file/string and the destination file
356 $this->sourceSha1 = $this->getSourceSha1Base36(); // FS file or data string
357 if ( $this->sourceSha1 === null ) { // file in storage?
358 $this->sourceSha1 = $this->fileSha1( $this->params['src'], $predicates );
360 $this->overwriteSameCase = false;
361 $this->destExists = $this->fileExists( $this->params['dst'], $predicates );
362 if ( $this->destExists ) {
363 if ( $this->getParam( 'overwrite' ) ) {
364 return $status; // OK
365 } elseif ( $this->getParam( 'overwriteSame' ) ) {
366 $dhash = $this->fileSha1( $this->params['dst'], $predicates );
367 // Check if hashes are valid and match each other...
368 if ( !strlen( $this->sourceSha1 ) || !strlen( $dhash ) ) {
369 $status->fatal( 'backend-fail-hashes' );
370 } elseif ( $this->sourceSha1 !== $dhash ) {
371 // Give an error if the files are not identical
372 $status->fatal( 'backend-fail-notsame', $this->params['dst'] );
373 } else {
374 $this->overwriteSameCase = true; // OK
376 return $status; // do nothing; either OK or bad status
377 } else {
378 $status->fatal( 'backend-fail-alreadyexists', $this->params['dst'] );
379 return $status;
382 return $status;
386 * precheckDestExistence() helper function to get the source file SHA-1.
387 * Subclasses should overwride this iff the source is not in storage.
389 * @return string|bool Returns false on failure
391 protected function getSourceSha1Base36() {
392 return null; // N/A
396 * Check if a file will exist in storage when this operation is attempted
398 * @param string $source Storage path
399 * @param Array $predicates
400 * @return bool
402 final protected function fileExists( $source, array $predicates ) {
403 if ( isset( $predicates['exists'][$source] ) ) {
404 return $predicates['exists'][$source]; // previous op assures this
405 } else {
406 $params = array( 'src' => $source, 'latest' => true );
407 return $this->backend->fileExists( $params );
412 * Get the SHA-1 of a file in storage when this operation is attempted
414 * @param string $source Storage path
415 * @param Array $predicates
416 * @return string|bool False on failure
418 final protected function fileSha1( $source, array $predicates ) {
419 if ( isset( $predicates['sha1'][$source] ) ) {
420 return $predicates['sha1'][$source]; // previous op assures this
421 } elseif ( isset( $predicates['exists'][$source] ) && !$predicates['exists'][$source] ) {
422 return false; // previous op assures this
423 } else {
424 $params = array( 'src' => $source, 'latest' => true );
425 return $this->backend->getFileSha1Base36( $params );
430 * Get the backend this operation is for
432 * @return FileBackendStore
434 public function getBackend() {
435 return $this->backend;
439 * Log a file operation failure and preserve any temp files
441 * @param string $action
442 * @return void
444 final public function logFailure( $action ) {
445 $params = $this->params;
446 $params['failedAction'] = $action;
447 try {
448 wfDebugLog( 'FileOperation', get_class( $this ) .
449 " failed (batch #{$this->batchId}): " . FormatJson::encode( $params ) );
450 } catch ( Exception $e ) {
451 // bad config? debug log error?
457 * Create a file in the backend with the given content.
458 * Parameters for this operation are outlined in FileBackend::doOperations().
460 class CreateFileOp extends FileOp {
461 protected function allowedParams() {
462 return array( array( 'content', 'dst' ),
463 array( 'overwrite', 'overwriteSame', 'headers' ) );
466 protected function doPrecheck( array &$predicates ) {
467 $status = Status::newGood();
468 // Check if the source data is too big
469 if ( strlen( $this->getParam( 'content' ) ) > $this->backend->maxFileSizeInternal() ) {
470 $status->fatal( 'backend-fail-maxsize',
471 $this->params['dst'], $this->backend->maxFileSizeInternal() );
472 $status->fatal( 'backend-fail-create', $this->params['dst'] );
473 return $status;
474 // Check if a file can be placed/changed at the destination
475 } elseif ( !$this->backend->isPathUsableInternal( $this->params['dst'] ) ) {
476 $status->fatal( 'backend-fail-usable', $this->params['dst'] );
477 $status->fatal( 'backend-fail-create', $this->params['dst'] );
478 return $status;
480 // Check if destination file exists
481 $status->merge( $this->precheckDestExistence( $predicates ) );
482 $this->params['dstExists'] = $this->destExists; // see FileBackendStore::setFileCache()
483 if ( $status->isOK() ) {
484 // Update file existence predicates
485 $predicates['exists'][$this->params['dst']] = true;
486 $predicates['sha1'][$this->params['dst']] = $this->sourceSha1;
488 return $status; // safe to call attempt()
491 protected function doAttempt() {
492 if ( !$this->overwriteSameCase ) {
493 // Create the file at the destination
494 return $this->backend->createInternal( $this->setFlags( $this->params ) );
496 return Status::newGood();
499 protected function getSourceSha1Base36() {
500 return wfBaseConvert( sha1( $this->params['content'] ), 16, 36, 31 );
503 public function storagePathsChanged() {
504 return array( $this->params['dst'] );
509 * Store a file into the backend from a file on the file system.
510 * Parameters for this operation are outlined in FileBackend::doOperations().
512 class StoreFileOp extends FileOp {
513 protected function allowedParams() {
514 return array( array( 'src', 'dst' ),
515 array( 'overwrite', 'overwriteSame', 'headers' ) );
518 protected function doPrecheck( array &$predicates ) {
519 $status = Status::newGood();
520 // Check if the source file exists on the file system
521 if ( !is_file( $this->params['src'] ) ) {
522 $status->fatal( 'backend-fail-notexists', $this->params['src'] );
523 return $status;
524 // Check if the source file is too big
525 } elseif ( filesize( $this->params['src'] ) > $this->backend->maxFileSizeInternal() ) {
526 $status->fatal( 'backend-fail-maxsize',
527 $this->params['dst'], $this->backend->maxFileSizeInternal() );
528 $status->fatal( 'backend-fail-store', $this->params['src'], $this->params['dst'] );
529 return $status;
530 // Check if a file can be placed/changed at the destination
531 } elseif ( !$this->backend->isPathUsableInternal( $this->params['dst'] ) ) {
532 $status->fatal( 'backend-fail-usable', $this->params['dst'] );
533 $status->fatal( 'backend-fail-store', $this->params['src'], $this->params['dst'] );
534 return $status;
536 // Check if destination file exists
537 $status->merge( $this->precheckDestExistence( $predicates ) );
538 $this->params['dstExists'] = $this->destExists; // see FileBackendStore::setFileCache()
539 if ( $status->isOK() ) {
540 // Update file existence predicates
541 $predicates['exists'][$this->params['dst']] = true;
542 $predicates['sha1'][$this->params['dst']] = $this->sourceSha1;
544 return $status; // safe to call attempt()
547 protected function doAttempt() {
548 if ( !$this->overwriteSameCase ) {
549 // Store the file at the destination
550 return $this->backend->storeInternal( $this->setFlags( $this->params ) );
552 return Status::newGood();
555 protected function getSourceSha1Base36() {
556 wfSuppressWarnings();
557 $hash = sha1_file( $this->params['src'] );
558 wfRestoreWarnings();
559 if ( $hash !== false ) {
560 $hash = wfBaseConvert( $hash, 16, 36, 31 );
562 return $hash;
565 public function storagePathsChanged() {
566 return array( $this->params['dst'] );
571 * Copy a file from one storage path to another in the backend.
572 * Parameters for this operation are outlined in FileBackend::doOperations().
574 class CopyFileOp extends FileOp {
575 protected function allowedParams() {
576 return array( array( 'src', 'dst' ),
577 array( 'overwrite', 'overwriteSame', 'ignoreMissingSource', 'headers' ) );
580 protected function doPrecheck( array &$predicates ) {
581 $status = Status::newGood();
582 // Check if the source file exists
583 if ( !$this->fileExists( $this->params['src'], $predicates ) ) {
584 if ( $this->getParam( 'ignoreMissingSource' ) ) {
585 $this->doOperation = false; // no-op
586 // Update file existence predicates (cache 404s)
587 $predicates['exists'][$this->params['src']] = false;
588 $predicates['sha1'][$this->params['src']] = false;
589 return $status; // nothing to do
590 } else {
591 $status->fatal( 'backend-fail-notexists', $this->params['src'] );
592 return $status;
594 // Check if a file can be placed/changed at the destination
595 } elseif ( !$this->backend->isPathUsableInternal( $this->params['dst'] ) ) {
596 $status->fatal( 'backend-fail-usable', $this->params['dst'] );
597 $status->fatal( 'backend-fail-copy', $this->params['src'], $this->params['dst'] );
598 return $status;
600 // Check if destination file exists
601 $status->merge( $this->precheckDestExistence( $predicates ) );
602 $this->params['dstExists'] = $this->destExists; // see FileBackendStore::setFileCache()
603 if ( $status->isOK() ) {
604 // Update file existence predicates
605 $predicates['exists'][$this->params['dst']] = true;
606 $predicates['sha1'][$this->params['dst']] = $this->sourceSha1;
608 return $status; // safe to call attempt()
611 protected function doAttempt() {
612 if ( $this->overwriteSameCase ) {
613 $status = Status::newGood(); // nothing to do
614 } elseif ( $this->params['src'] === $this->params['dst'] ) {
615 // Just update the destination file headers
616 $headers = $this->getParam( 'headers' ) ?: array();
617 $status = $this->backend->describeInternal( $this->setFlags( array(
618 'src' => $this->params['dst'], 'headers' => $headers
619 ) ) );
620 } else {
621 // Copy the file to the destination
622 $status = $this->backend->copyInternal( $this->setFlags( $this->params ) );
624 return $status;
627 public function storagePathsRead() {
628 return array( $this->params['src'] );
631 public function storagePathsChanged() {
632 return array( $this->params['dst'] );
637 * Move a file from one storage path to another in the backend.
638 * Parameters for this operation are outlined in FileBackend::doOperations().
640 class MoveFileOp extends FileOp {
641 protected function allowedParams() {
642 return array( array( 'src', 'dst' ),
643 array( 'overwrite', 'overwriteSame', 'ignoreMissingSource', 'headers' ) );
646 protected function doPrecheck( array &$predicates ) {
647 $status = Status::newGood();
648 // Check if the source file exists
649 if ( !$this->fileExists( $this->params['src'], $predicates ) ) {
650 if ( $this->getParam( 'ignoreMissingSource' ) ) {
651 $this->doOperation = false; // no-op
652 // Update file existence predicates (cache 404s)
653 $predicates['exists'][$this->params['src']] = false;
654 $predicates['sha1'][$this->params['src']] = false;
655 return $status; // nothing to do
656 } else {
657 $status->fatal( 'backend-fail-notexists', $this->params['src'] );
658 return $status;
660 // Check if a file can be placed/changed at the destination
661 } elseif ( !$this->backend->isPathUsableInternal( $this->params['dst'] ) ) {
662 $status->fatal( 'backend-fail-usable', $this->params['dst'] );
663 $status->fatal( 'backend-fail-move', $this->params['src'], $this->params['dst'] );
664 return $status;
666 // Check if destination file exists
667 $status->merge( $this->precheckDestExistence( $predicates ) );
668 $this->params['dstExists'] = $this->destExists; // see FileBackendStore::setFileCache()
669 if ( $status->isOK() ) {
670 // Update file existence predicates
671 $predicates['exists'][$this->params['src']] = false;
672 $predicates['sha1'][$this->params['src']] = false;
673 $predicates['exists'][$this->params['dst']] = true;
674 $predicates['sha1'][$this->params['dst']] = $this->sourceSha1;
676 return $status; // safe to call attempt()
679 protected function doAttempt() {
680 if ( $this->overwriteSameCase ) {
681 if ( $this->params['src'] === $this->params['dst'] ) {
682 // Do nothing to the destination (which is also the source)
683 $status = Status::newGood();
684 } else {
685 // Just delete the source as the destination file needs no changes
686 $status = $this->backend->deleteInternal( $this->setFlags(
687 array( 'src' => $this->params['src'] )
688 ) );
690 } elseif ( $this->params['src'] === $this->params['dst'] ) {
691 // Just update the destination file headers
692 $headers = $this->getParam( 'headers' ) ?: array();
693 $status = $this->backend->describeInternal( $this->setFlags(
694 array( 'src' => $this->params['dst'], 'headers' => $headers )
695 ) );
696 } else {
697 // Move the file to the destination
698 $status = $this->backend->moveInternal( $this->setFlags( $this->params ) );
700 return $status;
703 public function storagePathsRead() {
704 return array( $this->params['src'] );
707 public function storagePathsChanged() {
708 return array( $this->params['src'], $this->params['dst'] );
713 * Delete a file at the given storage path from the backend.
714 * Parameters for this operation are outlined in FileBackend::doOperations().
716 class DeleteFileOp extends FileOp {
717 protected function allowedParams() {
718 return array( array( 'src' ), array( 'ignoreMissingSource' ) );
721 protected function doPrecheck( array &$predicates ) {
722 $status = Status::newGood();
723 // Check if the source file exists
724 if ( !$this->fileExists( $this->params['src'], $predicates ) ) {
725 if ( $this->getParam( 'ignoreMissingSource' ) ) {
726 $this->doOperation = false; // no-op
727 // Update file existence predicates (cache 404s)
728 $predicates['exists'][$this->params['src']] = false;
729 $predicates['sha1'][$this->params['src']] = false;
730 return $status; // nothing to do
731 } else {
732 $status->fatal( 'backend-fail-notexists', $this->params['src'] );
733 return $status;
735 // Check if a file can be placed/changed at the source
736 } elseif ( !$this->backend->isPathUsableInternal( $this->params['src'] ) ) {
737 $status->fatal( 'backend-fail-usable', $this->params['src'] );
738 $status->fatal( 'backend-fail-delete', $this->params['src'] );
739 return $status;
741 // Update file existence predicates
742 $predicates['exists'][$this->params['src']] = false;
743 $predicates['sha1'][$this->params['src']] = false;
744 return $status; // safe to call attempt()
747 protected function doAttempt() {
748 // Delete the source file
749 return $this->backend->deleteInternal( $this->setFlags( $this->params ) );
752 public function storagePathsChanged() {
753 return array( $this->params['src'] );
758 * Change metadata for a file at the given storage path in the backend.
759 * Parameters for this operation are outlined in FileBackend::doOperations().
761 class DescribeFileOp extends FileOp {
762 protected function allowedParams() {
763 return array( array( 'src' ), array( 'headers' ) );
766 protected function doPrecheck( array &$predicates ) {
767 $status = Status::newGood();
768 // Check if the source file exists
769 if ( !$this->fileExists( $this->params['src'], $predicates ) ) {
770 $status->fatal( 'backend-fail-notexists', $this->params['src'] );
771 return $status;
772 // Check if a file can be placed/changed at the source
773 } elseif ( !$this->backend->isPathUsableInternal( $this->params['src'] ) ) {
774 $status->fatal( 'backend-fail-usable', $this->params['src'] );
775 $status->fatal( 'backend-fail-describe', $this->params['src'] );
776 return $status;
778 // Update file existence predicates
779 $predicates['exists'][$this->params['src']] =
780 $this->fileExists( $this->params['src'], $predicates );
781 $predicates['sha1'][$this->params['src']] =
782 $this->fileSha1( $this->params['src'], $predicates );
783 return $status; // safe to call attempt()
786 protected function doAttempt() {
787 // Update the source file's metadata
788 return $this->backend->describeInternal( $this->setFlags( $this->params ) );
791 public function storagePathsChanged() {
792 return array( $this->params['src'] );
797 * Placeholder operation that has no params and does nothing
799 class NullFileOp extends FileOp {}