fixes #329: query the database in chunks of 200
This commit is contained in:
parent
972243d564
commit
415ec58422
|
@ -116,7 +116,6 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
|
||||||
* @return Sabre_DAV_INode[]
|
* @return Sabre_DAV_INode[]
|
||||||
*/
|
*/
|
||||||
public function getChildren() {
|
public function getChildren() {
|
||||||
|
|
||||||
$folder_content = OC_Files::getDirectoryContent($this->path);
|
$folder_content = OC_Files::getDirectoryContent($this->path);
|
||||||
$paths = array();
|
$paths = array();
|
||||||
foreach($folder_content as $info) {
|
foreach($folder_content as $info) {
|
||||||
|
@ -124,10 +123,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, OC_User::getUser()); // prepend userid
|
array_unshift($pack, OC_User::getUser()); // 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'];
|
||||||
|
@ -135,6 +136,7 @@ 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) {
|
||||||
|
|
Loading…
Reference in New Issue