diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-11-15 00:37:54 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-11-15 00:37:54 +0100 |
commit | bf2ac9f113d41dc944f42d1516649a3a72e88a65 (patch) | |
tree | 36e0c3b8a6327321122fc8a63b7aa23d1ee0f789 /lib/connector | |
parent | 41a61bc637c3d60efc5abe81c39fc726fd78cd1d (diff) | |
parent | a418a3ba65d0097047cfcad1b4ee82185c42d22a (diff) | |
download | nextcloud-server-bf2ac9f113d41dc944f42d1516649a3a72e88a65.tar.gz nextcloud-server-bf2ac9f113d41dc944f42d1516649a3a72e88a65.zip |
merge master into filesystem
Diffstat (limited to 'lib/connector')
-rw-r--r-- | lib/connector/sabre/directory.php | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php index d4f58527d21..8d4dd92a3d4 100644 --- a/lib/connector/sabre/directory.php +++ b/lib/connector/sabre/directory.php @@ -124,15 +124,22 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa } $properties = array_fill_keys($paths, array()); if(count($paths)>0) { - $placeholders = join(',', array_fill(0, count($paths), '?')); - $query = OC_DB::prepare( 'SELECT * FROM `*PREFIX*properties` WHERE `userid` = ?' . ' AND `propertypath` IN ('.$placeholders.')' ); - array_unshift($paths, OC_User::getUser()); // prepend userid - $result = $query->execute( $paths ); - while($row = $result->fetchRow()) { - $propertypath = $row['propertypath']; - $propertyname = $row['propertyname']; - $propertyvalue = $row['propertyvalue']; - $properties[$propertypath][$propertyname] = $propertyvalue; + // + // the number of arguments within IN conditions are limited in most databases + // we chunk $paths into arrays of 200 items each to meet this criteria + // + $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.')' ); + array_unshift($pack, OC_User::getUser()); // prepend userid + $result = $query->execute( $pack ); + while($row = $result->fetchRow()) { + $propertypath = $row['propertypath']; + $propertyname = $row['propertyname']; + $propertyvalue = $row['propertyvalue']; + $properties[$propertypath][$propertyname] = $propertyvalue; + } } } |