From 0bbf886fac5cc43e20e172767425ef2834ad29e5 Mon Sep 17 00:00:00 2001 From: Emanuele Date: Wed, 2 Mar 2022 22:39:30 +0100 Subject: [PATCH] Use UUID for example pages --- install.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/install.php b/install.php index ed003eac..74b7e7c4 100644 --- a/install.php +++ b/install.php @@ -290,11 +290,6 @@ function install($adminPassword, $timezone) $errorText = 'Error when trying to created the directory=>' . PATH_PAGES . $page['url']; error_log('[ERROR] ' . $errorText, 0); } - - if (!mkdir(PATH_UPLOADS_PAGES.$page['url'], DIR_PERMISSIONS, true)) { - $errorText = 'Error when trying to created the directory=>' . PATH_UPLOADS_PAGES . $page['url']; - error_log('[ERROR] ' . $errorText, 0); - } } // Directories for initial plugins @@ -350,6 +345,17 @@ function install($adminPassword, $timezone) array_push($slugs, $page['url']); file_put_contents(PATH_PAGES . $page['url'] . DS . FILENAME, $page['content'], LOCK_EX); + + if (!mkdir(PATH_UPLOADS_PAGES.$data[$page['url']]['uuid'], DIR_PERMISSIONS, true)) { + $errorText = 'Error when trying to create the directory=>' . PATH_UPLOADS_PAGES . $data[$page['url']]['uuid']; + error_log('[ERROR] ' . $errorText, 0); + } + + if (symlink(PATH_UPLOADS_PAGES.$data[$page['url']]['uuid'], PATH_UPLOADS_PAGES.$page['url']) === false) { + $errorText = 'Error when trying to create the symlink =>' . PATH_UPLOADS_PAGES . $page['url']; + error_log('[ERROR] ' . $errorText, 0); + } + } file_put_contents(PATH_DATABASES . 'pages.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX); @@ -771,4 +777,4 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { - \ No newline at end of file +