From d946a3b240f99b856cc4a14eeecbaa3c5fd2f01e Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 25 Oct 2016 11:57:05 +1300 Subject: [PATCH] FIX: Allow CMS_DIR at the root. CMS_DIR is now inferred from the file location and may be at the project root. --- _config.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/_config.php b/_config.php index eec9e6af..6e13b509 100644 --- a/_config.php +++ b/_config.php @@ -9,8 +9,12 @@ use SilverStripe\Assets\File; * - CMS_DIR: Path relative to webroot, e.g. "cms" * - CMS_PATH: Absolute filepath, e.g. "/var/www/my-webroot/cms" */ -define('CMS_DIR', 'cms'); -define('CMS_PATH', BASE_PATH . '/' . CMS_DIR); +define('CMS_PATH', realpath(__DIR__)); +if(strpos(CMS_PATH, BASE_PATH) === 0) { + define('CMS_DIR', trim(substr(CMS_PATH, strlen(BASE_PATH)), '/')); +} else { + throw new Exception("Path error: CMS_PATH " . CMS_PATH . " not within BASE_PATH " . BASE_PATH); +} /** * Register the default internal shortcodes.