apps/dav/lib/Connector/Sabre/CustomPropertiesBackend.php
/**
	 * Bulk load properties for directory children
	 *
	 * @param Directory $node
	 * @param array $requestedProperties requested properties
	 *
	 * @return void
	 */
Bulk load properties for directory children
@param Directory $node
@param array $requestedProperties requested properties

@return void
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])) {
			return;
		}
		$childNodes = $node->getChildren();
		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, $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) {
				$this->cache[$oldPath] = $props;
				$oldPath = $path;
				$props = [];
			}
			$props[$row['propertyname']] = $row['propertyvalue'];
		}
		if (!is_null($oldPath)) {
			$this->cache[$oldPath] = $props;
		}
		$result->closeCursor();
	}
private function loadChildrenProperties ( Directory $ node , $ requestedProperties ) { $ path = $ node -> getPath ( ) ; if ( isset ( $ this -> cache [ $ path ] ) ) { return ; } $ childNodes = $ node -> getChildren ( ) ; 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 , $ 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 ) { $ this -> cache [ $ oldPath ] = $ props ; $ oldPath = $ path ; $ props = [ ] ; } $ props [ $ row [ 'propertyname' ] ] = $ row [ 'propertyvalue' ] ; } if ( ! is_null ( $ oldPath ) ) { $ this -> cache [ $ oldPath ] = $ props ; } $ result -> closeCursor ( ) ; }
Bulk load properties for directory children
 @param Directory $node
 @param array $requestedProperties requested properties
Bulk load properties for directory children @param Directory $node @param array $requestedProperties requested properties
// we already loaded them at some point // pre-fill cache // save previously gathered props // prepare props for next path // save props from last run