86 $query =
'SELECT name, value, valuetype FROM ' . $this->tableName .
' WHERE path = ?';
90 while (
$row =
$stmt->fetch(\PDO::FETCH_ASSOC)) {
91 if (gettype(
$row[
'value']) ===
'resource') {
92 $row[
'value'] = stream_get_contents(
$row[
'value']);
94 switch (
$row[
'valuetype']) {
96 case self::VT_STRING :
102 case self::VT_OBJECT :
103 $propFind->
set(
$row[
'name'], unserialize(
$row[
'value']));
128 if ($this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME) ===
'pgsql') {
131 INSERT INTO {$this->tableName} (path, name, valuetype, value)
132 VALUES (:path, :name, :valuetype, :value)
133 ON CONFLICT (path, name)
134 DO UPDATE SET valuetype = :valuetype, value = :value
140 REPLACE INTO {$this->tableName} (path, name, valuetype, value)
141 VALUES (:path, :name, :valuetype, :value)
146 $updateStmt = $this->pdo->prepare($updateSql);
147 $deleteStmt = $this->pdo->prepare(
"DELETE FROM " . $this->tableName .
" WHERE path = ? AND name = ?");
149 foreach ($properties as
$name => $value) {
151 if (!is_null($value)) {
152 if (is_scalar($value)) {
153 $valueType = self::VT_STRING;
154 } elseif ($value instanceof
Complex) {
155 $valueType = self::VT_XML;
156 $value = $value->getXml();
158 $valueType = self::VT_OBJECT;
159 $value = serialize($value);
162 $updateStmt->bindParam(
'path',
$path, \PDO::PARAM_STR);
163 $updateStmt->bindParam(
'name',
$name, \PDO::PARAM_STR);
164 $updateStmt->bindParam(
'valuetype', $valueType, \PDO::PARAM_INT);
165 $updateStmt->bindParam(
'value', $value, \PDO::PARAM_LOB);
167 $updateStmt->execute();
194 $stmt = $this->pdo->prepare(
"DELETE FROM " . $this->tableName .
" WHERE path = ? OR path LIKE ? ESCAPE '='");
225 $select = $this->pdo->prepare(
'SELECT id, path FROM ' . $this->tableName .
' WHERE path = ? OR path LIKE ?');
228 $update = $this->pdo->prepare(
'UPDATE ' . $this->tableName .
' SET path = ? WHERE id = ?');
229 while (
$row = $select->fetch(\PDO::FETCH_ASSOC)) {
235 $trailingPart = substr(
$row[
'path'], strlen(
$source) + 1);
238 $newPath .=
'/' . $trailingPart;
240 $update->execute([$newPath,
$row[
'id']]);
const VT_XML
Value is stored as XML fragment.
This class represents a set of properties that are going to be updated.
move($source, $destination)
This method is called after a successful MOVE.
const VT_OBJECT
Value is stored as a property object.
This class holds all the information about a PROPFIND request.
set($propertyName, $value, $status=null)
Sets the value of the property.
get404Properties()
Returns all propertynames that have a 404 status, and thus don't have a value yet.
propFind($path, PropFind $propFind)
Fetches properties for a path.
Propertystorage backend interface.
__construct(\PDO $pdo)
Creates the PDO property storage engine.
isAllProps()
Returns true if this was an '{DAV:}allprops' request.
const VT_STRING
Value is stored as string.
propPatch($path, PropPatch $propPatch)
Updates properties for a path.
handleRemaining(callable $callback)
Call this function if you wish to handle all properties that haven't been handled by anything else ye...