diff --git a/admin/_config.php b/admin/_config.php index dc954c66442..4ea5c221aad 100644 --- a/admin/_config.php +++ b/admin/_config.php @@ -6,7 +6,7 @@ 'mode' => 'none', // initialized through LeftAndMain.EditFor.js logic 'body_class' => 'typography', - 'document_base_url' => Director::absoluteBaseURL(), + 'document_base_url' => isset($_SERVER['HTTP_HOST']) ? Director::absoluteBaseURL() : null, 'cleanup_callback' => "sapphiremce_cleanup", diff --git a/cli-script.php b/cli-script.php index 131060785d3..5cc2df55519 100755 --- a/cli-script.php +++ b/cli-script.php @@ -68,10 +68,43 @@ // We don't have a session in cli-script, but this prevents errors $_SESSION = null; -// Connect to database require_once("model/DB.php"); + + +// Connect to database +if(!isset($databaseConfig) || !isset($databaseConfig['database']) || !$databaseConfig['database']) { + echo "\nPlease configure your database connection details. You can do this by creating a file +called _ss_environment.php in either of the following locations:\n\n"; + echo " - " . BASE_PATH ."_ss_environment.php\n - " . dirname(BASE_PATH) . "_ss_environment.php\n\n"; + echo <<'); +define('SS_DATABASE_PASSWORD', ''); +define('SS_DATABASE_NAME', ''); +-------------------------------------------------- + +Once you have done that, run 'composer install' or './framework/sake dev/build' to create +an empty database. + +For more information, please read this page in our docs: +http://doc.silverstripe.org/framework/en/topics/environment-management + + +ENVCONTENT; + exit(1); +} DB::connect($databaseConfig); + // Get the request URL from the querystring arguments $url = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : null; if(!$url) {