Example #1
0
        default:
            $qry->QDo('DELETE FROM property WHERE dav_name=:dav_name AND property_name=:property_name', array(':dav_name' => $dav_resource->dav_name(), ':property_name' => $tag));
            $success[$tag] = 1;
            break;
    }
}
/**
* If we have encountered any instances of failure, the whole damn thing fails.
*/
if (count($failure) > 0) {
    $qry->Rollback();
    $url = ConstructURL($request->path);
    $multistatus = new XMLElement('multistatus');
    array_unshift($failure, new XMLElement('responsedescription', translate("Some properties were not able to be changed.")));
    array_unshift($failure, new XMLElement('href', $url));
    $response = $reply->DAVElement($multistatus, 'response', $failure);
    if (!empty($success)) {
        $prop = new XMLElement('prop');
        foreach ($success as $tag => $v) {
            $reply->NSElement($prop, $tag);
        }
        $reply->DAVElement($response, 'propstat', array($prop, new XMLElement('status', 'HTTP/1.1 424 Failed Dependency')));
    }
    $request->DoResponse(207, $reply->Render($multistatus), 'text/xml; charset="utf-8"');
}
/**
* Otherwise we will try and do the SQL. This is inside a transaction, so PostgreSQL guarantees the atomicity
*/
if ($qry->Commit()) {
    $cache = getCacheInstance();
    $cache_ns = null;