diff --git a/app/Controllers/UserController.php b/app/Controllers/UserController.php index e6bac29..68f5478 100644 --- a/app/Controllers/UserController.php +++ b/app/Controllers/UserController.php @@ -219,7 +219,6 @@ class UserController extends Controller return redirect($response, route('user.index')); } - /** * @param Request $request * @param Response $response diff --git a/bin/migrate b/bin/migrate index bb0d2c6..bc24bb0 100644 --- a/bin/migrate +++ b/bin/migrate @@ -33,8 +33,8 @@ if (isset($argv[1]) && $argv[1] === '--install') { $db->query("INSERT INTO `users` (`email`, `username`, `password`, `is_admin`, `user_code`) VALUES ('admin@example.com', 'admin', ?, 1, ?)", [password_hash('admin', PASSWORD_DEFAULT), humanRandomString(5)]); } -if (file_exists(__DIR__.'/../install')) { - removeDirectory(__DIR__.'/../install'); +if (file_exists(__DIR__.'/../install') && (!isset($config['debug']) || !$config['debug'])) { + //removeDirectory(__DIR__.'/../install'); } echo 'If you are upgrading from a previous version, please run a "php bin\clean".'.PHP_EOL; diff --git a/install/index.php b/install/index.php index 84f1dc6..2538b7e 100644 --- a/install/index.php +++ b/install/index.php @@ -230,7 +230,9 @@ $app->post('/', function (Request $request, Response $response, Filesystem $stor cleanDirectory(__DIR__.'/../resources/cache'); cleanDirectory(__DIR__.'/../resources/sessions'); - removeDirectory(__DIR__.'/../install'); + if (!isset($config['debug']) || !$config['debug']) { + removeDirectory(__DIR__.'/../install'); + } // Installed successfully, destroy the installer session $session->destroy(); diff --git a/resources/schemas/mysql/mysql.6.sql b/resources/schemas/mysql/mysql.6.sql new file mode 100644 index 0000000..d81d58e --- /dev/null +++ b/resources/schemas/mysql/mysql.6.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS `tags` ( + `id` INTEGER PRIMARY KEY AUTO_INCREMENT, + `name` VARCHAR(32) NOT NULL, + `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + INDEX (`name`) +); + +CREATE TABLE IF NOT EXISTS `uploads_tags` ( + `upload_id` INTEGER, + `tag_id` INTEGER, + PRIMARY KEY (`upload_id`, `tag_id`), + FOREIGN KEY (`upload_id`) REFERENCES `uploads` (`id`) + ON UPDATE CASCADE + ON DELETE CASCADE, + FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`) + ON UPDATE CASCADE + ON DELETE CASCADE +); \ No newline at end of file diff --git a/resources/schemas/sqlite/sqlite.6.sql b/resources/schemas/sqlite/sqlite.6.sql new file mode 100644 index 0000000..0b5ba34 --- /dev/null +++ b/resources/schemas/sqlite/sqlite.6.sql @@ -0,0 +1,20 @@ +CREATE TABLE IF NOT EXISTS `tags` ( + `id` INTEGER PRIMARY KEY AUTOINCREMENT, + `name` VARCHAR(32) NOT NULL, + `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE UNIQUE INDEX IF NOT EXISTS `tag_name` + ON `tags` (`name`); + +CREATE TABLE IF NOT EXISTS `uploads_tags` ( + `upload_id` INTEGER, + `tag_id` INTEGER, + PRIMARY KEY (`upload_id`, `tag_id`), + FOREIGN KEY (`upload_id`) REFERENCES `uploads` (`id`) + ON UPDATE CASCADE + ON DELETE CASCADE, + FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`) + ON UPDATE CASCADE + ON DELETE CASCADE +); \ No newline at end of file diff --git a/resources/templates/dashboard/list.twig b/resources/templates/dashboard/list.twig index 60802a2..33cdda2 100644 --- a/resources/templates/dashboard/list.twig +++ b/resources/templates/dashboard/list.twig @@ -40,7 +40,7 @@ {% endif %} -