Beispiel #1
0
    // And we don't return from that.
}
$qry = new AwlQuery('BEGIN');
if (!$qry->Exec('move')) {
    rollback(500);
}
$src_name = $src->dav_name();
$dst_name = $dest->IsBinding() ? $dest->bound_from() : $dest->dav_name();
$src_collection = $src->GetProperty('collection_id');
$dst_collection = $dest->GetProperty('collection_id');
$src_user_no = $src->GetProperty('user_no');
$dst_user_no = $dest->GetProperty('user_no');
$cache = getCacheInstance();
$cachekeys = array();
if ($src->IsCollection()) {
    $cachekeys[] = ($src->ContainerType() == 'principal' ? 'principal' : 'collection') . '-' . $src->parent_path();
    $cachekeys[] = ($src->IsPrincipal() == 'principal' ? 'principal' : 'collection') . '-' . $src->dav_name();
    $cachekeys[] = ($src->IsPrincipal() ? 'principal' : 'collection') . '-' . $dest->dav_name();
    if ($dest->Exists()) {
        $qry = new AwlQuery('DELETE FROM collection WHERE dav_name = :dst_name', array(':dst_name' => $dst_name));
        if (!$qry->Exec('move')) {
            rollback(500);
        }
    }
    /** @todo Need to confirm this will work correctly if we move this into another user's hierarchy. */
    $sql = 'UPDATE collection SET dav_name = :dst_name ';
    $params = array(':dst_name' => $dst_name);
    if ($src_user_no != $dst_user_no) {
        $sql .= ', user_no = :dst_user_no ';
        $params[':dst_user_no'] = $dst_user_no;
    }
Beispiel #2
0
if (!$dest->ContainerExists()) {
    $request->DoResponse(409, translate('Destination collection does not exist'));
}
if (!$request->overwrite && $dest->Exists()) {
    $request->DoResponse(412, translate('Not overwriting existing destination resource'));
}
if (isset($request->etag_none_match) && $request->etag_none_match != '*') {
    $request->DoResponse(412);
    /** request to move, but only if there is no source? WTF! */
}
$src = new DAVResource($request->path);
if (!$src->Exists()) {
    $request->DoResponse(412, translate('Source resource does not exist.'));
}
if ($src->IsCollection()) {
    switch ($dest->ContainerType()) {
        case 'calendar':
        case 'addressbook':
        case 'schedule-inbox':
        case 'schedule-outbox':
            $request->DoResponse(412, translate('Special collections may not contain a calendar or other special collection.'));
    }
} else {
    if (isset($request->etag_if_match) && $request->etag_if_match != '' || isset($request->etag_none_match) && $request->etag_none_match != '') {
        /**
         * RFC2068, 14.25:
         * If none of the entity tags match, or if "*" is given and no current
         * entity exists, the server MUST NOT perform the requested method, and
         * MUST return a 412 (Precondition Failed) response.
         *
         * RFC2068, 14.26: