|
MediaWiki
REL1_19
|
Class for an OpenStack Swift based file backend. More...


Public Member Functions | |
| __construct (array $config) | |
| doGetFileSha1base36 (array $params) | |
| getFileContents (array $params) | |
| getFileListInternal ($fullCont, $dir, array $params) | |
| getFileListPageInternal ($fullCont, $dir, $after, $limit) | |
| Do not call this function outside of SwiftFileBackendFileList. | |
| getLocalCopy (array $params) | |
| isPathUsableInternal ($storagePath) | |
Protected Member Functions | |
| addMissingMetadata (CF_Object $obj, $path) | |
| Fill in any missing object metadata and save it to Swift. | |
| createContainer ($container) | |
| Create a Swift container. | |
| deleteContainer ($container) | |
| Delete a Swift container. | |
| doCleanInternal ($fullCont, $dir, array $params) | |
| doClearCache (array $paths=null) | |
| doCopyInternal (array $params) | |
| doCreateInternal (array $params) | |
| doDeleteInternal (array $params) | |
| doGetFileStat (array $params) | |
| doPrepareInternal ($fullCont, $dir, array $params) | |
| doSecureInternal ($fullCont, $dir, array $params) | |
| doStoreInternal (array $params) | |
| doStreamFile (array $params) | |
| getConnection () | |
| Get a connection to the Swift proxy. | |
| getContainer ($container, $reCache=false) | |
| Get a Swift container object, possibly from process cache. | |
| headersFromParams (array $params) | |
| Get headers to send to Swift when reading a file based on a FileBackend params array, e.g. | |
| logException (Exception $e, $func, array $params) | |
| Log an unexpected exception for this backend. | |
| resolveContainerPath ($container, $relStoragePath) | |
| setContainerAccess (CF_Container $contObj, array $readGrps, array $writeGrps) | |
| Set read/write permissions for a Swift container. | |
Protected Attributes | |
| $auth | |
| $authTTL | |
| $conn | |
| $connContainers = array() | |
| $connStarted = 0 | |
| $maxContCacheSize = 100 | |
| $swiftAnonUser | |
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 22 of file SwiftFileBackend.php.
| SwiftFileBackend::__construct | ( | array $ | config | ) |
Reimplemented from FileBackend.
Definition at line 48 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 479 of file SwiftFileBackend.php.
References $path, getLocalCopy(), FileBackend\getScopedFileLocks(), LockManager\LOCK_UW, and Status\newGood().
Referenced by doGetFileStat().


| SwiftFileBackend::createContainer | ( | $ | container | ) | [protected] |
Create a Swift container.
| $container | string Container name |
Definition at line 766 of file SwiftFileBackend.php.
References $conn, and getConnection().
Referenced by doPrepareInternal().


| SwiftFileBackend::deleteContainer | ( | $ | container | ) | [protected] |
Delete a Swift container.
| $container | string Container name |
Definition at line 779 of file SwiftFileBackend.php.
References $conn, and getConnection().
Referenced by doCleanInternal().


| SwiftFileBackend::doCleanInternal | ( | $ | fullCont, |
| $ | dir, | ||
| array $ | params | ||
| ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 398 of file SwiftFileBackend.php.
References $dir, deleteContainer(), getContainer(), logException(), and Status\newGood().

| SwiftFileBackend::doClearCache | ( | array $ | paths = null | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 730 of file SwiftFileBackend.php.
| SwiftFileBackend::doCopyInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 233 of file SwiftFileBackend.php.
References FileBackendStore\fileExists(), getContainer(), logException(), Status\newGood(), and FileBackendStore\resolveStoragePathReal().

| SwiftFileBackend::doCreateInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 103 of file SwiftFileBackend.php.
References StreamFile\contentTypeFromPath(), FileBackendStore\fileExists(), getContainer(), logException(), Status\newGood(), FileBackendStore\resolveStoragePathReal(), and wfBaseConvert().

| SwiftFileBackend::doDeleteInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 288 of file SwiftFileBackend.php.
References getContainer(), logException(), Status\newGood(), and FileBackendStore\resolveStoragePathReal().

| SwiftFileBackend::doGetFileSha1base36 | ( | array $ | params | ) |
Definition at line 563 of file SwiftFileBackend.php.
References FileBackendStore\getFileStat().

| SwiftFileBackend::doGetFileStat | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 442 of file SwiftFileBackend.php.
References addMissingMetadata(), getContainer(), headersFromParams(), logException(), FileBackendStore\resolveStoragePathReal(), and wfTimestamp().

| SwiftFileBackend::doPrepareInternal | ( | $ | fullCont, |
| $ | dir, | ||
| array $ | params | ||
| ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 319 of file SwiftFileBackend.php.
References createContainer(), getContainer(), logException(), Status\newGood(), and setContainerAccess().

| SwiftFileBackend::doSecureInternal | ( | $ | fullCont, |
| $ | dir, | ||
| array $ | params | ||
| ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 364 of file SwiftFileBackend.php.
References getContainer(), logException(), Status\newGood(), and setContainerAccess().

| SwiftFileBackend::doStoreInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 165 of file SwiftFileBackend.php.
References StreamFile\contentTypeFromPath(), FileBackendStore\fileExists(), getContainer(), logException(), Status\newGood(), FileBackendStore\resolveStoragePathReal(), and wfBaseConvert().

| SwiftFileBackend::doStreamFile | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 575 of file SwiftFileBackend.php.
References $output, getContainer(), headersFromParams(), logException(), Status\newGood(), and FileBackendStore\resolveStoragePathReal().

| SwiftFileBackend::getConnection | ( | ) | [protected] |
Get a connection to the Swift proxy.
| InvalidResponseException |
Definition at line 699 of file SwiftFileBackend.php.
Referenced by createContainer(), deleteContainer(), and getContainer().

| SwiftFileBackend::getContainer | ( | $ | container, |
| $ | reCache = 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 |
| $reCache | bool Refresh the process cache |
Definition at line 742 of file SwiftFileBackend.php.
References $conn, and getConnection().
Referenced by doCleanInternal(), doCopyInternal(), doCreateInternal(), doDeleteInternal(), doGetFileStat(), doPrepareInternal(), doSecureInternal(), doStoreInternal(), doStreamFile(), getFileContents(), getFileListPageInternal(), getLocalCopy(), and isPathUsableInternal().


| SwiftFileBackend::getFileContents | ( | array $ | params | ) |
Reimplemented from FileBackendStore.
Definition at line 503 of file SwiftFileBackend.php.
References FileBackendStore\fileExists(), getContainer(), headersFromParams(), logException(), and FileBackendStore\resolveStoragePathReal().

| SwiftFileBackend::getFileListInternal | ( | $ | fullCont, |
| $ | dir, | ||
| array $ | params | ||
| ) |
Reimplemented from FileBackendStore.
Definition at line 530 of file SwiftFileBackend.php.
References $dir.
| SwiftFileBackend::getFileListPageInternal | ( | $ | fullCont, |
| $ | dir, | ||
| $ | after, | ||
| $ | limit | ||
| ) |
Do not call this function outside of SwiftFileBackendFileList.
| $fullCont | string Resolved container name |
| $dir | string Resolved storage directory with no trailing slash |
| $after | string Storage path of file to list items after |
| $limit | integer Max number of items to list |
Definition at line 543 of file SwiftFileBackend.php.
References $dir, $files, $limit, getContainer(), and logException().

| SwiftFileBackend::getLocalCopy | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 614 of file SwiftFileBackend.php.
References $ext, FileBackend\extensionFromPath(), TempFSFile\factory(), FileBackendStore\fileExists(), getContainer(), headersFromParams(), logException(), FileBackendStore\resolveStoragePathReal(), and wfBaseName().
Referenced by addMissingMetadata().


| 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 661 of file SwiftFileBackend.php.
Referenced by doGetFileStat(), doStreamFile(), getFileContents(), and getLocalCopy().

| SwiftFileBackend::isPathUsableInternal | ( | $ | storagePath | ) |
Reimplemented from FileBackendStore.
Definition at line 82 of file SwiftFileBackend.php.
References getContainer(), logException(), and FileBackendStore\resolveStoragePathReal().

| SwiftFileBackend::logException | ( | Exception $ | e, |
| $ | func, | ||
| array $ | params | ||
| ) | [protected] |
Log an unexpected exception for this backend.
| $e | Exception |
| $func | string |
| $params | Array |
Definition at line 793 of file SwiftFileBackend.php.
References wfDebugLog().
Referenced by doCleanInternal(), doCopyInternal(), doCreateInternal(), doDeleteInternal(), doGetFileStat(), doPrepareInternal(), doSecureInternal(), doStoreInternal(), doStreamFile(), getFileContents(), getFileListPageInternal(), getLocalCopy(), and isPathUsableInternal().


| SwiftFileBackend::resolveContainerPath | ( | $ | container, |
| $ | relStoragePath | ||
| ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 72 of file SwiftFileBackend.php.
| SwiftFileBackend::setContainerAccess | ( | CF_Container $ | contObj, |
| array $ | readGrps, | ||
| array $ | writeGrps | ||
| ) | [protected] |
Set read/write permissions for a Swift container.
| $contObj | CF_Container Swift container |
| $readGrps | Array Swift users who can read (account:user) |
| $writeGrps | Array Swift users who can write (account:user) |
Definition at line 677 of file SwiftFileBackend.php.
References $url.
Referenced by doPrepareInternal(), and doSecureInternal().

SwiftFileBackend::$auth [protected] |
Definition at line 24 of file SwiftFileBackend.php.
SwiftFileBackend::$authTTL [protected] |
Definition at line 25 of file SwiftFileBackend.php.
SwiftFileBackend::$conn [protected] |
Definition at line 30 of file SwiftFileBackend.php.
Referenced by createContainer(), deleteContainer(), and getContainer().
SwiftFileBackend::$connContainers = array() [protected] |
Definition at line 32 of file SwiftFileBackend.php.
SwiftFileBackend::$connStarted = 0 [protected] |
Definition at line 31 of file SwiftFileBackend.php.
SwiftFileBackend::$maxContCacheSize = 100 [protected] |
Definition at line 27 of file SwiftFileBackend.php.
SwiftFileBackend::$swiftAnonUser [protected] |
Definition at line 26 of file SwiftFileBackend.php.