mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Don't rely on the current working directory for any file access; use BASE_PATH. (from r97728)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102527 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
efa09e60a5
commit
40899c3bfb
@ -98,5 +98,5 @@ if(defined('SS_USE_BASIC_AUTH') && SS_USE_BASIC_AUTH) {
|
||||
}
|
||||
|
||||
if(defined('SS_ERROR_LOG')) {
|
||||
SS_Log::add_writer(new SS_LogFileWriter('../' . SS_ERROR_LOG), SS_Log::WARN, '<=');
|
||||
SS_Log::add_writer(new SS_LogFileWriter(BASE_PATH . '/' . SS_ERROR_LOG), SS_Log::WARN, '<=');
|
||||
}
|
||||
|
@ -155,6 +155,19 @@ increase_memory_limit_to('64M');
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
|
||||
/**
|
||||
* Add sapphire/parsers and sapphire/thirdparty include paths, as well as adding a fixed reference
|
||||
* to BASEPATH/sapphrie in case we chdir()
|
||||
*/
|
||||
|
||||
// Add after the "." path but before other paths (so that they take precedence over the PEAR
|
||||
// include paths)
|
||||
set_include_path(str_replace('.' . PATH_SEPARATOR, '.' . PATH_SEPARATOR
|
||||
. BASE_PATH . '/sapphire' . PATH_SEPARATOR
|
||||
. BASE_PATH . '/sapphire/parsers' . PATH_SEPARATOR
|
||||
. BASE_PATH . '/sapphire/thirdparty' . PATH_SEPARATOR
|
||||
, get_include_path()));
|
||||
|
||||
require_once("core/ManifestBuilder.php");
|
||||
require_once("core/ClassInfo.php");
|
||||
require_once('core/Object.php');
|
||||
@ -162,17 +175,6 @@ require_once('core/control/Director.php');
|
||||
require_once('filesystem/Filesystem.php');
|
||||
require_once("core/Session.php");
|
||||
|
||||
/**
|
||||
* Add sapphire/parsers and sapphire/thirdparty include paths
|
||||
*/
|
||||
|
||||
// Add after the "." path but before other paths (so that they take precedence over the PEAR
|
||||
// include paths)
|
||||
set_include_path(str_replace('.' . PATH_SEPARATOR, '.' . PATH_SEPARATOR
|
||||
. BASE_PATH . '/sapphire/parsers' . PATH_SEPARATOR
|
||||
. BASE_PATH . '/sapphire/thirdparty' . PATH_SEPARATOR
|
||||
, get_include_path()));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MANIFEST
|
||||
|
||||
|
@ -498,11 +498,11 @@ HTML
|
||||
);
|
||||
|
||||
foreach($installfiles as $installfile) {
|
||||
if(file_exists('../' . $installfile)) {
|
||||
@unlink('../' . $installfile);
|
||||
if(file_exists(BASE_PATH . '/' . $installfile)) {
|
||||
@unlink(BASE_PATH . '/' . $installfile);
|
||||
}
|
||||
|
||||
if(file_exists('../' . $installfile)) {
|
||||
if(file_exists(BASE_PATH . '/' . $installfile)) {
|
||||
$unsuccessful[] = $installfile;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ class SapphireInfo extends Controller {
|
||||
}
|
||||
|
||||
function Version() {
|
||||
$sapphireVersionFile = file_get_contents('../sapphire/silverstripe_version');
|
||||
$sapphireVersionFile = file_get_contents(BASE_PATH . '/sapphire/silverstripe_version');
|
||||
|
||||
if(strstr($sapphireVersionFile, "/sapphire/trunk")) {
|
||||
$sapphireVersion = "trunk";
|
||||
|
@ -309,7 +309,7 @@ HTML;
|
||||
$fixtureFile = $_GET['fixture'];
|
||||
|
||||
// Validate fixture file
|
||||
$realFile = realpath('../' . $fixtureFile);
|
||||
$realFile = realpath(BASE_PATH.'/'.$fixtureFile);
|
||||
$baseDir = realpath(Director::baseFolder());
|
||||
if(!$realFile || !file_exists($realFile)) {
|
||||
return "<p>Fixture file doesn't exist</p>";
|
||||
|
@ -22,7 +22,8 @@ class TarballArchive extends Archive {
|
||||
|
||||
function listing() {
|
||||
// Call tar on the command line to get the info we need
|
||||
$command = "tar -tv{$this->compressionModifiers}f ../$this->filename";
|
||||
$base = BASE_PATH;
|
||||
$command = "tar -tv{$this->compressionModifiers}f $base/$this->filename";
|
||||
$consoleList = `$command`;
|
||||
|
||||
$listing = array();
|
||||
|
@ -17,7 +17,7 @@ class PhpSyntaxTest extends SapphireTest {
|
||||
$settingTests = array('short_open_tag=Off','short_open_tag=On -d asp_tags=On');
|
||||
|
||||
$files = $this->getAllFiles('php');
|
||||
$files[] = '../sapphire/dev/install/config-form.html';
|
||||
$files[] = BASE_PATH.'/sapphire/dev/install/config-form.html';
|
||||
|
||||
foreach($files as $i => $file) {
|
||||
$CLI_file = escapeshellarg($file);
|
||||
|
@ -103,14 +103,14 @@ class FileTest extends SapphireTest {
|
||||
$fileIDs = $this->allFixtureIDs('Folder');
|
||||
foreach($fileIDs as $fileID) {
|
||||
$file = DataObject::get_by_id('Folder', $fileID);
|
||||
if(!file_exists("../$file->Filename")) mkdir("../$file->Filename");
|
||||
if(!file_exists(BASE_PATH."/$file->Filename")) mkdir(BASE_PATH."/$file->Filename");
|
||||
}
|
||||
|
||||
/* Create a test files for each of the fixture references */
|
||||
$fileIDs = $this->allFixtureIDs('File');
|
||||
foreach($fileIDs as $fileID) {
|
||||
$file = DataObject::get_by_id('File', $fileID);
|
||||
$fh = fopen("../$file->Filename", "w");
|
||||
$fh = fopen(BASE_PATH."/$file->Filename", "w");
|
||||
fwrite($fh, str_repeat('x',1000000));
|
||||
fclose($fh);
|
||||
}
|
||||
@ -121,14 +121,14 @@ class FileTest extends SapphireTest {
|
||||
$fileIDs = $this->allFixtureIDs('File');
|
||||
foreach($fileIDs as $fileID) {
|
||||
$file = DataObject::get_by_id('File', $fileID);
|
||||
if(file_exists("../$file->Filename")) unlink("../$file->Filename");
|
||||
if(file_exists(BASE_PATH."/$file->Filename")) unlink(BASE_PATH."/$file->Filename");
|
||||
}
|
||||
|
||||
/* Remove the test folders that we've crated */
|
||||
$fileIDs = $this->allFixtureIDs('Folder');
|
||||
foreach($fileIDs as $fileID) {
|
||||
$file = DataObject::get_by_id('Folder', $fileID);
|
||||
if(file_exists("../$file->Filename")) rmdir("../$file->Filename");
|
||||
if(file_exists(BASE_PATH."/$file->Filename")) rmdir(BASE_PATH."/$file->Filename");
|
||||
}
|
||||
|
||||
parent::tearDown();
|
||||
|
Loading…
Reference in New Issue
Block a user