Merge pull request #439 from owncloud/239_webdav_999_files_stable45

backport of #271 to stable45
This commit is contained in:
Thomas Müller 2012-11-16 08:12:24 -08:00
commit 326496ff80
1 changed files with 14 additions and 11 deletions

View File

@ -128,10 +128,12 @@ 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);
foreach ($chunks as $pack) {
$placeholders = join(',', array_fill(0, count($pack), '?'));
$query = OC_DB::prepare( 'SELECT * FROM `*PREFIX*properties` WHERE `userid` = ?' . ' AND `propertypath` IN ('.$placeholders.')' ); $query = OC_DB::prepare( 'SELECT * FROM `*PREFIX*properties` WHERE `userid` = ?' . ' AND `propertypath` IN ('.$placeholders.')' );
array_unshift($paths, $user); // prepend userid array_unshift($pack, $user); // prepend userid
$result = $query->execute( $paths ); $result = $query->execute( $pack );
while($row = $result->fetchRow()) { while($row = $result->fetchRow()) {
$propertypath = $row['propertypath']; $propertypath = $row['propertypath'];
$propertyname = $row['propertyname']; $propertyname = $row['propertyname'];
@ -139,11 +141,12 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
$properties[$propertypath][$propertyname] = $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;