MediaWiki
REL1_20
|
Class for an OpenStack Swift based file backend. More...
Public Member Functions | |
__construct (array $config) | |
getDirectoryListInternal ($fullCont, $dir, array $params) | |
getDirListPageInternal ($fullCont, $dir, &$after, $limit, array $params) | |
Do not call this function outside of SwiftFileBackendFileList. | |
getFileContents (array $params) | |
getFileListInternal ($fullCont, $dir, array $params) | |
getFileListPageInternal ($fullCont, $dir, &$after, $limit, array $params) | |
Do not call this function outside of SwiftFileBackendFileList. | |
getLocalCopy (array $params) | |
isPathUsableInternal ($storagePath) | |
purgeCDNCache (array $objects) | |
Purge the CDN cache of affected objects if CDN caching is enabled. | |
Protected Member Functions | |
_getResponseCopy (CF_Async_Op $cfOp, Status $status, array $params) | |
_getResponseCreate (CF_Async_Op $cfOp, Status $status, array $params) | |
_getResponseDelete (CF_Async_Op $cfOp, Status $status, array $params) | |
_getResponseMove (CF_Async_Op $cfOp, Status $status, array $params) | |
_getResponseStore (CF_Async_Op $cfOp, Status $status, array $params) | |
addMissingMetadata (CF_Object $obj, $path) | |
Fill in any missing object metadata and save it to Swift. | |
closeConnection () | |
Close the connection to the Swift proxy. | |
createContainer ($container) | |
Create a Swift container. | |
deleteContainer ($container) | |
Delete a Swift container. | |
directoriesAreVirtual () | |
doCleanInternal ($fullCont, $dir, array $params) | |
doClearCache (array $paths=null) | |
doCopyInternal (array $params) | |
doCreateInternal (array $params) | |
doDeleteInternal (array $params) | |
doDirectoryExists ($fullCont, $dir, array $params) | |
doExecuteOpHandlesInternal (array $fileOpHandles) | |
doGetFileSha1base36 (array $params) | |
doGetFileStat (array $params) | |
doMoveInternal (array $params) | |
doPrepareInternal ($fullCont, $dir, array $params) | |
doPrimeContainerCache (array $containerInfo) | |
doPublishInternal ($fullCont, $dir, array $params) | |
doSecureInternal ($fullCont, $dir, array $params) | |
doStoreInternal (array $params) | |
doStreamFile (array $params) | |
getConnection () | |
Get an authenticated connection handle to the Swift proxy. | |
getContainer ($container, $bypassCache=false) | |
Get a Swift container object, possibly from process cache. | |
getParentDir ($path) | |
handleException (Exception $e, $status, $func, array $params) | |
Log an unexpected exception for this backend. | |
headersFromParams (array $params) | |
Get headers to send to Swift when reading a file based on a FileBackend params array, e.g. | |
resolveContainerPath ($container, $relStoragePath) | |
setContainerAccess (CF_Container $contObj, array $readGrps, array $writeGrps) | |
Set read/write permissions for a Swift container. | |
truncDisp ($disposition) | |
Protected Attributes | |
CF_Authentication | $auth |
* | |
$authTTL | |
CF_Connection | $conn |
* | |
ProcessCacheLRU | $connContainerCache |
* | |
$connErrorTime = 0 | |
CloudFilesException | $connException |
* | |
$sessionStarted = 0 | |
BagOStuff | $srvCache |
* | |
$swiftAnonUser | |
$swiftCDNExpiry | |
$swiftCDNPurgable | |
$swiftUseCDN | |
Private Member Functions | |
getCredsCacheKey ($username) | |
Get the cache key for a container. |
Class for an OpenStack Swift based file backend.
This requires the SwiftCloudFiles MediaWiki extension, which includes the php-cloudfiles library (https://github.com/rackspace/php-cloudfiles). php-cloudfiles requires the curl, fileinfo, and mb_string PHP extensions.
Status messages should avoid mentioning the Swift account name. Likewise, error suppression should be used to avoid path disclosure.
Definition at line 39 of file SwiftFileBackend.php.
SwiftFileBackend::__construct | ( | array $ | config | ) |
Reimplemented from FileBackendStore.
Definition at line 83 of file SwiftFileBackend.php.
SwiftFileBackend::_getResponseCopy | ( | CF_Async_Op $ | cfOp, |
Status $ | status, | ||
array $ | params | ||
) | [protected] |
Definition at line 441 of file SwiftFileBackend.php.
SwiftFileBackend::_getResponseCreate | ( | CF_Async_Op $ | cfOp, |
Status $ | status, | ||
array $ | params | ||
) | [protected] |
Definition at line 261 of file SwiftFileBackend.php.
SwiftFileBackend::_getResponseDelete | ( | CF_Async_Op $ | cfOp, |
Status $ | status, | ||
array $ | params | ||
) | [protected] |
Definition at line 572 of file SwiftFileBackend.php.
SwiftFileBackend::_getResponseMove | ( | CF_Async_Op $ | cfOp, |
Status $ | status, | ||
array $ | params | ||
) | [protected] |
Definition at line 522 of file SwiftFileBackend.php.
SwiftFileBackend::_getResponseStore | ( | CF_Async_Op $ | cfOp, |
Status $ | status, | ||
array $ | params | ||
) | [protected] |
Definition at line 361 of file SwiftFileBackend.php.
SwiftFileBackend::addMissingMetadata | ( | CF_Object $ | obj, |
$ | path | ||
) | [protected] |
Fill in any missing object metadata and save it to Swift.
$obj | CF_Object |
$path | string Storage path to object |
Exception | cloudfiles exceptions |
Definition at line 779 of file SwiftFileBackend.php.
Referenced by doGetFileStat().
SwiftFileBackend::closeConnection | ( | ) | [protected] |
Close the connection to the Swift proxy.
Definition at line 1246 of file SwiftFileBackend.php.
SwiftFileBackend::createContainer | ( | $ | container | ) | [protected] |
Create a Swift container.
$container | string Container name |
CloudFilesException |
Definition at line 1307 of file SwiftFileBackend.php.
Referenced by doPrepareInternal().
SwiftFileBackend::deleteContainer | ( | $ | container | ) | [protected] |
Delete a Swift container.
$container | string Container name |
CloudFilesException |
Definition at line 1321 of file SwiftFileBackend.php.
Referenced by doCleanInternal().
SwiftFileBackend::directoriesAreVirtual | ( | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 1080 of file SwiftFileBackend.php.
SwiftFileBackend::doCleanInternal | ( | $ | fullCont, |
$ | dir, | ||
array $ | params | ||
) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 705 of file SwiftFileBackend.php.
References $dir, deleteContainer(), getContainer(), handleException(), and Status\newGood().
SwiftFileBackend::doClearCache | ( | array $ | paths = null | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 1267 of file SwiftFileBackend.php.
SwiftFileBackend::doCopyInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 375 of file SwiftFileBackend.php.
References Status\fatal(), FileBackendStore\fileExists(), getContainer(), handleException(), Status\newGood(), purgeCDNCache(), FileBackendStore\resolveStoragePathReal(), and truncDisp().
SwiftFileBackend::doCreateInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 187 of file SwiftFileBackend.php.
References StreamFile\contentTypeFromPath(), FileBackendStore\fileExists(), getContainer(), handleException(), Status\newGood(), purgeCDNCache(), FileBackendStore\resolveStoragePathReal(), truncDisp(), and wfBaseConvert().
SwiftFileBackend::doDeleteInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 534 of file SwiftFileBackend.php.
References Status\fatal(), getContainer(), handleException(), Status\newGood(), purgeCDNCache(), and FileBackendStore\resolveStoragePathReal().
SwiftFileBackend::doDirectoryExists | ( | $ | fullCont, |
$ | dir, | ||
array $ | params | ||
) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 835 of file SwiftFileBackend.php.
References $dir, getContainer(), and handleException().
SwiftFileBackend::doExecuteOpHandlesInternal | ( | array $ | fileOpHandles | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 1104 of file SwiftFileBackend.php.
References handleException(), Status\newGood(), and purgeCDNCache().
SwiftFileBackend::doGetFileSha1base36 | ( | array $ | params | ) | [protected] |
Definition at line 991 of file SwiftFileBackend.php.
References FileBackendStore\getFileStat().
SwiftFileBackend::doGetFileStat | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 744 of file SwiftFileBackend.php.
References addMissingMetadata(), getContainer(), handleException(), headersFromParams(), FileBackendStore\resolveStoragePathReal(), and wfTimestamp().
SwiftFileBackend::doMoveInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 453 of file SwiftFileBackend.php.
References Status\fatal(), FileBackendStore\fileExists(), getContainer(), handleException(), Status\newGood(), purgeCDNCache(), FileBackendStore\resolveStoragePathReal(), and truncDisp().
SwiftFileBackend::doPrepareInternal | ( | $ | fullCont, |
$ | dir, | ||
array $ | params | ||
) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 588 of file SwiftFileBackend.php.
References $dir, createContainer(), doPublishInternal(), doSecureInternal(), getContainer(), handleException(), Status\merge(), and Status\newGood().
SwiftFileBackend::doPrimeContainerCache | ( | array $ | containerInfo | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 1331 of file SwiftFileBackend.php.
References $conn, getConnection(), and handleException().
SwiftFileBackend::doPublishInternal | ( | $ | fullCont, |
$ | dir, | ||
array $ | params | ||
) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 665 of file SwiftFileBackend.php.
References getContainer(), handleException(), Status\merge(), Status\newGood(), and setContainerAccess().
Referenced by doPrepareInternal().
SwiftFileBackend::doSecureInternal | ( | $ | fullCont, |
$ | dir, | ||
array $ | params | ||
) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 630 of file SwiftFileBackend.php.
References getContainer(), handleException(), Status\merge(), Status\newGood(), and setContainerAccess().
Referenced by doPrepareInternal().
SwiftFileBackend::doStoreInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 273 of file SwiftFileBackend.php.
References StreamFile\contentTypeFromPath(), Status\fatal(), FileBackendStore\fileExists(), getContainer(), handleException(), Status\newGood(), purgeCDNCache(), FileBackendStore\resolveStoragePathReal(), truncDisp(), wfBaseConvert(), wfRestoreWarnings(), and wfSuppressWarnings().
SwiftFileBackend::doStreamFile | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 1004 of file SwiftFileBackend.php.
References $output, Status\fatal(), getContainer(), handleException(), headersFromParams(), Status\newGood(), and FileBackendStore\resolveStoragePathReal().
SwiftFileBackend::getConnection | ( | ) | [protected] |
Get an authenticated connection handle to the Swift proxy.
CloudFilesException |
Definition at line 1200 of file SwiftFileBackend.php.
Referenced by doPrimeContainerCache().
SwiftFileBackend::getContainer | ( | $ | container, |
$ | bypassCache = false |
||
) | [protected] |
Get a Swift container object, possibly from process cache.
Use $reCache if the file count or byte count is needed.
$container | string Container name |
$bypassCache | bool Bypass all caches and load from Swift |
CloudFilesException |
Definition at line 1280 of file SwiftFileBackend.php.
Referenced by doCleanInternal(), doCopyInternal(), doCreateInternal(), doDeleteInternal(), doDirectoryExists(), doGetFileStat(), doMoveInternal(), doPrepareInternal(), doPublishInternal(), doSecureInternal(), doStoreInternal(), doStreamFile(), getFileContents(), getLocalCopy(), and isPathUsableInternal().
SwiftFileBackend::getCredsCacheKey | ( | $ | username | ) | [private] |
Get the cache key for a container.
$username | string |
Definition at line 1260 of file SwiftFileBackend.php.
SwiftFileBackend::getDirectoryListInternal | ( | $ | fullCont, |
$ | dir, | ||
array $ | params | ||
) |
Reimplemented from FileBackendStore.
Definition at line 854 of file SwiftFileBackend.php.
References $dir.
SwiftFileBackend::getDirListPageInternal | ( | $ | fullCont, |
$ | dir, | ||
&$ | after, | ||
$ | limit, | ||
array $ | params | ||
) |
Do not call this function outside of SwiftFileBackendFileList.
$fullCont | string Resolved container name |
$dir | string Resolved storage directory with no trailing slash |
$after | string|null Storage path of file to list items after |
$limit | integer Max number of items to list |
$params | Array Includes flag for 'topOnly' |
Definition at line 876 of file SwiftFileBackend.php.
SwiftFileBackend::getFileContents | ( | array $ | params | ) |
Reimplemented from FileBackendStore.
Definition at line 808 of file SwiftFileBackend.php.
References FileBackendStore\fileExists(), getContainer(), handleException(), headersFromParams(), and FileBackendStore\resolveStoragePathReal().
SwiftFileBackend::getFileListInternal | ( | $ | fullCont, |
$ | dir, | ||
array $ | params | ||
) |
Reimplemented from FileBackendStore.
Definition at line 862 of file SwiftFileBackend.php.
References $dir.
SwiftFileBackend::getFileListPageInternal | ( | $ | fullCont, |
$ | dir, | ||
&$ | after, | ||
$ | limit, | ||
array $ | params | ||
) |
Do not call this function outside of SwiftFileBackendFileList.
$fullCont | string Resolved container name |
$dir | string Resolved storage directory with no trailing slash |
$after | string|null Storage path of file to list items after |
$limit | integer Max number of items to list |
$params | Array Includes flag for 'topOnly' |
Definition at line 949 of file SwiftFileBackend.php.
SwiftFileBackend::getLocalCopy | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 1039 of file SwiftFileBackend.php.
References $ext, FileBackend\extensionFromPath(), TempFSFile\factory(), getContainer(), handleException(), headersFromParams(), and FileBackendStore\resolveStoragePathReal().
SwiftFileBackend::getParentDir | ( | $ | path | ) | [protected] |
Definition at line 935 of file SwiftFileBackend.php.
SwiftFileBackend::handleException | ( | Exception $ | e, |
$ | status, | ||
$ | func, | ||
array $ | params | ||
) | [protected] |
Log an unexpected exception for this backend.
This also sets the Status object to have a fatal error.
$e | Exception |
$status | Status|null |
$func | string |
$params | Array |
Definition at line 1354 of file SwiftFileBackend.php.
Referenced by doCleanInternal(), doCopyInternal(), doCreateInternal(), doDeleteInternal(), doDirectoryExists(), doExecuteOpHandlesInternal(), doGetFileStat(), doMoveInternal(), doPrepareInternal(), doPrimeContainerCache(), doPublishInternal(), doSecureInternal(), doStoreInternal(), doStreamFile(), getFileContents(), getLocalCopy(), and isPathUsableInternal().
SwiftFileBackend::headersFromParams | ( | array $ | params | ) | [protected] |
Get headers to send to Swift when reading a file based on a FileBackend params array, e.g.
that of getLocalCopy(). $params is currently only checked for a 'latest' flag.
$params | Array |
Definition at line 1092 of file SwiftFileBackend.php.
Referenced by doGetFileStat(), doStreamFile(), getFileContents(), and getLocalCopy().
SwiftFileBackend::isPathUsableInternal | ( | $ | storagePath | ) |
Reimplemented from FileBackendStore.
Definition at line 148 of file SwiftFileBackend.php.
References getContainer(), handleException(), and FileBackendStore\resolveStoragePathReal().
SwiftFileBackend::purgeCDNCache | ( | array $ | objects | ) |
Purge the CDN cache of affected objects if CDN caching is enabled.
This is for Rackspace/Akamai CDNs.
$objects | Array List of CF_Object items |
Definition at line 1179 of file SwiftFileBackend.php.
Referenced by doCopyInternal(), doCreateInternal(), doDeleteInternal(), doExecuteOpHandlesInternal(), doMoveInternal(), and doStoreInternal().
SwiftFileBackend::resolveContainerPath | ( | $ | container, |
$ | relStoragePath | ||
) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 135 of file SwiftFileBackend.php.
SwiftFileBackend::setContainerAccess | ( | CF_Container $ | contObj, |
array $ | readGrps, | ||
array $ | writeGrps | ||
) | [protected] |
Set read/write permissions for a Swift container.
$readGrps is a list of the possible criteria for a request to have access to read a container. Each item is one of the following formats:
$writeGrps is a list of the possible criteria for a request to have access to write to a container. Each item is of the following format:
In general, we don't allow listings to end-users. It's not useful, isn't well-defined (lists are truncated to 10000 item with no way to page), and is just a performance risk.
$contObj | CF_Container Swift container |
$readGrps | Array List of read access routes |
$writeGrps | Array List of write access routes |
Definition at line 1156 of file SwiftFileBackend.php.
Referenced by doPublishInternal(), and doSecureInternal().
SwiftFileBackend::truncDisp | ( | $ | disposition | ) | [protected] |
$disposition | string Content-Disposition header value |
Definition at line 169 of file SwiftFileBackend.php.
References $res.
Referenced by doCopyInternal(), doCreateInternal(), doMoveInternal(), and doStoreInternal().
CF_Authentication SwiftFileBackend::$auth [protected] |
*
Definition at line 40 of file SwiftFileBackend.php.
SwiftFileBackend::$authTTL [protected] |
Definition at line 41 of file SwiftFileBackend.php.
CF_Connection SwiftFileBackend::$conn [protected] |
ProcessCacheLRU SwiftFileBackend::$connContainerCache [protected] |
*
Definition at line 55 of file SwiftFileBackend.php.
SwiftFileBackend::$connErrorTime = 0 [protected] |
Definition at line 51 of file SwiftFileBackend.php.
CloudFilesException SwiftFileBackend::$connException [protected] |
*
Definition at line 50 of file SwiftFileBackend.php.
SwiftFileBackend::$sessionStarted = 0 [protected] |
Definition at line 48 of file SwiftFileBackend.php.
BagOStuff SwiftFileBackend::$srvCache [protected] |
*
Definition at line 53 of file SwiftFileBackend.php.
SwiftFileBackend::$swiftAnonUser [protected] |
Definition at line 42 of file SwiftFileBackend.php.
SwiftFileBackend::$swiftCDNExpiry [protected] |
Definition at line 44 of file SwiftFileBackend.php.
SwiftFileBackend::$swiftCDNPurgable [protected] |
Definition at line 45 of file SwiftFileBackend.php.
SwiftFileBackend::$swiftUseCDN [protected] |
Definition at line 43 of file SwiftFileBackend.php.