Class: WebDavHelper
Source Location: /modules/webdav/classes/WebDavHelper.class
Class WebDavHelper
Method Summary
| boolean |
checkDavHeaders() |
Check that OPTIONS responses includes the DAV headers. |
| boolean |
checkLocks() |
Check if there are no active locks at the specified path, or the request matches the token of the active lock. |
| array |
getLocks() |
Get active WebDAV locks at specified path. |
| array('href' |
getMountLink() |
Returns a browser-specifc mount link for the given item. |
| array |
mirrorEntity() |
Take two entities of possibly different classes and make the second entity as close a copy of the first entity as possible. Copy the id but not the entity type because the entity type must always match the class name. |
Methods
array checkConfiguration(
)
|
|
Check this module's configuration.
API Tags:
| Return: | GalleryStatus a status code int WebDAV status code |
boolean checkDavHeaders(
string
$url
)
|
|
Check that OPTIONS responses includes the DAV headers.
Parameters:
API Tags:
| Return: | true if OPTIONS responses include the DAV headers |
boolean checkLocks(
string
$path
)
|
|
Check if there are no active locks at the specified path, or the request matches the token of the active lock.
Parameters:
API Tags:
| Return: | no active locks or the request matches the active lock |
boolean checkRequestMethod(
string
$requestMethod
)
|
|
Check that Gallery handles WebDAV request methods.
Parameters:
API Tags:
| Return: | true if Gallery handles the request method |
array copyMoveRequestHelper(
)
|
|
COPY / MOVE request helper.
Wrapper around HTTP_WebDAV_Server::copymove_request_helper which prepates data-structures from COPY / MOVE requests.
API Tags:
| Return: | GalleryStatus a status code array WebDAV library options int maximum depth of descendant paths boolean overwrite items at destination path string destination path |
| See: | HTTP_WebDAV_Server::copymove_request_helper |
DELETE handler.
API Tags:
array deleteHelper(
array
$itemIds
)
|
|
DELETE helper.
For an array of item ids, delete the items if not the root album and the user has permission. Copied from ItemDeleteController::handleRequest for consistancy. Maybe eventually should go in ItemDeleteController::requestHelper or a GalleryCoreApi method.
Parameters:
|
array |
$itemIds: |
ids of items to delete |
API Tags:
| Return: | GalleryStatus a status code int number of items deleted |
| See: | ItemDeleteController::handleRequest |
void getDescendentsLocks(
$path
)
|
|
Get active locks at specified path or any descendant path.
Parameters:
API Tags:
| See: | WebDavHelper::getLocks |
array getLocks(
string
$path, [boolean
$getDescendentsLocks = false]
)
|
|
Get active WebDAV locks at specified path.
Parameters:
|
string |
$path: |
|
|
boolean |
$getDescendentsLocks: |
(optional) also get locks at any descendant path |
API Tags:
| Return: | GalleryStatus a status code array active WebDAV locks (scope, type, depth, owner, expires, token, path) |
array('href' getMountLink(
int
$itemId
)
|
|
Returns a browser-specifc mount link for the given item.
Parameters:
API Tags:
| Return: | => string the davmount URL, 'script' (optional) => string JavaScript to be used as onclick, 'attrs' => array() string additional link tag attributes) |
array getParentItemIdByPath(
$path, string
$path,
)
|
|
Returns the id of item that corresponds to the parent of the given path.
The item at the given path doesn't have to exist, but its parent is expected to exist.
Parameters:
|
string |
$path,: |
e.g. /foo/bar |
|
|
$path: |
|
API Tags:
| Return: | GalleryStatus a status code, int the id of the parent item |
Get singleton WebDAV server library instance.
If it didn't need path and baseUrl, we could eliminate and call library methods staticly.
API Tags:
LOCK handler.
WebDAV locks persist between requests.
API Tags:
Information Tags:
| Todo: | Make corresponding Gallery locks persist between requests |
array lockRequestHelper(
)
|
|
LOCK request helper.
Wrapper around HTTP_WebDAV_Server::lock_request_helper which prepares data-structures from LOCK reqeusts.
API Tags:
| Return: | GalleryStatus a status code array WebDAV library options string token of WebDAV lock to refresh or null string scope of WebDAV lock (exclusive or shared) string type of WebDAV lock (read or write) int maximum depth of descendant paths string owner of WebDAV lock int timeout of WebDAV lock string token of WebDAV lock to create |
| See: | HTTP_WebDAV_Server::lock_request_helper |
Information Tags:
| Todo: | Simplify function signature |
void lockResponseHelper(
array
$webDavOptions, array
$locks, mixed
$status, string
$scope, string
$type, int
$depth, string
$owner, int
$expires, string
$token, int
$timeout
)
|
|
LOCK response helper.
Wrapper around HTTP_WebDAV_Server::lock_response_helper which formates LOCK responses.
Parameters:
|
array |
$webDavOptions: |
WebDAV library options |
|
array |
$locks: |
for response (path) |
|
mixed |
$status: |
HTTP response status |
|
string |
$scope: |
of WebDAV lock (exclusive or shared) |
|
string |
$type: |
of WebDAV lock (read or write) |
|
int |
$depth: |
maximum depth of descendant paths |
|
string |
$owner: |
of WebDAV lock |
|
int |
$timeout: |
of WebDAV lock |
|
int |
$expires: |
timestamp of WebDAV lock expiration |
|
string |
$token: |
of WebDAV lock |
API Tags:
| See: | HTTP_WebDAV_Server::lock_response_helper |
Information Tags:
| Todo: | Simplify function signature |
Take two entities of possibly different classes and make the second entity as close a copy of the first entity as possible. Copy the id but not the entity type because the entity type must always match the class name.
Parameters:
API Tags:
| Return: | GalleryStatus a status code GalleryEntity the mirror entity |
GalleryStatus mkcolHelper(
int
$parentId, string
$pathComponent, string
$title, string
$summary, string
$description, array
$keywords
)
|
|
MKCOL helper.
Acquire locks, create album and set permissions. Copied from ItemAddAlbumController::handleRequest for consistancy. Maybe eventually should go in ItemAddAlbumController::requestHelper or a GalleryCoreApi method.
Parameters:
|
int |
$parentId: |
id of parent album |
|
string |
$pathComponent: |
path component of new album |
|
string |
$title: |
title of new album |
|
string |
$summary: |
summary of new album |
|
string |
$description: |
description of new album |
|
array |
$keywords: |
keywords of new album |
API Tags:
| Return: | a status code |
| See: | ItemAddAlbumController::handleRequest |
array mkcolValidateHelper(
int
$parentId, string
$pathComponent
)
|
|
Validate MKCOL requests.
Copied from ItemAddAlbumController::handleRequest for consistancy. Maybe eventually should go in ItemAddAlbumController::validateRequest or a GalleryCoreApi method.
Parameters:
|
int |
$parentId: |
id of parent album |
|
string |
$pathComponent: |
path component of new album |
API Tags:
| Return: | GalleryStatus a status code array error strings |
| See: | ItemAddAlbumController::handleRequest |
MOVE handler.
Rename an item, change its parent, or both.
API Tags:
Validate MOVE requests.
Copied from ItemMoveController::handleRequest for consistancy. Maybe eventually should go in ItemMoveController::validateRequest or a GalleryCoreApi method.
Parameters:
API Tags:
| Return: | GalleryStatus a status code array error strings |
| See: | ItemMoveController::handleRequest |
OPTIONS handler.
API Tags:
| See: | HTTP_WebDAV_Server::options |
PROPFIND handler.
API Tags:
array propfindRequestHelper(
)
|
|
PROPFIND request helper.
Wrapper around HTTP_WebDAV_Server::propfind_request_helper which prepares data-structures from PROPFIND requests.
API Tags:
| Return: | GalleryStatus a status code array WebDAV library options int maximum depth of descendant paths |
| See: | HTTP_WebDAV_Server::propfind_request_helper |
void propfindResponseHelper(
array
$webDavOptions, array
$files, array
$namespaces
)
|
|
PROPFIND response helper.
Wrapper around HTTP_WebDAV_Server::propfind_response_helper which formats PROPFIND responses.
Parameters:
|
array |
$webDavOptions: |
WebDAV library options |
|
array |
$files: |
files for WebDAV response (path, props) |
|
array |
$namespaces: |
namespaces for WebDAV response (URI => prefix) |
API Tags:
| See: | HTTP_WebDAV_Server::propfind_response_helper |
PROPPATCH handler.
API Tags:
array proppatchRequestHelper(
)
|
|
PROPPATCH request helper.
Wrapper around HTTP_WebDAV_Server::proppatch_request_helper which prepares data-structures from PROPPATCH requests.
API Tags:
| Return: | GalleryStatus a status code array WebDAV library options array properties to set (ns => namespace, name => name, val => value) |
| See: | HTTP_WebDAV_Server::proppatch_request_helper |
void proppatchResponseHelper(
array
$webDavOptions, string
$path, array
$props,
$namespaces, array
$namespace
)
|
|
PROPPATCH response helper.
Wrapper around HTTP_WebDAV_Server::proppatch_response_helper which formats PROPPATCH responses.
Parameters:
|
array |
$webDavOptions: |
WebDAV library options |
|
string |
$path: |
|
|
array |
$props: |
properties set (ns => namespace, |
|
array |
$namespace: |
namespaces for WebDAV response (URI => prefix) |
|
|
$namespaces: |
|
API Tags:
| See: | HTTP_WebDAV_Server::proppatch_response_helper |
array putRequestHelper(
)
|
|
PUT request helper.
Wrapper around HTTP_WebDAV_Server::put_request_helper which prepares data-structures from PUT requests.
API Tags:
| Return: | GalleryStatus a status code array WebDAV library options resource request body file handle string request content type |
| See: | HTTP_WebDAV_Server::put_request_helper |
void putResponseHelper(
array
$webDavOptions, resource
$stream
)
|
|
PUT response helper.
Wrapper around HTTP_WebDAV_Server::put_response_helper which formats PUT responses.
Parameters:
|
array |
$webDavOptions: |
WebDAV library options |
|
resource |
$stream: |
destination file handle |
API Tags:
| See: | HTTP_WebDAV_Server::put_response_helper |
UNLOCK handler.
API Tags:
array unlockRequestHelper(
)
|
|
UNLOCK request helper.
Wrapper around HTTP_WebDAV_Server::unlock_request_helper wich prepares data-structures from UNLOCK requests.
API Tags:
| Return: | GalleryStatus a status code array WebDAV library options string token of WebDAV lock to clear |
| See: | HTTP_WebDAV_Server::unlock_request_helper |
PROPFIND recursive function.
Builds file arrays (path, props) from items until depth is exhausted. Could be done iteratively, but waiting for MPTT for the ultimate solution - http://codex.gallery2.org/index.php/Gallery2:Modified_Preorder_Tree_Traversal
Parameters:
|
GalleryItem |
$item: |
|
|
string |
$path: |
|
|
int |
$depth: |
maximum depth of descendant paths |
|
array |
$files: |
files for WebDAV response (path, props) |
|
|
&$files: |
|
API Tags:
| Return: | a status code |
| Access: | private |
Set item properties
API Tags:
|
|