apps/dav/lib/Connector/Sabre/CustomPropertiesBackend.php
/**
	 * Update properties
	 *
	 * @param Node $node node for which to update properties
	 * @param array $properties array of properties to update
	 *
	 * @return bool
	 */
Update properties
@param Node $node node for which to update properties
@param array $properties array of properties to update

@return bool
Update properties @param Node $node node for which to update properties @param array $properties array of properties to update @return bool
private function updateProperties($node, $properties) {
		$path = $node->getPath();
		$deleteStatement = 'DELETE FROM `*PREFIX*properties`' .
			' WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?';
		$insertStatement = 'INSERT INTO `*PREFIX*properties`' .
			' (`userid`,`propertypath`,`propertyname`,`propertyvalue`) VALUES(?,?,?,?)';
		$updateStatement = 'UPDATE `*PREFIX*properties` SET `propertyvalue` = ?' .
			' WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?';
				$existing = $this->getProperties($node, array());
		$this->connection->beginTransaction();
		foreach ($properties as $propertyName => $propertyValue) {
			if (is_null($propertyValue)) {
				if (array_key_exists($propertyName, $existing)) {
					$this->connection->executeUpdate($deleteStatement,
						array(
							$this->user,
							$path,
							$propertyName
						)
					);
				}
			} else {
				if (!array_key_exists($propertyName, $existing)) {
					$this->connection->executeUpdate($insertStatement,
						array(
							$this->user,
							$path,
							$propertyName,
							$propertyValue
						)
					);
				} else {
					$this->connection->executeUpdate($updateStatement,
						array(
							$propertyValue,
							$this->user,
							$path,
							$propertyName
						)
					);
				}
			}
		}
		$this->connection->commit();
		unset($this->cache[$path]);
		return true;
	}
private function updateProperties ( $ node , $ properties ) { $ path = $ node -> getPath ( ) ; $ deleteStatement = 'DELETE FROM `*PREFIX*properties`' . ' WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?' ; $ insertStatement = 'INSERT INTO `*PREFIX*properties`' . ' (`userid`,`propertypath`,`propertyname`,`propertyvalue`) VALUES(?,?,?,?)' ; $ updateStatement = 'UPDATE `*PREFIX*properties` SET `propertyvalue` = ?' . ' WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?' ; $ existing = $ this -> getProperties ( $ node , array ( ) ) ; $ this -> connection -> beginTransaction ( ) ; foreach ( $ properties as $ propertyName => $ propertyValue ) { if ( is_null ( $ propertyValue ) ) { if ( array_key_exists ( $ propertyName , $ existing ) ) { $ this -> connection -> executeUpdate ( $ deleteStatement , array ( $ this -> user , $ path , $ propertyName ) ) ; } } else { if ( ! array_key_exists ( $ propertyName , $ existing ) ) { $ this -> connection -> executeUpdate ( $ insertStatement , array ( $ this -> user , $ path , $ propertyName , $ propertyValue ) ) ; } else { $ this -> connection -> executeUpdate ( $ updateStatement , array ( $ propertyValue , $ this -> user , $ path , $ propertyName ) ) ; } } } $ this -> connection -> commit ( ) ; unset ( $ this -> cache [ $ path ] ) ; return true ; }
Update properties
 @param Node $node node for which to update properties
 @param array $properties array of properties to update
Update properties @param Node $node node for which to update properties @param array $properties array of properties to update
// TODO: use "insert or update" strategy ?
 // If it was null, we need to delete the property