From 21944a2e06fe8d5111fcbd5dfb03c945e669ecce Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 29 Sep 2008 12:33:07 +0000 Subject: [PATCH] BUGFIX Moved *_PATH and PR_*constants from main.php/cli-script.php back to Core.php - was causing problems with installer (directly includes Core.php, but doesn't run through main.php) - see ticket #2867 for improvement suggestions in bootstrapping code to avoid these bugs git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63290 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- cli-script.php | 25 ------------------------- core/Core.php | 25 +++++++++++++++++++++++++ main.php | 25 ------------------------- 3 files changed, 25 insertions(+), 50 deletions(-) diff --git a/cli-script.php b/cli-script.php index 873b1030e..07bcad2d0 100755 --- a/cli-script.php +++ b/cli-script.php @@ -44,36 +44,11 @@ if(isset($_SERVER['argv'][2])) { $_SERVER['SCRIPT_FILENAME'] = __FILE__; chdir(dirname($_SERVER['SCRIPT_FILENAME'])); -/** - * Define system paths - */ -define('BASE_PATH', dirname(dirname($_SERVER['SCRIPT_FILENAME']))); -define('BASE_URL', dirname(dirname($_SERVER['SCRIPT_NAME']))); -define('MODULES_DIR', 'modules'); -define('MODULES_PATH', BASE_PATH . '/' . MODULES_DIR); -define('THIRDPARTY_DIR', 'jsparty'); -define('THIRDPARTY_PATH', BASE_PATH . '/' . THIRDPARTY_DIR); -define('THEMES_DIR', 'themes'); -define('THEMES_PATH', BASE_PATH . '/' . THEMES_DIR); -define('SAPPHIRE_DIR', 'sapphire'); -define('SAPPHIRE_PATH', BASE_PATH . '/' . SAPPHIRE_DIR); -define('CMS_DIR', 'cms'); -define('CMS_PATH', BASE_PATH . '/' . CMS_DIR); -define('ASSETS_DIR', 'assets'); -define('ASSETS_PATH', BASE_PATH . '/' . ASSETS_DIR); - /** * Include Sapphire's core code */ require_once("core/Core.php"); -/** - * Priorities definition. These constants are used in calls to _t() as an optional argument - */ -define('PR_HIGH',100); -define('PR_MEDIUM',50); -define('PR_LOW',10); - header("Content-type: text/html; charset=\"utf-8\""); if(function_exists('mb_http_output')) { mb_http_output('UTF-8'); diff --git a/core/Core.php b/core/Core.php index 6ba0e1751..2d5c73ad3 100755 --- a/core/Core.php +++ b/core/Core.php @@ -6,6 +6,24 @@ * @subpackage core */ +/** + * Define system paths + */ +define('BASE_PATH', dirname(dirname($_SERVER['SCRIPT_FILENAME']))); +define('BASE_URL', dirname(dirname($_SERVER['SCRIPT_NAME']))); +define('MODULES_DIR', 'modules'); +define('MODULES_PATH', BASE_PATH . '/' . MODULES_DIR); +define('THIRDPARTY_DIR', 'jsparty'); +define('THIRDPARTY_PATH', BASE_PATH . '/' . THIRDPARTY_DIR); +define('THEMES_DIR', 'themes'); +define('THEMES_PATH', BASE_PATH . '/' . THEMES_DIR); +define('SAPPHIRE_DIR', 'sapphire'); +define('SAPPHIRE_PATH', BASE_PATH . '/' . SAPPHIRE_DIR); +define('CMS_DIR', 'cms'); +define('CMS_PATH', BASE_PATH . '/' . CMS_DIR); +define('ASSETS_DIR', 'assets'); +define('ASSETS_PATH', BASE_PATH . '/' . ASSETS_DIR); + /** * Define the temporary folder if it wasn't defined yet */ @@ -13,6 +31,13 @@ if(!defined('TEMP_FOLDER')) { define('TEMP_FOLDER', getTempFolder()); } +/** + * Priorities definition. These constants are used in calls to _t() as an optional argument + */ +define('PR_HIGH',100); +define('PR_MEDIUM',50); +define('PR_LOW',10); + /** * Returns the temporary folder that sapphire/silverstripe should use for its cache files * This is loaded into the TEMP_FOLDER define on start up diff --git a/main.php b/main.php index dac8fc9a5..d866320ad 100644 --- a/main.php +++ b/main.php @@ -46,36 +46,11 @@ foreach ($envFiles as $envFile) { } } -/** - * Define system paths - */ -define('BASE_PATH', dirname(dirname($_SERVER['SCRIPT_FILENAME']))); -define('BASE_URL', dirname(dirname($_SERVER['SCRIPT_NAME']))); -define('MODULES_DIR', 'modules'); -define('MODULES_PATH', BASE_PATH . '/' . MODULES_DIR); -define('THIRDPARTY_DIR', 'jsparty'); -define('THIRDPARTY_PATH', BASE_PATH . '/' . THIRDPARTY_DIR); -define('THEMES_DIR', 'themes'); -define('THEMES_PATH', BASE_PATH . '/' . THEMES_DIR); -define('SAPPHIRE_DIR', 'sapphire'); -define('SAPPHIRE_PATH', BASE_PATH . '/' . SAPPHIRE_DIR); -define('CMS_DIR', 'cms'); -define('CMS_PATH', BASE_PATH . '/' . CMS_DIR); -define('ASSETS_DIR', 'assets'); -define('ASSETS_PATH', BASE_PATH . '/' . ASSETS_DIR); - /** * Include Sapphire's core code */ require_once("core/Core.php"); -/** - * Priorities definition. These constants are used in calls to _t() as an optional argument - */ -define('PR_HIGH',100); -define('PR_MEDIUM',50); -define('PR_LOW',10); - header("Content-type: text/html; charset=\"utf-8\""); if (function_exists('mb_http_output')) { mb_http_output('UTF-8');