diff --git a/dev/install/install.php5 b/dev/install/install.php5 index 0eda6990e..438a29224 100755 --- a/dev/install/install.php5 +++ b/dev/install/install.php5 @@ -27,7 +27,7 @@ ini_set('display_errors', '1'); error_reporting(E_ALL | E_STRICT); // Attempt to start a session so that the username and password can be sent back to the user. -if (function_exists('session_start') && !session_id()) { +if(function_exists('session_start') && !session_id()) { session_start(); } @@ -45,36 +45,35 @@ $dirsToCheck = array( dirname($_SERVER['SCRIPT_FILENAME']) ); //if they are the same, remove one of them -if ($dirsToCheck[0] == $dirsToCheck[1]) { +if($dirsToCheck[0] == $dirsToCheck[1]) { unset($dirsToCheck[1]); } -foreach ($dirsToCheck as $dir) { +foreach($dirsToCheck as $dir) { //check this dir and every parent dir (until we hit the base of the drive) // or until we hit a dir we can't read -do { + do { //add the trailing slash we need to concatenate properly $dir .= DIRECTORY_SEPARATOR; //if it's readable, go ahead - if (@is_readable($dir)) { - //if the file exists, then we include it, set relevant vars and break out - if (file_exists($dir . $envFile)) { - include_once($dir . $envFile); - $envFileExists = true; - //legacy variable assignment - $usingEnv = true; + if(@is_readable($dir)) { + //if the file exists, then we include it, set relevant vars and break out + if(file_exists($dir . $envFile)) { + include_once($dir . $envFile); + $envFileExists = true; + //legacy variable assignment + $usingEnv = true; //break out of BOTH loops because we found the $envFile break(2); } - } - else { + } else { //break out of the while loop, we can't read the dir - break; - } + break; + } //go up a directory $dir = dirname($dir); - //here we need to check that the path of the last dir and the next one are + //here we need to check that the path of the last dir and the next one are // not the same, if they are, we have hit the root of the drive - } while (dirname($dir) != $dir); + } while(dirname($dir) != $dir); } if($envFileExists) { @@ -91,62 +90,62 @@ require_once FRAMEWORK_NAME . '/dev/install/DatabaseAdapterRegistry.php'; // Set default locale, but try and sniff from the user agent $defaultLocale = 'en_US'; $locales = array( - 'af_ZA' => 'Afrikaans (South Africa)', - 'ar_EG' => 'Arabic (Egypt)', - 'hy_AM' => 'Armenian (Armenia)', - 'ast_ES' => 'Asturian (Spain)', - 'az_AZ' => 'Azerbaijani (Azerbaijan)', - 'bs_BA' => 'Bosnian (Bosnia and Herzegovina)', - 'bg_BG' => 'Bulgarian (Bulgaria)', - 'ca_ES' => 'Catalan (Spain)', - 'zh_CN' => 'Chinese (China)', - 'zh_TW' => 'Chinese (Taiwan)', - 'hr_HR' => 'Croatian (Croatia)', - 'cs_CZ' => 'Czech (Czech Republic)', - 'da_DK' => 'Danish (Denmark)', - 'nl_NL' => 'Dutch (Netherlands)', - 'en_GB' => 'English (United Kingdom)', - 'en_US' => 'English (United States)', - 'eo_XX' => 'Esperanto', - 'et_EE' => 'Estonian (Estonia)', - 'fo_FO' => 'Faroese (Faroe Islands)', - 'fi_FI' => 'Finnish (Finland)', - 'fr_FR' => 'French (France)', - 'de_DE' => 'German (Germany)', - 'el_GR' => 'Greek (Greece)', - 'he_IL' => 'Hebrew (Israel)', - 'hu_HU' => 'Hungarian (Hungary)', - 'is_IS' => 'Icelandic (Iceland)', - 'id_ID' => 'Indonesian (Indonesia)', - 'it_IT' => 'Italian (Italy)', - 'ja_JP' => 'Japanese (Japan)', - 'km_KH' => 'Khmer (Cambodia)', - 'lc_XX' => 'LOLCAT', - 'lv_LV' => 'Latvian (Latvia)', - 'lt_LT' => 'Lithuanian (Lithuania)', - 'ms_MY' => 'Malay (Malaysia)', - 'mi_NZ' => 'Maori (New Zealand)', - 'ne_NP' => 'Nepali (Nepal)', - 'nb_NO' => 'Norwegian', - 'fa_IR' => 'Persian (Iran)', - 'pl_PL' => 'Polish (Poland)', - 'pt_BR' => 'Portuguese (Brazil)', - 'pa_IN' => 'Punjabi (India)', - 'ro_RO' => 'Romanian (Romania)', - 'ru_RU' => 'Russian (Russia)', - 'sr_RS' => 'Serbian (Serbia)', - 'si_LK' => 'Sinhalese (Sri Lanka)', - 'sk_SK' => 'Slovak (Slovakia)', - 'sl_SI' => 'Slovenian (Slovenia)', - 'es_AR' => 'Spanish (Argentina)', - 'es_MX' => 'Spanish (Mexico)', - 'es_ES' => 'Spanish (Spain)', - 'sv_SE' => 'Swedish (Sweden)', - 'th_TH' => 'Thai (Thailand)', - 'tr_TR' => 'Turkish (Turkey)', - 'uk_UA' => 'Ukrainian (Ukraine)', - 'uz_UZ' => 'Uzbek (Uzbekistan)', - 'vi_VN' => 'Vietnamese (Vietnam)', + 'af_ZA' => 'Afrikaans (South Africa)', + 'ar_EG' => 'Arabic (Egypt)', + 'hy_AM' => 'Armenian (Armenia)', + 'ast_ES' => 'Asturian (Spain)', + 'az_AZ' => 'Azerbaijani (Azerbaijan)', + 'bs_BA' => 'Bosnian (Bosnia and Herzegovina)', + 'bg_BG' => 'Bulgarian (Bulgaria)', + 'ca_ES' => 'Catalan (Spain)', + 'zh_CN' => 'Chinese (China)', + 'zh_TW' => 'Chinese (Taiwan)', + 'hr_HR' => 'Croatian (Croatia)', + 'cs_CZ' => 'Czech (Czech Republic)', + 'da_DK' => 'Danish (Denmark)', + 'nl_NL' => 'Dutch (Netherlands)', + 'en_GB' => 'English (United Kingdom)', + 'en_US' => 'English (United States)', + 'eo_XX' => 'Esperanto', + 'et_EE' => 'Estonian (Estonia)', + 'fo_FO' => 'Faroese (Faroe Islands)', + 'fi_FI' => 'Finnish (Finland)', + 'fr_FR' => 'French (France)', + 'de_DE' => 'German (Germany)', + 'el_GR' => 'Greek (Greece)', + 'he_IL' => 'Hebrew (Israel)', + 'hu_HU' => 'Hungarian (Hungary)', + 'is_IS' => 'Icelandic (Iceland)', + 'id_ID' => 'Indonesian (Indonesia)', + 'it_IT' => 'Italian (Italy)', + 'ja_JP' => 'Japanese (Japan)', + 'km_KH' => 'Khmer (Cambodia)', + 'lc_XX' => 'LOLCAT', + 'lv_LV' => 'Latvian (Latvia)', + 'lt_LT' => 'Lithuanian (Lithuania)', + 'ms_MY' => 'Malay (Malaysia)', + 'mi_NZ' => 'Maori (New Zealand)', + 'ne_NP' => 'Nepali (Nepal)', + 'nb_NO' => 'Norwegian', + 'fa_IR' => 'Persian (Iran)', + 'pl_PL' => 'Polish (Poland)', + 'pt_BR' => 'Portuguese (Brazil)', + 'pa_IN' => 'Punjabi (India)', + 'ro_RO' => 'Romanian (Romania)', + 'ru_RU' => 'Russian (Russia)', + 'sr_RS' => 'Serbian (Serbia)', + 'si_LK' => 'Sinhalese (Sri Lanka)', + 'sk_SK' => 'Slovak (Slovakia)', + 'sl_SI' => 'Slovenian (Slovenia)', + 'es_AR' => 'Spanish (Argentina)', + 'es_MX' => 'Spanish (Mexico)', + 'es_ES' => 'Spanish (Spain)', + 'sv_SE' => 'Swedish (Sweden)', + 'th_TH' => 'Thai (Thailand)', + 'tr_TR' => 'Turkish (Turkey)', + 'uk_UA' => 'Ukrainian (Ukraine)', + 'uz_UZ' => 'Uzbek (Uzbekistan)', + 'vi_VN' => 'Vietnamese (Vietnam)', ); // Discover which databases are available @@ -217,8 +216,8 @@ if(file_exists('mysite/_config.php')) { if(preg_match("/\\\$database\s*=\s*[^\n\r]+[\n\r]/", file_get_contents("mysite/_config.php"), $parts)) { eval($parts[0]); if($database) $alreadyInstalled = true; - // Assume that if $databaseConfig is defined in mysite/_config.php, then a non-environment-based installation has - // already gone ahead + // Assume that if $databaseConfig is defined in mysite/_config.php, then a non-environment-based installation has + // already gone ahead } else if(preg_match("/\\\$databaseConfig\s*=\s*[^\n\r]+[\n\r]/", file_get_contents("mysite/_config.php"), $parts)) { $alreadyInstalled = true; } @@ -403,7 +402,12 @@ class InstallRequirements { $isIIS = $this->isIIS(7); $webserver = $this->findWebserver(); - $this->requirePHPVersion('5.3.4', '5.3.2', array("PHP Configuration", "PHP5 installed", null, "PHP version " . phpversion())); + $this->requirePHPVersion('5.3.4', '5.3.2', array( + "PHP Configuration", + "PHP5 installed", + null, + "PHP version " . phpversion() + )); // Check that we can identify the root folder successfully $this->requireFile(FRAMEWORK_NAME . '/dev/install/config-form.html', array("File permissions", @@ -416,15 +420,27 @@ class InstallRequirements { $this->requireModule(FRAMEWORK_NAME, array("File permissions", FRAMEWORK_NAME . "/ directory exists?")); if($isApache) { - $this->checkApacheVersion(array("Webserver Configuration", "Webserver is not Apache 1.x", "SilverStripe requires Apache version 2 or greater", $webserver)); + $this->checkApacheVersion(array( + "Webserver Configuration", + "Webserver is not Apache 1.x", "SilverStripe requires Apache version 2 or greater", + $webserver + )); $this->requireWriteable('.htaccess', array("File permissions", "Is the .htaccess file writeable?", null)); } elseif($isIIS) { $this->requireWriteable('web.config', array("File permissions", "Is the web.config file writeable?", null)); } - $this->requireWriteable('mysite/_config.php', array("File permissions", "Is the mysite/_config.php file writeable?", null)); - if (!$this->checkModuleExists('cms')) { - $this->requireWriteable('mysite/code/RootURLController.php', array("File permissions", "Is the mysite/code/RootURLController.php file writeable?", null)); + $this->requireWriteable('mysite/_config.php', array( + "File permissions", + "Is the mysite/_config.php file writeable?", + null + )); + if(!$this->checkModuleExists('cms')) { + $this->requireWriteable('mysite/code/RootURLController.php', array( + "File permissions", + "Is the mysite/code/RootURLController.php file writeable?", + null + )); } $this->requireWriteable('assets', array("File permissions", "Is the assets/ directory writeable?", null)); @@ -432,74 +448,193 @@ class InstallRequirements { $this->requireTempFolder(array('File permissions', 'Is a temporary directory available?', null, $tempFolder)); if($tempFolder) { // in addition to the temp folder being available, check it is writable - $this->requireWriteable($tempFolder, array("File permissions", sprintf("Is the temporary directory writeable?", $tempFolder), null), true); + $this->requireWriteable($tempFolder, array( + "File permissions", + sprintf("Is the temporary directory writeable?", $tempFolder), + null + ), true); } // Check for web server, unless we're calling the installer from the command-line $this->isRunningWebServer(array("Webserver Configuration", "Server software", "Unknown", $webserver)); if($isApache) { - $this->requireApacheRewriteModule('mod_rewrite', array("Webserver Configuration", "URL rewriting support", "You need mod_rewrite to use friendly URLs with SilverStripe, but it is not enabled.")); + $this->requireApacheRewriteModule('mod_rewrite', array( + "Webserver Configuration", + "URL rewriting support", + "You need mod_rewrite to use friendly URLs with SilverStripe, but it is not enabled." + )); } elseif($isIIS) { - $this->requireIISRewriteModule('IIS_UrlRewriteModule', array("Webserver Configuration", "URL rewriting support", "You need to enable the IIS URL Rewrite Module to use friendly URLs with SilverStripe, but it is not installed or enabled. Download it for IIS 7 from http://www.iis.net/expand/URLRewrite")); + $this->requireIISRewriteModule('IIS_UrlRewriteModule', array( + "Webserver Configuration", + "URL rewriting support", + "You need to enable the IIS URL Rewrite Module to use friendly URLs with SilverStripe, " + . "but it is not installed or enabled. Download it for IIS 7 from http://www.iis.net/expand/URLRewrite" + )); } else { - $this->warning(array("Webserver Configuration", "URL rewriting support", "I can't tell whether any rewriting module is running. You may need to configure a rewriting rule yourself.")); + $this->warning(array( + "Webserver Configuration", + "URL rewriting support", + "I can't tell whether any rewriting module is running. You may need to configure a rewriting rule yourself.")); } - $this->requireServerVariables(array('SCRIPT_NAME','HTTP_HOST','SCRIPT_FILENAME'), array("Webserver Configuration", "Recognised webserver", "You seem to be using an unsupported webserver. The server variables SCRIPT_NAME, HTTP_HOST, SCRIPT_FILENAME need to be set.")); + $this->requireServerVariables(array('SCRIPT_NAME', 'HTTP_HOST', 'SCRIPT_FILENAME'), array( + "Webserver Configuration", + "Recognised webserver", + "You seem to be using an unsupported webserver. " + . "The server variables SCRIPT_NAME, HTTP_HOST, SCRIPT_FILENAME need to be set." + )); - $this->requirePostSupport(array("Webserver Configuration", "POST Support", 'I can\'t find $_POST, make sure POST is enabled.')); + $this->requirePostSupport(array( + "Webserver Configuration", + "POST Support", + 'I can\'t find $_POST, make sure POST is enabled.' + )); // Check for GD support - if(!$this->requireFunction("imagecreatetruecolor", array("PHP Configuration", "GD2 support", "PHP must have GD version 2."))) { - $this->requireFunction("imagecreate", array("PHP Configuration", "GD2 support", "GD support for PHP not included.")); + if(!$this->requireFunction("imagecreatetruecolor", array( + "PHP Configuration", + "GD2 support", + "PHP must have GD version 2." + ))) { + $this->requireFunction("imagecreate", array( + "PHP Configuration", + "GD2 support", + "GD support for PHP not included." + )); } // Check for XML support - $this->requireFunction('xml_set_object', array("PHP Configuration", "XML support", "XML support not included in PHP.")); - $this->requireClass('DOMDocument', array("PHP Configuration", "DOM/XML support", "DOM/XML support not included in PHP.")); - $this->requireFunction('simplexml_load_file', array('PHP Configuration', 'SimpleXML support', 'SimpleXML support not included in PHP.')); + $this->requireFunction('xml_set_object', array( + "PHP Configuration", + "XML support", + "XML support not included in PHP." + )); + $this->requireClass('DOMDocument', array( + "PHP Configuration", + "DOM/XML support", + "DOM/XML support not included in PHP." + )); + $this->requireFunction('simplexml_load_file', array( + 'PHP Configuration', + 'SimpleXML support', + 'SimpleXML support not included in PHP.' + )); // Check for token_get_all - $this->requireFunction('token_get_all', array("PHP Configuration", "Tokenizer support", "Tokenizer support not included in PHP.")); + $this->requireFunction('token_get_all', array( + "PHP Configuration", + "Tokenizer support", + "Tokenizer support not included in PHP." + )); // Check for CType support - $this->requireFunction('ctype_digit', array('PHP Configuration', 'CType support', 'CType support not included in PHP.')); + $this->requireFunction('ctype_digit', array( + 'PHP Configuration', + 'CType support', + 'CType support not included in PHP.' + )); // Check for session support - $this->requireFunction('session_start', array('PHP Configuration', 'Session support', 'Session support not included in PHP.')); + $this->requireFunction('session_start', array( + 'PHP Configuration', + 'Session support', + 'Session support not included in PHP.' + )); // Check for iconv support - $this->requireFunction('iconv', array('PHP Configuration', 'iconv support', 'iconv support not included in PHP.')); + $this->requireFunction('iconv', array( + 'PHP Configuration', + 'iconv support', + 'iconv support not included in PHP.' + )); // Check for hash support $this->requireFunction('hash', array('PHP Configuration', 'hash support', 'hash support not included in PHP.')); // Check for mbstring support - $this->requireFunction('mb_internal_encoding', array('PHP Configuration', 'mbstring support', 'mbstring support not included in PHP.')); + $this->requireFunction('mb_internal_encoding', array( + 'PHP Configuration', + 'mbstring support', + 'mbstring support not included in PHP.' + )); // Check for Reflection support - $this->requireClass('ReflectionClass', array('PHP Configuration', 'Reflection support', 'Reflection support not included in PHP.')); + $this->requireClass('ReflectionClass', array( + 'PHP Configuration', + 'Reflection support', + 'Reflection support not included in PHP.' + )); // Check for Standard PHP Library (SPL) support - $this->requireFunction('spl_classes', array('PHP Configuration', 'SPL support', 'Standard PHP Library (SPL) not included in PHP.')); + $this->requireFunction('spl_classes', array( + 'PHP Configuration', + 'SPL support', + 'Standard PHP Library (SPL) not included in PHP.' + )); - $this->requireDateTimezone(array('PHP Configuration', 'date.timezone setting and validity', 'date.timezone option in php.ini must be set correctly.', ini_get('date.timezone'))); + $this->requireDateTimezone(array( + 'PHP Configuration', + 'date.timezone setting and validity', + 'date.timezone option in php.ini must be set correctly.', + ini_get('date.timezone') + )); - $this->suggestClass('finfo', array('PHP Configuration', 'fileinfo support', 'fileinfo should be enabled in PHP. SilverStripe uses it for MIME type detection of files. SilverStripe will still operate, but email attachments and sending files to browser (e.g. export data to CSV) may not work correctly without finfo.')); + $this->suggestClass('finfo', array( + 'PHP Configuration', + 'fileinfo support', + 'fileinfo should be enabled in PHP. SilverStripe uses it for MIME type detection of files. ' + . 'SilverStripe will still operate, but email attachments and sending files to browser ' + . '(e.g. export data to CSV) may not work correctly without finfo.' + )); - $this->suggestFunction('curl_init', array('PHP Configuration', 'curl support', 'curl should be enabled in PHP. SilverStripe uses it for consuming web services via the RestfulService class and many modules rely on it.')); + $this->suggestFunction('curl_init', array( + 'PHP Configuration', + 'curl support', + 'curl should be enabled in PHP. SilverStripe uses it for consuming web services' + . ' via the RestfulService class and many modules rely on it.' + )); - $this->suggestClass('tidy', array('PHP Configuration', 'tidy support', 'Tidy provides a library of code to clean up your html. SilverStripe will operate fine without tidy but HTMLCleaner will not be effective.')); + $this->suggestClass('tidy', array( + 'PHP Configuration', + 'tidy support', + 'Tidy provides a library of code to clean up your html. ' + . 'SilverStripe will operate fine without tidy but HTMLCleaner will not be effective.' + )); - $this->suggestPHPSetting('asp_tags', array(false), array('PHP Configuration', 'asp_tags option', 'This should be turned off as it can cause issues with SilverStripe')); - $this->requirePHPSetting('magic_quotes_gpc', array(false), array('PHP Configuration', 'magic_quotes_gpc option', 'This should be turned off, as it can cause issues with cookies. More specifically, unserializing data stored in cookies.')); - $this->suggestPHPSetting('display_errors', array(false), array('PHP Configuration', 'display_errors option', 'Unless you\'re in a development environment, this should be turned off, as it can expose sensitive data to website users.')); - // on some weirdly configured webservers arg_separator.output is set to & which will results in links like ?param=value&foo=bar which will not be i - $this->suggestPHPSetting('arg_separator.output', array('&', ''), array('PHP Configuration', 'arg_separator.output option', 'This option defines how URL parameters are concatenated. If not set to \'&\' this may cause issues with URL GET parameters')); + $this->suggestPHPSetting('asp_tags', array(false), array( + 'PHP Configuration', + 'asp_tags option', + 'This should be turned off as it can cause issues with SilverStripe' + )); + $this->requirePHPSetting('magic_quotes_gpc', array(false), array( + 'PHP Configuration', + 'magic_quotes_gpc option', + 'This should be turned off, as it can cause issues with cookies. ' + . 'More specifically, unserializing data stored in cookies.' + )); + $this->suggestPHPSetting('display_errors', array(false), array( + 'PHP Configuration', + 'display_errors option', + 'Unless you\'re in a development environment, this should be turned off, ' + . 'as it can expose sensitive data to website users.' + )); + // on some weirdly configured webservers arg_separator.output is set to & + // which will results in links like ?param=value&foo=bar which will not be i + $this->suggestPHPSetting('arg_separator.output', array('&', ''), array( + 'PHP Configuration', + 'arg_separator.output option', + 'This option defines how URL parameters are concatenated. ' + . 'If not set to \'&\' this may cause issues with URL GET parameters' + )); // Check memory allocation - $this->requireMemory(32*1024*1024, 64*1024*1024, array("PHP Configuration", "Memory allocation (PHP config option 'memory_limit')", "SilverStripe needs a minimum of 32M allocated to PHP, but recommends 64M.", ini_get("memory_limit"))); + $this->requireMemory(32 * 1024 * 1024, 64 * 1024 * 1024, array( + "PHP Configuration", + "Memory allocation (PHP config option 'memory_limit')", + "SilverStripe needs a minimum of 32M allocated to PHP, but recommends 64M.", + ini_get("memory_limit") + )); return $this->errors; } @@ -576,7 +711,8 @@ class InstallRequirements { $testDetails[2] .= " You only have " . ini_get("memory_limit") . " allocated"; $this->warning($testDetails); } elseif($mem == 0) { - $testDetails[2] .= " We can't determine how much memory you have allocated. Install only if you're sure you've allocated at least 20 MB."; + $testDetails[2] .= " We can't determine how much memory you have allocated. " + . "Install only if you're sure you've allocated at least 20 MB."; $this->warning($testDetails); } } @@ -584,15 +720,15 @@ class InstallRequirements { function getPHPMemory() { $memString = ini_get("memory_limit"); - switch(strtolower(substr($memString,-1))) { + switch(strtolower(substr($memString, -1))) { case "k": - return round(substr($memString,0,-1)*1024); + return round(substr($memString, 0, -1) * 1024); case "m": - return round(substr($memString,0,-1)*1024*1024); + return round(substr($memString, 0, -1) * 1024 * 1024); case "g": - return round(substr($memString,0,-1)*1024*1024*1024); + return round(substr($memString, 0, -1) * 1024 * 1024 * 1024); default: return round($memString); @@ -614,7 +750,8 @@ class InstallRequirements { $id = strtolower(str_replace(' ', '_', $section)); echo ""; foreach($tests as $test => $result) { - echo ""; + echo ""; } echo "
$test" . nl2br(htmlentities($result[1], ENT_COMPAT, 'UTF-8')) . "
$test" + . nl2br(htmlentities($result[1], ENT_COMPAT, 'UTF-8')) . "
"; @@ -636,7 +773,8 @@ class InstallRequirements { break; } } - $output .= "$test" . nl2br(htmlentities($result[1], ENT_COMPAT, 'UTF-8')) . ""; + $output .= "$test" + . nl2br(htmlentities($result[1], ENT_COMPAT, 'UTF-8')) . ""; } $className = "good"; $text = "All Requirements Pass"; @@ -646,11 +784,10 @@ class InstallRequirements { $className = "error"; $pluralWarnings = ($warningRequirements == 1) ? 'Warning' : 'Warnings'; - $text = $failedRequirements . ' Failed and '. $warningRequirements . ' '. $pluralWarnings; - } - else if($warningRequirements > 0) { + $text = $failedRequirements . ' Failed and ' . $warningRequirements . ' ' . $pluralWarnings; + } else if($warningRequirements > 0) { $className = "warning"; - $text = "All Requirements Pass but ". $warningRequirements . ' '. $pluralWarnings; + $text = "All Requirements Pass but " . $warningRequirements . ' ' . $pluralWarnings; } echo "
$section Show All Requirements $text
"; @@ -663,17 +800,21 @@ class InstallRequirements { function requireFunction($funcName, $testDetails) { $this->testing($testDetails); - + if(!function_exists($funcName)) { $this->error($testDetails); + } else { + return true; } - else return true; } function requireClass($className, $testDetails) { $this->testing($testDetails); - if(!class_exists($className)) $this->error($testDetails); - else return false; + if(!class_exists($className)) { + $this->error($testDetails); + } else { + return false; + } } /** @@ -688,8 +829,9 @@ class InstallRequirements { if($badClasses) { $testDetails[2] .= ". The following classes are at fault: " . implode(', ', $badClasses); $this->error($testDetails); + } else { + return true; } - else return true; } function checkApacheVersion($testDetails) { @@ -747,7 +889,8 @@ class InstallRequirements { $testDetails[2] .= " Directory '$path' not found. Please make sure you have uploaded the SilverStripe files to your webserver correctly."; $this->error($testDetails); } elseif(!file_exists($path . '/_config.php') && $dirname != 'mysite') { - $testDetails[2] .= " Directory '$path' exists, but is missing files. Please make sure you have uploaded the SilverStripe files to your webserver correctly."; + $testDetails[2] .= " Directory '$path' exists, but is missing files. Please make sure you have uploaded " + . "the SilverStripe files to your webserver correctly."; $this->error($testDetails); } } @@ -778,10 +921,11 @@ class InstallRequirements { $userID = posix_geteuid(); $user = posix_getpwuid($userID); - $currentOwnerID = fileowner(file_exists($filename) ? $filename : dirname($filename) ); + $currentOwnerID = fileowner(file_exists($filename) ? $filename : dirname($filename)); $currentOwner = posix_getpwuid($currentOwnerID); - $testDetails[2] .= "User '$user[name]' needs to be able to write to this file:\n$filename\n\nThe file is currently owned by '$currentOwner[name]'. "; + $testDetails[2] .= "User '$user[name]' needs to be able to write to this file:\n$filename\n\nThe " + . "file is currently owned by '$currentOwner[name]'. "; if($user['name'] == $currentOwner['name']) { $testDetails[2] .= "We recommend that you make the file writeable."; @@ -794,10 +938,13 @@ class InstallRequirements { if(in_array($currentOwner['name'], $groupInfo['members'])) $groupList[] = $groupInfo['name']; } if($groupList) { - $testDetails[2] .= " We recommend that you make the file group-writeable and change the group to one of these groups:\n - ". implode("\n - ", $groupList) + $testDetails[2] .= " We recommend that you make the file group-writeable " + . "and change the group to one of these groups:\n - " . implode("\n - ", $groupList) . "\n\nFor example:\nchmod g+w $filename\nchgrp " . $groupList[0] . " $filename"; } else { - $testDetails[2] .= " There is no user-group that contains both the web-server user and the owner of this file. Change the ownership of the file, create a new group, or temporarily make the file writeable by everyone during the install process."; + $testDetails[2] .= " There is no user-group that contains both the web-server user and the " + . "owner of this file. Change the ownership of the file, create a new group, or " + . "temporarily make the file writeable by everyone during the install process."; } } @@ -995,11 +1142,11 @@ class InstallRequirements { function requireServerVariables($varNames, $testDetails) { $this->testing($testDetails); $missing = array(); - + foreach($varNames as $varName) { - if(!isset($_SERVER[$varName]) || !$_SERVER[$varName]) { + if(!isset($_SERVER[$varName]) || !$_SERVER[$varName]) { $missing[] = '$_SERVER[' . $varName . ']'; - } + } } if(!$missing) { @@ -1035,6 +1182,7 @@ class InstallRequirements { // Must be PHP4 compatible var $baseDir; + function getBaseDir() { // Cache the value so that when the installer mucks with SCRIPT_FILENAME half way through, this method // still returns the correct value. @@ -1087,22 +1235,23 @@ class Installer extends InstallRequirements { } function install($config) { -?> - - - - Installing SilverStripe... - - - - + ?> + + + + Installing SilverStripe... + + + +
+

SilverStripe

-
+
@@ -1111,7 +1260,9 @@ class Installer extends InstallRequirements {

Installing SilverStripe...

+

I am now running through the installation steps (this should take about 30 seconds)

+

If you receive a fatal error, refresh this page to continue the installation