get rid of www/ in phar

This commit is contained in:
Christian Weiske 2011-08-18 16:04:39 +02:00
parent 3070f234b6
commit e991f209bc
3 changed files with 6 additions and 8 deletions

View File

@ -9,17 +9,14 @@ if (!in_array('phar', stream_get_wrappers())
function mapUrls($path)
{
if (substr($path, 0, 5) !== '/www/') {
return false;
}
$arMap = array(
'/www/' => '/www/index.php',
'/www/gsearch/' => '/www/gsearch/index.php',
'/' => '/www/index.php',
'/gsearch/' => '/www/gsearch/index.php',
);
if (isset($arMap[$path])) {
return $arMap[$path];
}
return $path;
return '/www' . $path;
}
Phar::interceptFileFuncs();

View File

@ -74,6 +74,7 @@ class SemanticScuttle_Environment
$_SERVER['PATH_TRANSLATED'],
strpos($_SERVER['PATH_TRANSLATED'], $rootTmp)
+ strlen($rootTmp)
+ 4 /* strip "www/" */
);
}

View File

@ -330,7 +330,7 @@ class SemanticScuttle_EnvironmentTest extends PHPUnit_Framework_TestCase
'PHAR_PATH_TRANSLATED' => '/home/cweiske/Dev/html/hosts/dist.bm.bogo/www/index.php',
);
$this->assertEquals(
'//dist.bm.bogo/SemanticScuttle-0.98.X.phar/www/',
'//dist.bm.bogo/SemanticScuttle-0.98.X.phar/',
SemanticScuttle_Environment::getRoot()
);
}
@ -352,7 +352,7 @@ class SemanticScuttle_EnvironmentTest extends PHPUnit_Framework_TestCase
'PHAR_PATH_TRANSLATED' => '/home/cweiske/Dev/html/hosts/dist.bm.bogo/www/index.php/foo/bar/',
);
$this->assertEquals(
'//dist.bm.bogo/SemanticScuttle-0.98.X.phar/www/',
'//dist.bm.bogo/SemanticScuttle-0.98.X.phar/',
SemanticScuttle_Environment::getRoot()
);
}