mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Reduce memory use in Flex
This commit is contained in:
parent
94876d1019
commit
aab17ca79a
|
|
@ -83,6 +83,7 @@ class FileStorage extends FolderStorage
|
|||
$path = $this->getPathFromKey($src);
|
||||
$file = $this->getFile($path);
|
||||
$file->delete();
|
||||
$file->free();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -381,6 +381,7 @@ class FolderStorage extends AbstractFilesystemStorage
|
|||
if (isset($data[0])) {
|
||||
throw new RuntimeException('Broken object file');
|
||||
}
|
||||
unset($file);
|
||||
} catch (RuntimeException $e) {
|
||||
$data = ['__ERROR' => $e->getMessage()];
|
||||
}
|
||||
|
|
@ -425,6 +426,7 @@ class FolderStorage extends AbstractFilesystemStorage
|
|||
$file = $this->getFile($path);
|
||||
|
||||
$file->save($row);
|
||||
$file->free();
|
||||
|
||||
/** @var UniformResourceLocator $locator */
|
||||
$locator = Grav::instance()['locator'];
|
||||
|
|
@ -434,6 +436,7 @@ class FolderStorage extends AbstractFilesystemStorage
|
|||
} catch (RuntimeException $e) {
|
||||
throw new RuntimeException(sprintf('Flex saveFile(%s): %s', $path ?? $key, $e->getMessage()));
|
||||
}
|
||||
unset($file);
|
||||
|
||||
$row['__META'] = $this->getObjectMeta($key, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -418,6 +418,7 @@ class SimpleStorage extends AbstractFilesystemStorage
|
|||
} catch (RuntimeException $e) {
|
||||
throw new RuntimeException(sprintf('Flex save(): %s', $e->getMessage()));
|
||||
}
|
||||
unset($file);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -453,6 +454,10 @@ class SimpleStorage extends AbstractFilesystemStorage
|
|||
$data = new Data($content);
|
||||
$content = $data->get($this->prefix);
|
||||
}
|
||||
|
||||
$file->free();
|
||||
unset($file);
|
||||
|
||||
$this->data = $content;
|
||||
|
||||
$list = [];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user