Skip to content

A self-hosted media server and file management system

fix reindexing everything because sync files overwrote local last scan dates

aminnausin5f4d1c1834c2
diff --git a/app/Jobs/IndexFiles.php b/app/Jobs/IndexFiles.php
index 88bb3258..4c5d2b64 100755
--- a/app/Jobs/IndexFiles.php
+++ b/app/Jobs/IndexFiles.php
@@ -369,7 +369,7 @@ class IndexFiles implements ShouldQueue, ShouldBeUnique {
foreach ($scannedFolders as $folder) { // O(n) where n = number of folders * 2 (for scan)
$cost++;
- $folderAccessTime = filemtime("{$rawPath}public/media/$folder/");
+ $folderAccessTime = filemtime("$rawPath" . "public/media/$folder");
if ($folderAccessTime <= $folderStructure[$folder]["last_scan"]) {
$unModefiedFolders["storage/" . basename($path) . "/$folder"] = 1;
diff --git a/app/Jobs/SyncFiles.php b/app/Jobs/SyncFiles.php
index 501016fa..00d1dba4 100755
--- a/app/Jobs/SyncFiles.php
+++ b/app/Jobs/SyncFiles.php
@@ -134,8 +134,9 @@ class SyncFiles implements ShouldQueue, ShouldBeUnique {
if (!isset($stored[$path])) {
// folder is not cached locally
// add
+ // no last scan
array_push($changes, array("id" => $id, "name" => $name, "last_scan" => -1, "action" => "ADD"));
- } else if (isset($stored[$path])) {
+ } else {
if ($stored[$path]['id'] != $id || !isset($stored[$path]['last_scan'])) {
// folder is cached locally but id is not the same
// overwrite
@@ -143,6 +144,7 @@ class SyncFiles implements ShouldQueue, ShouldBeUnique {
}
// else folder is cached locally and is correct
// no action
+ $current[$path] = $stored[$path]; // Copy stored data
unset($stored[$path]);
}