Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove unused code
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Mar 19, 2020
commit 28fed26c6d9ab9d5985494fe64d1ac1f81af6fb7
53 changes: 0 additions & 53 deletions apps/dav/lib/DAV/CustomPropertiesBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

namespace OCA\DAV\DAV;

use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\Node;
use OCP\IDBConnection;
use OCP\IUser;
Expand Down Expand Up @@ -319,56 +318,4 @@ private function updateProperties($node, $properties) {

return true;
}

/**
* Bulk load properties for directory children
*
* @param Directory $node
* @param array $requestedProperties requested properties
*
* @return void
*/
private function loadChildrenProperties(Directory $node, $requestedProperties) {
$path = $node->getPath();
if (isset($this->cache[$path])) {
// we already loaded them at some point
return;
}

$childNodes = $node->getChildren();
// pre-fill cache
foreach ($childNodes as $childNode) {
$this->cache[$childNode->getPath()] = [];
}

$sql = 'SELECT * FROM `*PREFIX*properties` WHERE `userid` = ? AND `propertypath` LIKE ?';
$sql .= ' AND `propertyname` in (?) ORDER BY `propertypath`, `propertyname`';

$result = $this->connection->executeQuery(
$sql,
array($this->user->getUID(), $this->connection->escapeLikeParameter(rtrim($path, '/')) . '/%', $requestedProperties),
array(null, null, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY)
);

$oldPath = null;
$props = [];
while ($row = $result->fetch()) {
$path = $row['propertypath'];
if ($oldPath !== $path) {
// save previously gathered props
$this->cache[$oldPath] = $props;
$oldPath = $path;
// prepare props for next path
$props = [];
}
$props[$row['propertyname']] = $row['propertyvalue'];
}
if (!is_null($oldPath)) {
// save props from last run
$this->cache[$oldPath] = $props;
}

$result->closeCursor();
}

}