Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertstaddon/b31813daee587abbfef9f9837e96ca44 to your computer and use it in GitHub Desktop.
Save robertstaddon/b31813daee587abbfef9f9837e96ca44 to your computer and use it in GitHub Desktop.
<?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