Merge pull request #1408 from emanueleg/main
Use UUID when deleting pages and when installing example content
This commit is contained in:
commit
974860cb88
2 changed files with 15 additions and 8 deletions
|
@ -345,8 +345,9 @@ class Pages extends dbJSON {
|
|||
}
|
||||
|
||||
// Delete upload directory
|
||||
if (Filesystem::deleteRecursive(PATH_UPLOADS_PAGES.$key) === false) {
|
||||
Log::set(__METHOD__.LOG_SEP.'An error occurred while trying to delete the directory: '.PATH_UPLOADS_PAGES.$key, LOG_TYPE_ERROR);
|
||||
unlink(PATH_UPLOADS_PAGES.$key);
|
||||
if (Filesystem::deleteRecursive(PATH_UPLOADS_PAGES.$this->db[$key]['uuid']) === false) {
|
||||
Log::set(__METHOD__.LOG_SEP.'An error occurred while trying to delete the directory: '.PATH_UPLOADS_PAGES.$this->db[$key]['uuid'], LOG_TYPE_ERROR);
|
||||
}
|
||||
|
||||
// Remove from database
|
||||
|
|
18
install.php
18
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') {
|
|||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue