[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/filebackend/ -> FileOp.php (summary)

Helper class for representing operations with transaction support. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Author: Aaron Schulz
File Size: 848 lines (25 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 7 classes

CreateFileOp:: (5 methods):
  allowedParams()
  doPrecheck()
  doAttempt()
  getSourceSha1Base36()
  storagePathsChanged()

StoreFileOp:: (5 methods):
  allowedParams()
  doPrecheck()
  doAttempt()
  getSourceSha1Base36()
  storagePathsChanged()

CopyFileOp:: (5 methods):
  allowedParams()
  doPrecheck()
  doAttempt()
  storagePathsRead()
  storagePathsChanged()

MoveFileOp:: (5 methods):
  allowedParams()
  doPrecheck()
  doAttempt()
  storagePathsRead()
  storagePathsChanged()

DeleteFileOp:: (4 methods):
  allowedParams()
  doPrecheck()
  doAttempt()
  storagePathsChanged()

DescribeFileOp:: (4 methods):
  allowedParams()
  doPrecheck()
  doAttempt()
  storagePathsChanged()

NullFileOp:: (0 methods):

Defines 0 functions

  __construct()
  normalizeIfValidStoragePath()
  setBatchId()
  getParam()
  failed()
  newPredicates()
  newDependencies()
  applyDependencies()
  dependsOn()
  getJournalEntries()
  precheck()
  doPrecheck()
  attempt()
  doAttempt()
  attemptAsync()
  allowedParams()
  setFlags()
  storagePathsRead()
  storagePathsChanged()
  precheckDestExistence()
  getSourceSha1Base36()
  fileExists()
  fileSha1()
  getBackend()
  logFailure()

Class: CreateFileOp  - X-Ref

Create a file in the backend with the given content.
Parameters for this operation are outlined in FileBackend::doOperations().

allowedParams()   X-Ref
No description

doPrecheck( array &$predicates )   X-Ref
No description

doAttempt()   X-Ref
No description

getSourceSha1Base36()   X-Ref
No description

storagePathsChanged()   X-Ref
No description

Class: StoreFileOp  - X-Ref

Store a file into the backend from a file on the file system.
Parameters for this operation are outlined in FileBackend::doOperations().

allowedParams()   X-Ref
No description

doPrecheck( array &$predicates )   X-Ref
No description

doAttempt()   X-Ref
No description

getSourceSha1Base36()   X-Ref
No description

storagePathsChanged()   X-Ref
No description

Class: CopyFileOp  - X-Ref

Copy a file from one storage path to another in the backend.
Parameters for this operation are outlined in FileBackend::doOperations().

allowedParams()   X-Ref
No description

doPrecheck( array &$predicates )   X-Ref
No description

doAttempt()   X-Ref
No description

storagePathsRead()   X-Ref
No description

storagePathsChanged()   X-Ref
No description

Class: MoveFileOp  - X-Ref

Move a file from one storage path to another in the backend.
Parameters for this operation are outlined in FileBackend::doOperations().

allowedParams()   X-Ref
No description

doPrecheck( array &$predicates )   X-Ref
No description

doAttempt()   X-Ref
No description

storagePathsRead()   X-Ref
No description

storagePathsChanged()   X-Ref
No description

Class: DeleteFileOp  - X-Ref

Delete a file at the given storage path from the backend.
Parameters for this operation are outlined in FileBackend::doOperations().

allowedParams()   X-Ref
No description

doPrecheck( array &$predicates )   X-Ref
No description

doAttempt()   X-Ref
No description

storagePathsChanged()   X-Ref
No description

Class: DescribeFileOp  - X-Ref

Change metadata for a file at the given storage path in the backend.
Parameters for this operation are outlined in FileBackend::doOperations().

allowedParams()   X-Ref
No description

doPrecheck( array &$predicates )   X-Ref
No description

doAttempt()   X-Ref
No description

storagePathsChanged()   X-Ref
No description

Class: NullFileOp  - X-Ref

Placeholder operation that has no params and does nothing

Functions
Functions that are not part of a class:

__construct( FileBackendStore $backend, array $params )   X-Ref
Build a new batch file operation transaction

param: FileBackendStore $backend
param: array $params

normalizeIfValidStoragePath( $path )   X-Ref
Normalize a string if it is a valid storage path

param: string $path
return: string

setBatchId( $batchId )   X-Ref
Set the batch UUID this operation belongs to

param: string $batchId

getParam( $name )   X-Ref
Get the value of the parameter with the given name

param: string $name
return: mixed Returns null if the parameter is not set

failed()   X-Ref
Check if this operation failed precheck() or attempt()

return: bool

newPredicates()   X-Ref
Get a new empty predicates array for precheck()

return: array

newDependencies()   X-Ref
Get a new empty dependency tracking array for paths read/written to

return: array

applyDependencies( array $deps )   X-Ref
Update a dependency tracking array to account for this operation

param: array $deps Prior path reads/writes; format of FileOp::newPredicates()
return: array

dependsOn( array $deps )   X-Ref
Check if this operation changes files listed in $paths

param: array $deps Prior path reads/writes; format of FileOp::newPredicates()
return: bool

getJournalEntries( array $oPredicates, array $nPredicates )   X-Ref
Get the file journal entries for this file operation

param: array $oPredicates Pre-op info about files (format of FileOp::newPredicates)
param: array $nPredicates Post-op info about files (format of FileOp::newPredicates)
return: array

precheck( array &$predicates )   X-Ref
Check preconditions of the operation without writing anything.
This must update $predicates for each path that the op can change
except when a failing status object is returned.

param: array $predicates
return: Status

doPrecheck( array &$predicates )   X-Ref

param: array $predicates
return: Status

attempt()   X-Ref
Attempt the operation

return: Status

doAttempt()   X-Ref

return: Status

attemptAsync()   X-Ref
Attempt the operation in the background

return: Status

allowedParams()   X-Ref
Get the file operation parameters

return: array (required params list, optional params list, list of params that are paths)

setFlags( array $params )   X-Ref
Adjust params to FileBackendStore internal file calls

param: array $params
return: array (required params list, optional params list)

storagePathsRead()   X-Ref
Get a list of storage paths read from for this operation

return: array

storagePathsChanged()   X-Ref
Get a list of storage paths written to for this operation

return: array

precheckDestExistence( array $predicates )   X-Ref
Check for errors with regards to the destination file already existing.
Also set the destExists, overwriteSameCase and sourceSha1 member variables.
A bad status will be returned if there is no chance it can be overwritten.

param: array $predicates
return: Status

getSourceSha1Base36()   X-Ref
precheckDestExistence() helper function to get the source file SHA-1.
Subclasses should overwride this if the source is not in storage.

return: string|bool Returns false on failure

fileExists( $source, array $predicates )   X-Ref
Check if a file will exist in storage when this operation is attempted

param: string $source Storage path
param: array $predicates
return: bool

fileSha1( $source, array $predicates )   X-Ref
Get the SHA-1 of a file in storage when this operation is attempted

param: string $source Storage path
param: array $predicates
return: string|bool False on failure

getBackend()   X-Ref
Get the backend this operation is for

return: FileBackendStore

logFailure( $action )   X-Ref
Log a file operation failure and preserve any temp files

param: string $action



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1