If default path is not writable, fallback to tmp dir.

This commit is contained in:
Will Rossiter 2014-03-16 17:14:43 +13:00
parent 8aaaacc23c
commit ccc8dd061c

View File

@ -67,10 +67,16 @@ class TestSessionEnvironment extends Object {
*/ */
public function getFilePath() { public function getFilePath() {
if($this->id) { if($this->id) {
return Director::getAbsFile(sprintf($this->config()->test_state_id_file, $this->id)); $path = Director::getAbsFile(sprintf($this->config()->test_state_id_file, $this->id));
} else { } else {
return Director::getAbsFile($this->config()->test_state_file); $path = Director::getAbsFile($this->config()->test_state_file);
} }
if(!is_writable(dirname($path))) {
$path = str_replace(Director::baseFolder(), TEMP_FOLDER, $path);
}
return $path;
} }
/** /**