Constants

TYPE_SUBSCRIPTION

TYPE_SUBSCRIPTION

TYPE_CUSTOMER

TYPE_CUSTOMER

TYPE_RESELLER

TYPE_RESELLER

TYPE_SERVER

TYPE_SERVER

Properties

$_objectType

$_objectType : string

One of the constants TYPE_*

Type

string

$_objectId

$_objectId : integer|null

Type

integer|null

Methods

init()

init(string  $objectType, integer|null  $objectId) 

Initializes an object of the class. The method should be called explicitly within an overridden method.

Parameters

string $objectType

(server, reseller, customer, subscription)

integer|null $objectId

isConfigured()

isConfigured() : boolean

Returns true if the extension is configured for the object.

Override this method in the extension class. Default implementation returns false.

Returns

boolean

check()

check() : array

Checks connection with the storage and reports problems ['errors' => ['message', .

..], 'warnings' => ['message', ...]]. The method may be overridden in extension class. Default implementation returns empty array.

Returns

array

getDescription()

getDescription() : string

Describes this extension for backup manager UI. The description should include storage name, internal path, etc.

The method may be overridden in extension class. Default implementation returns extension's display name.

Returns

string

stat()

stat(string  $path) : null|array

Returns array ['name' => .

.., 'size' => ..., 'isDir' => ...]. Override this method in the extension class. Default implementation returns null.

Parameters

string $path

Returns

null|array

listDir()

listDir(  $path) : array

Returns array [['name' => .

.., 'size' => ..., 'isDir' => ...], ...]. Override this method in the extension class. Default implementation returns empty array.

Parameters

$path

Returns

array

createDir()

createDir(string  $path) 

Creates the specified directory.

Override this method in the extension class. Default implementation does nothing.

Parameters

string $path

deleteFile()

deleteFile(string  $path) 

Removes the specified file.

Override this method in the extension class. Default implementation does nothing.

Parameters

string $path

deleteDir()

deleteDir(string  $path) 

Removes the specified directory.

Override this method in the extension class. Default implementation does nothing.

Parameters

string $path

openFileRead()

openFileRead(string  $path, integer  $offset) : mixed

Prepare a file with the specified name on the storage to read from the specified offset.

Override this method in the extension class. Default implementation returns empty string.

Parameters

string $path
integer $offset

Returns

mixed —

Returns file descriptor for readFile

readFile()

readFile(mixed  $fd, string  $localFile, integer|null  $size = null) : integer

Reads file content to the local file.

Override this method in the extension class. Default implementation returns 0.

Parameters

mixed $fd

descriptor returned by openFileRead method

string $localFile
integer|null $size

if the size is null the whole file should be read

Returns

integer —

Bytes read

openFileWrite()

openFileWrite(string  $path) : mixed

Prepares the storage to write a new file with the specified name.

The method returns handle which should be used in appendFile and closeFile methods. Override this method in the extension class. Default implementation returns empty string.

Parameters

string $path

Returns

mixed —

File descriptor

appendFile()

appendFile(mixed  $fd, string  $localFile) : integer

The method appends content of the local file to the file in the external storage.

Override this method in the extension class. Default implementation returns 0.

Parameters

mixed $fd

descriptor returned by openFileWrite

string $localFile

Returns

integer —

Bytes written

closeFile()

closeFile(mixed  $fd) 

Closes file.

Override this method in the extension class. Default implementation does nothing.

Parameters

mixed $fd

descriptor returned by openFileWrite or openFileRead

getSettingsSubForm()

getSettingsSubForm() : \pm_Form_SubForm

Returns subform with storage settings.

Override this method in the extension class. Default implementation empty an instance of pm_Form_SubForm.

Returns

\pm_Form_SubForm

authorize()

authorize(  $controller) 

Is called just before show subform provided by getSettingsSubForm. This method may be used for OAuth2 authorization.

The method may be overridden in extension class. Default implementation does nothing.

Parameters

$controller

Zend_Controller_Action

getQuota()

getQuota() : array

Returns array with information about user disk quota in bytes. If the storage cannot provide information about quota an empty array should be returned.

Example ['total' => 5368709120, 'free' => 3221225472] The method may be overridden in extension class. Default implementation returns empty array.

Returns

array