backport of #271 to stable45
This commit is contained in:
parent
b1b1fe72e8
commit
8724fe4b11
|
@ -128,22 +128,25 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
|
||||||
}
|
}
|
||||||
$properties = array_fill_keys($paths, array());
|
$properties = array_fill_keys($paths, array());
|
||||||
if(count($paths)>0) {
|
if(count($paths)>0) {
|
||||||
$placeholders = join(',', array_fill(0, count($paths), '?'));
|
$chunks = array_chunk($paths, 200, false);
|
||||||
$query = OC_DB::prepare( 'SELECT * FROM `*PREFIX*properties` WHERE `userid` = ?' . ' AND `propertypath` IN ('.$placeholders.')' );
|
foreach ($chunks as $pack) {
|
||||||
array_unshift($paths, $user); // prepend userid
|
$placeholders = join(',', array_fill(0, count($pack), '?'));
|
||||||
$result = $query->execute( $paths );
|
$query = OC_DB::prepare( 'SELECT * FROM `*PREFIX*properties` WHERE `userid` = ?' . ' AND `propertypath` IN ('.$placeholders.')' );
|
||||||
while($row = $result->fetchRow()) {
|
array_unshift($pack, $user); // prepend userid
|
||||||
$propertypath = $row['propertypath'];
|
$result = $query->execute( $pack );
|
||||||
$propertyname = $row['propertyname'];
|
while($row = $result->fetchRow()) {
|
||||||
$propertyvalue = $row['propertyvalue'];
|
$propertypath = $row['propertypath'];
|
||||||
$properties[$propertypath][$propertyname] = $propertyvalue;
|
$propertyname = $row['propertyname'];
|
||||||
|
$propertyvalue = $row['propertyvalue'];
|
||||||
|
$properties[$propertypath][$propertyname] = $propertyvalue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$nodes = array();
|
$nodes = array();
|
||||||
foreach($folder_content as $info) {
|
foreach($folder_content as $info) {
|
||||||
$node = $this->getChild($info['name'], $info);
|
$node = $this->getChild($info['name'], $info);
|
||||||
$node->setPropertyCache($properties[$path.'/'.$info['name']]);
|
$node->setPropertyCache($properties[$this->path.'/'.$info['name']]);
|
||||||
$nodes[] = $node;
|
$nodes[] = $node;
|
||||||
}
|
}
|
||||||
return $nodes;
|
return $nodes;
|
||||||
|
@ -204,7 +207,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
|
||||||
public function getProperties($properties) {
|
public function getProperties($properties) {
|
||||||
$props = parent::getProperties($properties);
|
$props = parent::getProperties($properties);
|
||||||
if (in_array(self::GETETAG_PROPERTYNAME, $properties) && !isset($props[self::GETETAG_PROPERTYNAME])) {
|
if (in_array(self::GETETAG_PROPERTYNAME, $properties) && !isset($props[self::GETETAG_PROPERTYNAME])) {
|
||||||
$props[self::GETETAG_PROPERTYNAME]
|
$props[self::GETETAG_PROPERTYNAME]
|
||||||
= OC_Connector_Sabre_Node::getETagPropertyForPath($this->path);
|
= OC_Connector_Sabre_Node::getETagPropertyForPath($this->path);
|
||||||
}
|
}
|
||||||
return $props;
|
return $props;
|
||||||
|
|
Loading…
Reference in New Issue