1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-13 18:14:26 +02:00

Restored JSON core image generator for performance

PDO SQLite was performing unacceptably poorly.
Let's just load the entire integrity image into RAM…
This commit is contained in:
Nick Liu
2020-03-23 17:04:44 -05:00
parent 90bdc88d55
commit b8ed70693f
9 changed files with 383 additions and 30 deletions

View File

@@ -12,10 +12,6 @@ require_once("e_file_inspector.php");
class e_file_inspector_sqlphar extends e_file_inspector
{
private $coreImage;
private $currentVersion;
private $defaultDirsCache;
private $customDirsCache;
/**
* e_file_inspector_sqlphar constructor.
@@ -87,26 +83,7 @@ class e_file_inspector_sqlphar extends e_file_inspector
return $this->currentVersion = $statement->fetchColumn();
}
private function pathToDefaultPath($path)
{
if (!$this->customDirsCache)
{
$this->defaultDirsCache = e107::getInstance()->defaultDirs();
$customDirs = e107::getInstance()->e107_dirs ? e107::getInstance()->e107_dirs : [];
$this->customDirsCache = array_diff_assoc($customDirs, $this->defaultDirsCache);
}
foreach ($this->customDirsCache as $dirType => $customDir)
{
if (!isset($this->defaultDirsCache[$dirType])) continue;
$defaultDir = $this->defaultDirsCache[$dirType];
if ($customDir === $defaultDir) continue;
if (substr($path, 0, strlen($customDir)) === $customDir)
$path = $defaultDir . substr($path, strlen($customDir));
}
return $path;
}
/**
* Copy file to destination with low memory footprint