Permalink
Browse files

BUGFIX Installer now opens if mod_rewrite is disabled. Using index.ph…

…p instead of rewriting the URL didn't quite work with the new BASE_URL, so we need to take this case into account as well (from r98895)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102811 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent afb7b5e commit 0a5321dd102faa955dd0152d297619046df19bd7 @chillu chillu committed Apr 14, 2010
Showing with 5 additions and 2 deletions.
  1. +4 −1 core/Core.php
  2. +1 −1 main.php
View
5 core/Core.php
@@ -134,7 +134,10 @@ function array_fill_keys($keys,$value) {
// If that didn't work, failover to the old syntax. Hopefully this isn't necessary, and maybe
// if can be phased out?
if(!defined('BASE_URL')) {
- define('BASE_URL', rtrim(dirname(dirname($_SERVER['SCRIPT_NAME'])), DIRECTORY_SEPARATOR));
+ $dir = strpos($_SERVER['SCRIPT_NAME'], 'index.php')
+ ? dirname($_SERVER['SCRIPT_NAME'])
+ : dirname(dirname($_SERVER['SCRIPT_NAME']));
+ define('BASE_URL', rtrim($dir, DIRECTORY_SEPARATOR));
}
}
define('MODULES_DIR', 'modules');
View
2 main.php
@@ -107,7 +107,7 @@
// Redirect to the installer if no database is selected
if(!isset($databaseConfig) || !isset($databaseConfig['database']) || !$databaseConfig['database']) {
$s = (isset($_SERVER['SSL']) || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')) ? 's' : '';
- $installURL = "http$s://" . $_SERVER['HTTP_HOST'] . dirname(dirname($_SERVER['SCRIPT_NAME'])) . '/install.php';
+ $installURL = "http$s://" . $_SERVER['HTTP_HOST'] . BASE_URL . '/install.php';
// The above dirname() will equate to "\" on Windows when installing directly from http://localhost (not using
// a sub-directory), this really messes things up in some browsers. Let's get rid of the backslashes

0 comments on commit 0a5321d

Please sign in to comment.