1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-22 06:13:57 +02:00

Update for additional suggestions in processwire/processwire-issues#518

This commit is contained in:
Ryan Cramer
2018-03-14 10:37:24 -04:00
parent 27b6141a1b
commit bbfb4d78d2

View File

@@ -743,16 +743,20 @@ class ProcessWire extends Wire {
* @param array $options Options to modify default behaviors (experimental): * @param array $options Options to modify default behaviors (experimental):
* - `siteDir` (string): Name of "site" directory in $rootPath that contains site's config.php, no slashes (default="site"). * - `siteDir` (string): Name of "site" directory in $rootPath that contains site's config.php, no slashes (default="site").
* @return Config * @return Config
* @throws WireException
* *
*/ */
public static function buildConfig($rootPath, $rootURL = null, array $options = array()) { public static function buildConfig($rootPath, $rootURL = null, array $options = array()) {
if(strpos($rootPath, '..') !== false) {
$rootPath = realpath($rootPath);
if($rootPath === false) throw new WireException("Path not found");
}
if(DIRECTORY_SEPARATOR != '/') { if(DIRECTORY_SEPARATOR != '/') {
$rootPath = str_replace(DIRECTORY_SEPARATOR, '/', $rootPath); $rootPath = str_replace(DIRECTORY_SEPARATOR, '/', $rootPath);
} }
if(strpos($rootPath, '..') !== false) $rootPath = realpath($rootPath);
$httpHost = ''; $httpHost = '';
$scheme = ''; $scheme = '';
$siteDir = isset($options['siteDir']) ? $options['siteDir'] : 'site'; $siteDir = isset($options['siteDir']) ? $options['siteDir'] : 'site';