chore(scanner): skip profile_pics subtree during scans

This commit is contained in:
Ryan
2025-10-04 03:35:39 -04:00
committed by GitHub
parent 494be05801
commit e3e3aaa475
2 changed files with 6 additions and 2 deletions

View File

@@ -4,6 +4,7 @@
fix(scanner): resolve dirs via CLI/env/constants; write per-item JSON; skip trash fix(scanner): resolve dirs via CLI/env/constants; write per-item JSON; skip trash
fix(scanner): rebuild per-folder metadata to match File/Folder models fix(scanner): rebuild per-folder metadata to match File/Folder models
chore(scanner): skip profile_pics subtree during scans
- scan_uploads.php now falls back to UPLOAD_DIR/META_DIR from config.php - scan_uploads.php now falls back to UPLOAD_DIR/META_DIR from config.php
- prevents double slashes in metadata paths; respects app timezone - prevents double slashes in metadata paths; respects app timezone
@@ -14,6 +15,8 @@ fix(scanner): rebuild per-folder metadata to match File/Folder models
- Skips uploads/trash and symlinks - Skips uploads/trash and symlinks
- Resolves paths from CLI flags, env vars, or config constants (UPLOAD_DIR/META_DIR) - Resolves paths from CLI flags, env vars, or config constants (UPLOAD_DIR/META_DIR)
- Idempotent; safe to run at startup via SCAN_ON_START - Idempotent; safe to run at startup via SCAN_ON_START
- Avoids indexing internal avatar images (folder already hidden in UI)
- Reduces scan noise and metadata churn; keeps firmware/other content indexed
## Changes 10/4/2025 v1.3.12 ## Changes 10/4/2025 v1.3.12

View File

@@ -58,8 +58,9 @@ function list_all_folders(string $root): array {
// relative key like "foo/bar" // relative key like "foo/bar"
$rel = ltrim(str_replace(['\\'], '/', substr($path, strlen($root) + 1)), '/'); $rel = ltrim(str_replace(['\\'], '/', substr($path, strlen($root) + 1)), '/');
if ($rel === '') continue; if ($rel === '') continue;
// skip trash subtree // skip trash and profile_pics subtrees
if (strpos($rel, 'trash/') === 0 || $rel === 'trash') continue; if ($rel === 'trash' || strpos($rel, 'trash/') === 0) continue;
if ($rel === 'profile_pics' || strpos($rel, 'profile_pics/') === 0) continue;
// obey the apps folder-name regex to stay consistent // obey the apps folder-name regex to stay consistent
if (preg_match(REGEX_FOLDER_NAME, basename($rel))) { if (preg_match(REGEX_FOLDER_NAME, basename($rel))) {
$folders[] = $rel; $folders[] = $rel;