Created
February 20, 2017 13:29
-
-
Save robertstaddon/b31813daee587abbfef9f9837e96ca44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$confs = array( | |
$VAR->domain->physicalHosting->customConfigFile, | |
$VAR->domain->physicalHosting->customSslConfigFile | |
); | |
$documentRoot = ''; | |
foreach ($confs as $conf) { | |
if (file_exists($conf)) { | |
$lines = file($conf); | |
foreach ($lines as $line) { | |
preg_match("/^(?P<key>\w+)\s+(?P<value>.*)/", $line, $matches); | |
if ($matches['key']=='DocumentRoot') { | |
$documentRoot = rtrim($matches['value']); | |
break 2; | |
} | |
} | |
} | |
} | |
?> | |
<?php if(!empty($documentRoot)): ?> | |
root "<?php echo $documentRoot ?>"; | |
<?php else: ?> | |
root "<?php echo $OPT['ssl'] ? $VAR->domain->physicalHosting->httpsDir : $VAR->domain->physicalHosting->httpDir ?>"; | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment