Skip to content
Snippets Groups Projects
Commit fbf3fac0 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #705 from greezybacon/issue/root-path-cli


Provide a fallback ROOT_PATH

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 4f8888d2 8d044a30
No related branches found
No related tags found
No related merge requests found
......@@ -141,11 +141,18 @@ class Misc {
/* static */
function siteRootPath($main_inc_path) {
if (!$_SERVER['DOCUMENT_ROOT'])
// Probably run from the command-line
return './';
$root = str_replace('\\', '/', $main_inc_path);
$root2 = str_replace('\\','/', $_SERVER['DOCUMENT_ROOT']);
$path = '';
while (strpos($_SERVER['DOCUMENT_ROOT'], $root) === false) {
$lastslash = strrpos($root, '/');
if ($lastslash === false)
// Unable to find any commonality between $root and
// DOCUMENT_ROOT
return './';
$path = substr($root, $lastslash) . $path;
$root = substr($root, 0, $lastslash);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment