From d2f4ded3efe7a6758729c517a8b56281ab9c6aac Mon Sep 17 00:00:00 2001 From: Maxime Rainville Date: Thu, 24 May 2018 10:08:43 +1200 Subject: [PATCH] :bug: Adjust `deleteinstallfiles` to use PUBLIC_PATH. --- code/Controllers/ContentController.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/code/Controllers/ContentController.php b/code/Controllers/ContentController.php index 60e94abe..e14d6794 100644 --- a/code/Controllers/ContentController.php +++ b/code/Controllers/ContentController.php @@ -512,24 +512,22 @@ HTML; $title = new DBVarchar("Title"); $content = new DBHTMLText('Content'); - // We can't delete index.php as it might be necessary for URL routing without mod_rewrite. - // There's no safe way to detect usage of mod_rewrite across webservers, - // so we have to assume the file is required. - $installfiles = [ + // As of SS4, index.php is required and should never be deleted. + $installfiles = array( 'install.php', - 'config-form.css', - 'config-form.html', - 'index.html', - ]; + 'install-frameworkmissing.html', + 'index.html' + ); $unsuccessful = new ArrayList(); foreach ($installfiles as $installfile) { - if (file_exists(BASE_PATH . '/' . $installfile)) { - @unlink(BASE_PATH . '/' . $installfile); + $installfilepath = PUBLIC_PATH . '/' . $installfile; + if (file_exists($installfilepath)) { + @unlink($installfilepath); } - if (file_exists(BASE_PATH . '/' . $installfile)) { - $unsuccessful->push(new ArrayData(['File' => $installfile])); + if (file_exists($installfilepath)) { + $unsuccessful->push(new ArrayData(array('File' => $installfile))); } }