From 89b4b1eefdef290fc5df357d2ea6c8572dbb5906 Mon Sep 17 00:00:00 2001 From: AudioCore Bot Date: Wed, 4 Mar 2026 22:40:59 +0000 Subject: [PATCH] Installer: auto-create storage directory and seed settings/db files --- modules/admin/AdminController.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/admin/AdminController.php b/modules/admin/AdminController.php index 24a9977..67e68fa 100644 --- a/modules/admin/AdminController.php +++ b/modules/admin/AdminController.php @@ -700,7 +700,18 @@ class AdminController . " 'pass' => '" . addslashes($dbPass) . "',\n" . " 'port' => " . (int)$dbPort . ",\n" . "];\n"; - $configPath = __DIR__ . '/../../storage/db.php'; + $storageDir = __DIR__ . '/../../storage'; + if (!is_dir($storageDir)) { + if (!@mkdir($storageDir, 0775, true) && !is_dir($storageDir)) { + return new Response('', 302, ['Location' => '/admin/installer?error=' . rawurlencode('Unable to create storage directory.')]); + } + } + $settingsPath = $storageDir . '/settings.php'; + if (!is_file($settingsPath)) { + $settingsSeed = " 'AudioCore V1.5',\n];\n"; + @file_put_contents($settingsPath, $settingsSeed); + } + $configPath = $storageDir . '/db.php'; if (file_put_contents($configPath, $config) === false) { return new Response('', 302, ['Location' => '/admin/installer?error=' . rawurlencode('Unable to write DB config file.')]); }