From 17012bcd8cfce34eb38f36fb45c270217459e40d Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Fri, 5 Jun 2026 20:04:51 -0400 Subject: [PATCH] refactor: move unraid-specific tools into Plugin/unraid/tools/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit api_cache_writer, remote_arr_cache_writer, conf_populate, storage_migrate are all Unraid-adapter-specific — they read Docker appdata paths, Unraid service configs, and drive the Unraid web plugin cache. They don't belong in Tools/. - Tools/{4 scripts + php} → Plugin/unraid/tools/ - Fix source depth: ../ → ../../../ (now 3 levels from repo root) - Fix conf_populate SCRIPTS_ROOT bug: was never set, would expand to empty - api/arrs.php, api/storage.php: SCRIPTS_DIR/Tools/ → dirname(__DIR__)/tools/ - schedule.json: key IDs updated to Plugin/unraid/tools/... - Cron rebuilt — live entries updated immediately --- Plugin/unraid/api/arrs.php | 2 +- Plugin/unraid/api/storage.php | 2 +- {Tools => Plugin/unraid/tools}/api_cache_writer.php | 0 {Tools => Plugin/unraid/tools}/api_cache_writer.sh | 0 {Tools => Plugin/unraid/tools}/conf_populate.sh | 3 ++- {Tools => Plugin/unraid/tools}/remote_arr_cache_writer.sh | 2 +- {Tools => Plugin/unraid/tools}/storage_migrate.sh | 2 +- 7 files changed, 6 insertions(+), 5 deletions(-) rename {Tools => Plugin/unraid/tools}/api_cache_writer.php (100%) rename {Tools => Plugin/unraid/tools}/api_cache_writer.sh (100%) rename {Tools => Plugin/unraid/tools}/conf_populate.sh (99%) rename {Tools => Plugin/unraid/tools}/remote_arr_cache_writer.sh (99%) rename {Tools => Plugin/unraid/tools}/storage_migrate.sh (99%) diff --git a/Plugin/unraid/api/arrs.php b/Plugin/unraid/api/arrs.php index 32cc23c..3bede9c 100644 --- a/Plugin/unraid/api/arrs.php +++ b/Plugin/unraid/api/arrs.php @@ -9,7 +9,7 @@ if ($_action === 'refresh_remote') { if (!preg_match('/^host\d+$/', $host)) { echo json_encode(['ok' => false, 'error' => 'Invalid host']); exit; } - $script = SCRIPTS_DIR . '/Tools/remote_arr_cache_writer.sh'; + $script = dirname(__DIR__) . '/tools/remote_arr_cache_writer.sh'; if (!file_exists($script)) { echo json_encode(['ok' => false, 'error' => 'remote_arr_cache_writer.sh not found']); exit; } diff --git a/Plugin/unraid/api/storage.php b/Plugin/unraid/api/storage.php index 1739e28..32cef09 100644 --- a/Plugin/unraid/api/storage.php +++ b/Plugin/unraid/api/storage.php @@ -56,7 +56,7 @@ if ($action === 'migrate' && $_SERVER['REQUEST_METHOD'] === 'POST') { exit; } - $script = SCRIPTS_DIR . '/Tools/storage_migrate.sh'; + $script = dirname(__DIR__) . '/tools/storage_migrate.sh'; if (!file_exists($script)) { echo json_encode(['ok' => false, 'error' => 'storage_migrate.sh not found']); exit; diff --git a/Tools/api_cache_writer.php b/Plugin/unraid/tools/api_cache_writer.php similarity index 100% rename from Tools/api_cache_writer.php rename to Plugin/unraid/tools/api_cache_writer.php diff --git a/Tools/api_cache_writer.sh b/Plugin/unraid/tools/api_cache_writer.sh similarity index 100% rename from Tools/api_cache_writer.sh rename to Plugin/unraid/tools/api_cache_writer.sh diff --git a/Tools/conf_populate.sh b/Plugin/unraid/tools/conf_populate.sh similarity index 99% rename from Tools/conf_populate.sh rename to Plugin/unraid/tools/conf_populate.sh index e5323f3..6a4e6bb 100755 --- a/Tools/conf_populate.sh +++ b/Plugin/unraid/tools/conf_populate.sh @@ -41,7 +41,8 @@ # ============================================================================================== SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -source "$SCRIPT_DIR/../load_config.sh" +source "$SCRIPT_DIR/../../../load_config.sh" +SCRIPTS_ROOT="$SCRIPTS_DIR" OVERWRITE=false NO_PUSH=false diff --git a/Tools/remote_arr_cache_writer.sh b/Plugin/unraid/tools/remote_arr_cache_writer.sh similarity index 99% rename from Tools/remote_arr_cache_writer.sh rename to Plugin/unraid/tools/remote_arr_cache_writer.sh index a44e06f..7d04f6a 100755 --- a/Tools/remote_arr_cache_writer.sh +++ b/Plugin/unraid/tools/remote_arr_cache_writer.sh @@ -26,7 +26,7 @@ # ============================================================================================== SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -source "$SCRIPT_DIR/../load_config.sh" +source "$SCRIPT_DIR/../../../load_config.sh" parse_args "$@" acquire_lock diff --git a/Tools/storage_migrate.sh b/Plugin/unraid/tools/storage_migrate.sh similarity index 99% rename from Tools/storage_migrate.sh rename to Plugin/unraid/tools/storage_migrate.sh index 76d190e..eec1259 100755 --- a/Tools/storage_migrate.sh +++ b/Plugin/unraid/tools/storage_migrate.sh @@ -42,7 +42,7 @@ # ============================================================================================== SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -source "$SCRIPT_DIR/../load_config.sh" +source "$SCRIPT_DIR/../../../load_config.sh" parse_args "$@" acquire_lock