Fixed ManifestBuilder execution in restrictive openbasedir environments

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@49165 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-02-07 02:23:52 +00:00
parent df48020ebe
commit 27f29acdb9

View File

@ -93,6 +93,8 @@ class ManifestBuilder {
// locate and include the exclude files // locate and include the exclude files
$topLevel = scandir($baseDir); $topLevel = scandir($baseDir);
foreach($topLevel as $file) { foreach($topLevel as $file) {
if($file[0] == '.') continue
$fullPath = $baseDir . '/' . $file; $fullPath = $baseDir . '/' . $file;
if(@is_dir($fullPath . '/') && file_exists($fullPath . '/_exclude.php')) if(@is_dir($fullPath . '/') && file_exists($fullPath . '/_exclude.php'))
@ -113,6 +115,7 @@ class ManifestBuilder {
// have an _manifest_exclude file // have an _manifest_exclude file
$topLevel = scandir($baseDir); $topLevel = scandir($baseDir);
foreach($topLevel as $filename) { foreach($topLevel as $filename) {
if($filename[0] == '.') continue;
if(@is_dir("$baseDir/$filename") && if(@is_dir("$baseDir/$filename") &&
file_exists("$baseDir/$filename/_config.php") && file_exists("$baseDir/$filename/_config.php") &&
!file_exists("$baseDir/$filename/_manifest_exclude")) { !file_exists("$baseDir/$filename/_manifest_exclude")) {
@ -135,6 +138,7 @@ class ManifestBuilder {
global $databaseConfig; global $databaseConfig;
$topLevel = scandir($baseDir); $topLevel = scandir($baseDir);
foreach($topLevel as $filename) { foreach($topLevel as $filename) {
if($filename[0] == '.') continue;
if(@is_dir("$baseDir/$filename/") && if(@is_dir("$baseDir/$filename/") &&
file_exists("$baseDir/$filename/_config.php") && file_exists("$baseDir/$filename/_config.php") &&
!file_exists("$baseDir/$filename/_manifest_exclude")) { !file_exists("$baseDir/$filename/_manifest_exclude")) {
@ -155,7 +159,7 @@ class ManifestBuilder {
// Only include directories if they have an _config.php file // Only include directories if they have an _config.php file
$topLevel = scandir($baseDir); $topLevel = scandir($baseDir);
foreach($topLevel as $filename) { foreach($topLevel as $filename) {
if(substr($filename,0,1) == '.') continue; if($filename[0] == '.') continue;
if($filename != 'themes' && @is_dir("$baseDir/$filename") && file_exists("$baseDir/$filename/_config.php")) { if($filename != 'themes' && @is_dir("$baseDir/$filename") && file_exists("$baseDir/$filename/_config.php")) {
ManifestBuilder::getTemplateManifest($baseDir, $filename, $templateManifest, $cssManifest); ManifestBuilder::getTemplateManifest($baseDir, $filename, $templateManifest, $cssManifest);
} }
@ -486,6 +490,7 @@ class ManifestBuilder {
$topLevel = scandir($baseDir); $topLevel = scandir($baseDir);
foreach($topLevel as $filename) { foreach($topLevel as $filename) {
if($filename[0] == '.') continue;
if(@is_dir("$baseDir/$filename/") && file_exists("$baseDir/$filename/_config.php")) { if(@is_dir("$baseDir/$filename/") && file_exists("$baseDir/$filename/_config.php")) {
$manifest .= "require_once(\"$baseDir/$filename/_config.php\");\n"; $manifest .= "require_once(\"$baseDir/$filename/_config.php\");\n";
} }