|
MediaWiki
REL1_21
|
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. | |
| getFileHttpUrl (array $params) | |
| getFileListInternal ($fullCont, $dir, array $params) | |
| getFileListPageInternal ($fullCont, $dir, &$after, $limit, array $params) | |
| Do not call this function outside of SwiftFileBackendFileList. | |
| 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) | |
| doCopyInternal (array $params) | |
| doCreateInternal (array $params) | |
| doDeleteInternal (array $params) | |
| doDescribeInternal (array $params) | |
| doDirectoryExists ($fullCont, $dir, array $params) | |
| doExecuteOpHandlesInternal (array $fileOpHandles) | |
| doGetFileContentsMulti (array $params) | |
| doGetFileSha1base36 (array $params) | |
| doGetFileStat (array $params) | |
| doGetLocalCopyMulti (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 |
| * | |
| $rgwS3AccessKey | |
| $rgwS3SecretKey | |
| $sessionStarted = 0 | |
| BagOStuff | $srvCache |
| * | |
| $swiftAnonUser | |
| $swiftCDNExpiry | |
| $swiftCDNPurgable | |
| $swiftTempUrlKey | |
| $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 100 of file SwiftFileBackend.php.
| SwiftFileBackend::_getResponseCopy | ( | CF_Async_Op $ | cfOp, |
| Status $ | status, | ||
| array $ | params | ||
| ) | [protected] |
Definition at line 449 of file SwiftFileBackend.php.
| SwiftFileBackend::_getResponseCreate | ( | CF_Async_Op $ | cfOp, |
| Status $ | status, | ||
| array $ | params | ||
| ) | [protected] |
Definition at line 280 of file SwiftFileBackend.php.
| SwiftFileBackend::_getResponseDelete | ( | CF_Async_Op $ | cfOp, |
| Status $ | status, | ||
| array $ | params | ||
| ) | [protected] |
Definition at line 576 of file SwiftFileBackend.php.
| SwiftFileBackend::_getResponseMove | ( | CF_Async_Op $ | cfOp, |
| Status $ | status, | ||
| array $ | params | ||
| ) | [protected] |
Definition at line 524 of file SwiftFileBackend.php.
| SwiftFileBackend::_getResponseStore | ( | CF_Async_Op $ | cfOp, |
| Status $ | status, | ||
| array $ | params | ||
| ) | [protected] |
Definition at line 375 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 | |
| string | $path | Storage path to object |
| Exception | cloudfiles exceptions |
Definition at line 824 of file SwiftFileBackend.php.
Referenced by doGetFileStat().
| SwiftFileBackend::closeConnection | ( | ) | [protected] |
Close the connection to the Swift proxy.
Definition at line 1419 of file SwiftFileBackend.php.
| SwiftFileBackend::createContainer | ( | $ | container | ) | [protected] |
Create a Swift container.
| string | $container | Container name |
| CloudFilesException |
Definition at line 1474 of file SwiftFileBackend.php.
Referenced by doPrepareInternal().
| SwiftFileBackend::deleteContainer | ( | $ | container | ) | [protected] |
Delete a Swift container.
| string | $container | Container name |
| CloudFilesException |
Definition at line 1488 of file SwiftFileBackend.php.
Referenced by doCleanInternal().
| SwiftFileBackend::directoriesAreVirtual | ( | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 1252 of file SwiftFileBackend.php.
| SwiftFileBackend::doCleanInternal | ( | $ | fullCont, |
| $ | dir, | ||
| array $ | params | ||
| ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 750 of file SwiftFileBackend.php.
References $dir, deleteContainer(), getContainer(), handleException(), and Status\newGood().
| SwiftFileBackend::doCopyInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 389 of file SwiftFileBackend.php.
References array(), empty, Status\fatal(), getContainer(), handleException(), list, Status\newGood(), purgeCDNCache(), FileBackendStore\resolveStoragePathReal(), and truncDisp().
| SwiftFileBackend::doCreateInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 213 of file SwiftFileBackend.php.
References array(), StreamFile\contentTypeFromPath(), empty, getContainer(), handleException(), list, Status\newGood(), purgeCDNCache(), FileBackendStore\resolveStoragePathReal(), truncDisp(), and wfBaseConvert().
| SwiftFileBackend::doDeleteInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 536 of file SwiftFileBackend.php.
References array(), empty, Status\fatal(), getContainer(), handleException(), list, Status\newGood(), purgeCDNCache(), and FileBackendStore\resolveStoragePathReal().
| SwiftFileBackend::doDescribeInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 592 of file SwiftFileBackend.php.
References array(), Status\fatal(), getContainer(), handleException(), headersFromParams(), list, Status\newGood(), purgeCDNCache(), FileBackendStore\resolveStoragePathReal(), and truncDisp().
| SwiftFileBackend::doDirectoryExists | ( | $ | fullCont, |
| $ | dir, | ||
| array $ | params | ||
| ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 926 of file SwiftFileBackend.php.
References $dir, array(), getContainer(), and handleException().
| SwiftFileBackend::doExecuteOpHandlesInternal | ( | array $ | fileOpHandles | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 1276 of file SwiftFileBackend.php.
References $batch, array(), as, handleException(), Status\newGood(), and purgeCDNCache().
| SwiftFileBackend::doGetFileContentsMulti | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 854 of file SwiftFileBackend.php.
References $batch, $path, array(), as, getContainer(), handleException(), headersFromParams(), list, and FileBackendStore\resolveStoragePathReal().
| SwiftFileBackend::doGetFileSha1base36 | ( | array $ | params | ) | [protected] |
Definition at line 1082 of file SwiftFileBackend.php.
References FileBackendStore\getFileStat().
| SwiftFileBackend::doGetFileStat | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 789 of file SwiftFileBackend.php.
References addMissingMetadata(), array(), getContainer(), handleException(), headersFromParams(), list, FileBackendStore\resolveStoragePathReal(), and wfTimestamp().
| SwiftFileBackend::doGetLocalCopyMulti | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 1130 of file SwiftFileBackend.php.
References $batch, $ext, $path, array(), as, FileBackend\extensionFromPath(), TempFSFile\factory(), getContainer(), handleException(), headersFromParams(), list, and FileBackendStore\resolveStoragePathReal().
| SwiftFileBackend::doMoveInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 461 of file SwiftFileBackend.php.
References array(), empty, Status\fatal(), getContainer(), handleException(), list, Status\newGood(), purgeCDNCache(), FileBackendStore\resolveStoragePathReal(), and truncDisp().
| SwiftFileBackend::doPrepareInternal | ( | $ | fullCont, |
| $ | dir, | ||
| array $ | params | ||
| ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 633 of file SwiftFileBackend.php.
References $dir, createContainer(), doPublishInternal(), doSecureInternal(), empty, getContainer(), handleException(), Status\merge(), and Status\newGood().
| SwiftFileBackend::doPrimeContainerCache | ( | array $ | containerInfo | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 1498 of file SwiftFileBackend.php.
References $conn, array(), as, getConnection(), and handleException().
| SwiftFileBackend::doPublishInternal | ( | $ | fullCont, |
| $ | dir, | ||
| array $ | params | ||
| ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 710 of file SwiftFileBackend.php.
References array(), getContainer(), handleException(), Status\merge(), Status\newGood(), and setContainerAccess().
Referenced by doPrepareInternal().
| SwiftFileBackend::doSecureInternal | ( | $ | fullCont, |
| $ | dir, | ||
| array $ | params | ||
| ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 675 of file SwiftFileBackend.php.
References array(), empty, getContainer(), handleException(), Status\merge(), Status\newGood(), and setContainerAccess().
Referenced by doPrepareInternal().
| SwiftFileBackend::doStoreInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 292 of file SwiftFileBackend.php.
References array(), StreamFile\contentTypeFromPath(), empty, Status\fatal(), getContainer(), handleException(), list, Status\newGood(), purgeCDNCache(), FileBackendStore\resolveStoragePathReal(), truncDisp(), wfBaseConvert(), wfRestoreWarnings(), and wfSuppressWarnings().
| SwiftFileBackend::doStreamFile | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 1095 of file SwiftFileBackend.php.
References $output, Status\fatal(), getContainer(), handleException(), headersFromParams(), list, Status\newGood(), and FileBackendStore\resolveStoragePathReal().
| SwiftFileBackend::getConnection | ( | ) | [protected] |
Get an authenticated connection handle to the Swift proxy.
| CloudFilesException | |
| CloudFilesException|Exception |
Definition at line 1373 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.
| string | $container | Container name |
| bool | $bypassCache | Bypass all caches and load from Swift |
| CloudFilesException |
Definition at line 1447 of file SwiftFileBackend.php.
Referenced by doCleanInternal(), doCopyInternal(), doCreateInternal(), doDeleteInternal(), doDescribeInternal(), doDirectoryExists(), doGetFileContentsMulti(), doGetFileStat(), doGetLocalCopyMulti(), doMoveInternal(), doPrepareInternal(), doPublishInternal(), doSecureInternal(), doStoreInternal(), doStreamFile(), getFileHttpUrl(), and isPathUsableInternal().
| SwiftFileBackend::getCredsCacheKey | ( | $ | username | ) | [private] |
Get the cache key for a container.
| $username | string |
Definition at line 1434 of file SwiftFileBackend.php.
| SwiftFileBackend::getDirectoryListInternal | ( | $ | fullCont, |
| $ | dir, | ||
| array $ | params | ||
| ) |
Reimplemented from FileBackendStore.
Definition at line 945 of file SwiftFileBackend.php.
References $dir.
| SwiftFileBackend::getDirListPageInternal | ( | $ | fullCont, |
| $ | dir, | ||
| &$ | after, | ||
| $ | limit, | ||
| array $ | params | ||
| ) |
Do not call this function outside of SwiftFileBackendFileList.
| string | $fullCont | Resolved container name |
| string | $dir | Resolved storage directory with no trailing slash |
| string | null | $after | Storage path of file to list items after |
| $limit | integer Max number of items to list | |
| array | $params | Includes flag for 'topOnly' |
Definition at line 967 of file SwiftFileBackend.php.
| SwiftFileBackend::getFileHttpUrl | ( | array $ | params | ) |
Reimplemented from FileBackendStore.
Definition at line 1203 of file SwiftFileBackend.php.
References array(), getContainer(), handleException(), list, FileBackendStore\resolveStoragePathReal(), and wfAppendQuery().
| SwiftFileBackend::getFileListInternal | ( | $ | fullCont, |
| $ | dir, | ||
| array $ | params | ||
| ) |
Reimplemented from FileBackendStore.
Definition at line 953 of file SwiftFileBackend.php.
References $dir.
| SwiftFileBackend::getFileListPageInternal | ( | $ | fullCont, |
| $ | dir, | ||
| &$ | after, | ||
| $ | limit, | ||
| array $ | params | ||
| ) |
Do not call this function outside of SwiftFileBackendFileList.
| string | $fullCont | Resolved container name |
| string | $dir | Resolved storage directory with no trailing slash |
| string | null | $after | Storage path of file to list items after |
| $limit | integer Max number of items to list | |
| array | $params | Includes flag for 'topOnly' |
Definition at line 1040 of file SwiftFileBackend.php.
| SwiftFileBackend::getParentDir | ( | $ | path | ) | [protected] |
Definition at line 1026 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 | |
| array | $params |
Definition at line 1521 of file SwiftFileBackend.php.
Referenced by doCleanInternal(), doCopyInternal(), doCreateInternal(), doDeleteInternal(), doDescribeInternal(), doDirectoryExists(), doExecuteOpHandlesInternal(), doGetFileContentsMulti(), doGetFileStat(), doGetLocalCopyMulti(), doMoveInternal(), doPrepareInternal(), doPrimeContainerCache(), doPublishInternal(), doSecureInternal(), doStoreInternal(), doStreamFile(), getFileHttpUrl(), 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.
| array | $params |
Definition at line 1264 of file SwiftFileBackend.php.
Referenced by doDescribeInternal(), doGetFileContentsMulti(), doGetFileStat(), doGetLocalCopyMulti(), and doStreamFile().
| SwiftFileBackend::isPathUsableInternal | ( | $ | storagePath | ) |
Reimplemented from FileBackendStore.
Definition at line 174 of file SwiftFileBackend.php.
References array(), getContainer(), handleException(), list, 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.
| array | $objects | List of CF_Object items |
Definition at line 1351 of file SwiftFileBackend.php.
Referenced by doCopyInternal(), doCreateInternal(), doDeleteInternal(), doDescribeInternal(), doExecuteOpHandlesInternal(), doMoveInternal(), and doStoreInternal().
| SwiftFileBackend::resolveContainerPath | ( | $ | container, |
| $ | relStoragePath | ||
| ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 161 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 | |
| array | $readGrps | List of read access routes |
| array | $writeGrps | List of write access routes |
Definition at line 1328 of file SwiftFileBackend.php.
Referenced by doPublishInternal(), and doSecureInternal().
| SwiftFileBackend::truncDisp | ( | $ | disposition | ) | [protected] |
| string | $disposition | Content-Disposition header value |
Definition at line 195 of file SwiftFileBackend.php.
Referenced by doCopyInternal(), doCreateInternal(), doDescribeInternal(), 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 60 of file SwiftFileBackend.php.
SwiftFileBackend::$connErrorTime = 0 [protected] |
Definition at line 56 of file SwiftFileBackend.php.
CloudFilesException SwiftFileBackend::$connException [protected] |
*
Definition at line 55 of file SwiftFileBackend.php.
SwiftFileBackend::$rgwS3AccessKey [protected] |
Definition at line 49 of file SwiftFileBackend.php.
SwiftFileBackend::$rgwS3SecretKey [protected] |
Definition at line 50 of file SwiftFileBackend.php.
SwiftFileBackend::$sessionStarted = 0 [protected] |
Definition at line 53 of file SwiftFileBackend.php.
BagOStuff SwiftFileBackend::$srvCache [protected] |
*
Definition at line 58 of file SwiftFileBackend.php.
SwiftFileBackend::$swiftAnonUser [protected] |
Definition at line 43 of file SwiftFileBackend.php.
SwiftFileBackend::$swiftCDNExpiry [protected] |
Definition at line 45 of file SwiftFileBackend.php.
SwiftFileBackend::$swiftCDNPurgable [protected] |
Definition at line 46 of file SwiftFileBackend.php.
SwiftFileBackend::$swiftTempUrlKey [protected] |
Definition at line 42 of file SwiftFileBackend.php.
SwiftFileBackend::$swiftUseCDN [protected] |
Definition at line 44 of file SwiftFileBackend.php.