From 6b4012b7a32d61d38e1d5c0b7a38ea5388b7a771 Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 22 Nov 2018 18:32:44 +0800 Subject: [PATCH] fix bugs - pass document root for cron job - fix upload dir path --- src/js/App.js | 15 ++++++++------- src/php/cron.php | 5 +++-- src/php/filestore.php | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/js/App.js b/src/js/App.js index d98e12d..e30a079 100644 --- a/src/js/App.js +++ b/src/js/App.js @@ -55,13 +55,14 @@ const App = { App.Elements.PageView.style.display = "none"; new DropzoneManager(App.Elements.Dropzone); - let stats = await Api.GetSiteInfo(); - if(stats.ok){ - let elms = document.querySelectorAll("#footer-stats div span"); - elms[0].textContent = stats.data.basic_stats.Files; - elms[1].textContent = Utils.FormatBytes(stats.data.basic_stats.Size, 2); - elms[2].textContent = Utils.FormatBytes(stats.data.basic_stats.Transfer_24h, 2); - } + } + + let stats = await Api.GetSiteInfo(); + if(stats.ok){ + let elms = document.querySelectorAll("#footer-stats div span"); + elms[0].textContent = stats.data.basic_stats.Files; + elms[1].textContent = Utils.FormatBytes(stats.data.basic_stats.Size, 2); + elms[2].textContent = Utils.FormatBytes(stats.data.basic_stats.Transfer_24h, 2); } } }; diff --git a/src/php/cron.php b/src/php/cron.php index 94c0f71..255c05e 100644 --- a/src/php/cron.php +++ b/src/php/cron.php @@ -3,8 +3,9 @@ StaticRedis::Connect(); Config::LoadConfig(array("upload_folder")); - - $fs = new FileStore(Config::$Instance->upload_folder, "/usr/local/nginx/html"); + var_dump($_SERVER); + + $fs = new FileStore(Config::$Instance->upload_folder, $_SERVER["cron_root"]); echo "Loading stats for: " . $fs->GetUploadDirAbsolute() . "\n"; //echo "\n\t" . implode("\n\t", $fs->ListFiles()) . "\n"; diff --git a/src/php/filestore.php b/src/php/filestore.php index ea71d45..c97cf80 100644 --- a/src/php/filestore.php +++ b/src/php/filestore.php @@ -38,7 +38,7 @@ } public function GetAbsoluteFilePath($id) : string { - return "$this->GetUploadDirAbsolute()/$this->UploadFolder/$id"; + return $this->GetUploadDirAbsolute() . "/" . $id; } public function GetFileInfo($id) : ?FileInfo {