mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
parents-merge 43781 Ensure that Director::isTest/Live/Dev work in cli-script.php calls, #prnt:54 - Weekly Hot Tips didn't get sent.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@45066 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
cc97834409
commit
c5bce8347c
@ -3,7 +3,6 @@
|
|||||||
/**
|
/**
|
||||||
* Main file that handles every page request.
|
* Main file that handles every page request.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$_SERVER['HTTP_HOST'] = $_SERVER['argv'][2];
|
$_SERVER['HTTP_HOST'] = $_SERVER['argv'][2];
|
||||||
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
|
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
|
||||||
chdir(dirname($_SERVER['SCRIPT_FILENAME']));
|
chdir(dirname($_SERVER['SCRIPT_FILENAME']));
|
||||||
@ -20,13 +19,18 @@ if(function_exists('mb_http_output')) {
|
|||||||
if( preg_match( '/(test\.totallydigital\.co\.nz|dev\.totallydigital\.co\.nz\/test)(.*)/', $_SERVER['SCRIPT_FILENAME'], $nameMatch ) ) {
|
if( preg_match( '/(test\.totallydigital\.co\.nz|dev\.totallydigital\.co\.nz\/test)(.*)/', $_SERVER['SCRIPT_FILENAME'], $nameMatch ) ) {
|
||||||
$_SERVER['SCRIPT_NAME'] = $nameMatch[2];
|
$_SERVER['SCRIPT_NAME'] = $nameMatch[2];
|
||||||
$_SERVER['HTTP_HOST'] = $nameMatch[1];
|
$_SERVER['HTTP_HOST'] = $nameMatch[1];
|
||||||
} elseif( preg_match( '/dev\.totallydigital\.co\.nz(.*)/', $_SERVER['SCRIPT_FILENAME'], $nameMatch ) )
|
$envType = 'test';
|
||||||
|
} elseif( preg_match( '/dev\.totallydigital\.co\.nz(.*)/', $_SERVER['SCRIPT_FILENAME'], $nameMatch ) ) {
|
||||||
$_SERVER['SCRIPT_NAME'] = $nameMatch[1];
|
$_SERVER['SCRIPT_NAME'] = $nameMatch[1];
|
||||||
elseif( preg_match( '/\/sites\/[^\/]+\/www(.*)/', $_SERVER['SCRIPT_FILENAME'], $nameMatch ) )
|
$envType = 'dev';
|
||||||
|
} elseif( preg_match( '/\/sites\/[^\/]+\/www(.*)/', $_SERVER['SCRIPT_FILENAME'], $nameMatch ) ) {
|
||||||
$_SERVER['SCRIPT_NAME'] = $nameMatch[1];
|
$_SERVER['SCRIPT_NAME'] = $nameMatch[1];
|
||||||
elseif( preg_match( '/\/sites\/[^\/]+(.*)/', $_SERVER['SCRIPT_FILENAME'], $nameMatch ) )
|
$envType = 'live';
|
||||||
|
} elseif( preg_match( '/\/sites\/[^\/]+(.*)/', $_SERVER['SCRIPT_FILENAME'], $nameMatch ) ) {
|
||||||
$_SERVER['SCRIPT_NAME'] = $nameMatch[1];
|
$_SERVER['SCRIPT_NAME'] = $nameMatch[1];
|
||||||
elseif(!isset($_SERVER['SCRIPT_NAME'])) {
|
} elseif(isset($_SERVER['SCRIPT_NAME'])) {
|
||||||
|
$envType = 'live';
|
||||||
|
} else {
|
||||||
echo "Error: could not determine server configuration {$_SERVER['SCRIPT_FILENAME']}\n";
|
echo "Error: could not determine server configuration {$_SERVER['SCRIPT_FILENAME']}\n";
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
@ -39,7 +43,6 @@ if($_REQUEST && get_magic_quotes_gpc()) {
|
|||||||
|
|
||||||
if($_REQUEST['trace']) apd_set_pprof_trace();
|
if($_REQUEST['trace']) apd_set_pprof_trace();
|
||||||
|
|
||||||
|
|
||||||
require_once("core/ManifestBuilder.php");
|
require_once("core/ManifestBuilder.php");
|
||||||
require_once("core/ClassInfo.php");
|
require_once("core/ClassInfo.php");
|
||||||
require_once('core/Object.php');
|
require_once('core/Object.php');
|
||||||
@ -65,6 +68,8 @@ require_once(MANIFEST_FILE);
|
|||||||
|
|
||||||
if($_GET['debugmanifest']) Debug::show(file_get_contents(MANIFEST_FILE));
|
if($_GET['debugmanifest']) Debug::show(file_get_contents(MANIFEST_FILE));
|
||||||
|
|
||||||
|
Director::set_environment_type($envType);
|
||||||
|
|
||||||
// Default director
|
// Default director
|
||||||
Director::addRules(10, array(
|
Director::addRules(10, array(
|
||||||
'Security/$Action' => 'Security',
|
'Security/$Action' => 'Security',
|
||||||
|
Loading…
Reference in New Issue
Block a user