Skip to content

Commit

Permalink
Fix Timeout/Allowed memory exhausted when to many files
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 committed Apr 22, 2022
1 parent 7451734 commit d43e1ba
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/GoogleDriveAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,9 @@ public function copy($path, $newpath)
if (isset($this->cacheHasDirs[$srcId])) {
$this->cacheHasDirs[$id] = $this->cacheHasDirs[$srcId];
}
if ($this->useDisplayPaths) {
$this->cachedPaths[$newpathDir.'/'.$fileName] = $id;
}

if ($this->getRawVisibility($srcId) === AdapterInterface::VISIBILITY_PUBLIC) {
$this->publish($id);
Expand Down Expand Up @@ -1432,6 +1435,9 @@ protected function upload($path, $contents, Config $config, $updating = null)
$this->cacheFileObjects[$obj->getId()] = $obj;
$this->cacheObjects([$obj->getId() => $obj]);
$result = $this->normaliseObject($obj, self::dirname($path));
if ($this->useDisplayPaths) {
$this->cachedPaths[$result['display_path']] = $obj->getId();
}

if (($visibility = $config->get('visibility'))) {
if ($this->setVisibility($result['virtual_path'], $visibility, true)) {
Expand Down Expand Up @@ -1774,7 +1780,10 @@ protected function cachePaths($displayPath, $i, $indices, $parentItemId)
if (DEBUG_ME) {
echo 'New req: '.$id;
}
$items[] = $this->getItems($id, false, 0, $is_last ? '' : 'mimeType = "'.self::DIRMIME.'"');

$query = $is_last ? [] : ['mimeType = "'.self::DIRMIME.'"'];
$query[] = "name = '{$token}'";
$items[] = $this->getItems($id, false, 0, implode(' and ', $query));
if (DEBUG_ME) {
echo " ...done\n";
}
Expand Down

0 comments on commit d43e1ba

Please sign in to comment.