From 9bd908ee88489e5bc2785a1bafa7ffca5525497e Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Tue, 7 Jul 2026 13:13:18 +0200 Subject: [PATCH 1/4] add upgrade script for directory sharing --- upgrade/0.4.0/README | 3 +++ upgrade/0.4.0/upgrade.php | 42 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 upgrade/0.4.0/README create mode 100644 upgrade/0.4.0/upgrade.php diff --git a/upgrade/0.4.0/README b/upgrade/0.4.0/README new file mode 100644 index 0000000..f0302f5 --- /dev/null +++ b/upgrade/0.4.0/README @@ -0,0 +1,3 @@ +This version has a change to store directories split out over subdirectories, to make sure we stay navigatable when the number of pod grows. + +The upgrade script moves the existing directories from the 32 character directories in 1 directory, to multiple subdirectories. diff --git a/upgrade/0.4.0/upgrade.php b/upgrade/0.4.0/upgrade.php new file mode 100644 index 0000000..fe446d7 --- /dev/null +++ b/upgrade/0.4.0/upgrade.php @@ -0,0 +1,42 @@ + $destination\n\n"; + } else { + echo "Failed: $dir\n"; + } +} \ No newline at end of file From a898e4e48e813d449e382d66b19942e309e50013 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Tue, 7 Jul 2026 13:14:26 +0200 Subject: [PATCH 2/4] mode 755 instead of 777 --- upgrade/0.4.0/upgrade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upgrade/0.4.0/upgrade.php b/upgrade/0.4.0/upgrade.php index fe446d7..506d6ee 100644 --- a/upgrade/0.4.0/upgrade.php +++ b/upgrade/0.4.0/upgrade.php @@ -26,7 +26,7 @@ // Create parent directories $parent = dirname($destination); if (!is_dir($parent)) { - mkdir($parent, 0777, true); + mkdir($parent, 0755, true); } $source = str_replace("//", "/", $source); From 0b8f128557fc2e957a2a9995b3e912d68415cc7a Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Tue, 7 Jul 2026 13:16:44 +0200 Subject: [PATCH 3/4] whitespace --- upgrade/0.4.0/upgrade.php | 72 +++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/upgrade/0.4.0/upgrade.php b/upgrade/0.4.0/upgrade.php index 506d6ee..031003c 100644 --- a/upgrade/0.4.0/upgrade.php +++ b/upgrade/0.4.0/upgrade.php @@ -3,40 +3,40 @@ require_once(__DIR__ . "/../../config.php"); foreach (scandir(STORAGEBASE) as $dir) { - if ($dir === '.' || $dir === '..') { - continue; - } - - $source = STORAGEBASE . DIRECTORY_SEPARATOR . $dir; - - // Only process directories with a 32-character hexadecimal name - if (!is_dir($source) || !preg_match('/^[a-f0-9]{32}$/i', $dir)) { - continue; - } - - // Split into 8 chunks of 4 characters - $parts = str_split($dir, 4); - - // Build destination path - $destination = STORAGEBASE; - foreach ($parts as $part) { - $destination .= DIRECTORY_SEPARATOR . $part; - } - - // Create parent directories - $parent = dirname($destination); - if (!is_dir($parent)) { - mkdir($parent, 0755, true); - } - - $source = str_replace("//", "/", $source); - $destination = str_replace("//", "/", $destination); - // Move the directory - if (rename($source, $destination)) { - echo "Moved:\n"; - echo " $source\n"; - echo " -> $destination\n\n"; - } else { - echo "Failed: $dir\n"; - } + if ($dir === '.' || $dir === '..') { + continue; + } + + $source = STORAGEBASE . DIRECTORY_SEPARATOR . $dir; + + // Only process directories with a 32-character hexadecimal name + if (!is_dir($source) || !preg_match('/^[a-f0-9]{32}$/i', $dir)) { + continue; + } + + // Split into 8 chunks of 4 characters + $parts = str_split($dir, 4); + + // Build destination path + $destination = STORAGEBASE; + foreach ($parts as $part) { + $destination .= DIRECTORY_SEPARATOR . $part; + } + + // Create parent directories + $parent = dirname($destination); + if (!is_dir($parent)) { + mkdir($parent, 0755, true); + } + + $source = str_replace("//", "/", $source); + $destination = str_replace("//", "/", $destination); + // Move the directory + if (rename($source, $destination)) { + echo "Moved:\n"; + echo " $source\n"; + echo " -> $destination\n\n"; + } else { + echo "Failed: $dir\n"; + } } \ No newline at end of file From 7729c8917d08e90a03dbadaef9312e9a8f4d5328 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Tue, 7 Jul 2026 13:21:41 +0200 Subject: [PATCH 4/4] add newline --- upgrade/0.4.0/upgrade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upgrade/0.4.0/upgrade.php b/upgrade/0.4.0/upgrade.php index 031003c..33260f4 100644 --- a/upgrade/0.4.0/upgrade.php +++ b/upgrade/0.4.0/upgrade.php @@ -39,4 +39,4 @@ } else { echo "Failed: $dir\n"; } -} \ No newline at end of file +}