From 2b398519b32bd014f09b87d12ba5522327501b88 Mon Sep 17 00:00:00 2001 From: Justinas Date: Thu, 11 Jun 2015 14:16:04 +0300 Subject: [PATCH] Changed disk cache default dir to system temp dir Previously if you turned on disk caching and didn't specify a directory current working directory was used "./" (property default value). Which is not really a desired or expected behaviour as this value is optional. If left unset phpexcel tries to write temporary xml files to CWD of your application and fails if it is not writeable, which it should be in normal setup or creates many temporary xml files in your root. --- Classes/PHPExcel/Writer/Abstract.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Classes/PHPExcel/Writer/Abstract.php b/Classes/PHPExcel/Writer/Abstract.php index 2a797a948..0c07fcebb 100644 --- a/Classes/PHPExcel/Writer/Abstract.php +++ b/Classes/PHPExcel/Writer/Abstract.php @@ -27,6 +27,7 @@ */ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter { + /** * Write charts that are defined in the workbook? * Identifies whether the Writer should write definitions for any charts that exist in the PHPExcel object; @@ -56,7 +57,7 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter * * @var string */ - protected $_diskCachingDirectory = './'; + protected $_diskCachingDirectory = './'; /** * Write charts in workbook? @@ -141,6 +142,8 @@ public function setUseDiskCaching($pValue = false, $pDirectory = null) } else { throw new PHPExcel_Writer_Exception("Directory does not exist: $pDirectory"); } + } else { + $this->_diskCachingDirectory = PHPExcel_Shared_File::sys_get_temp_dir(); } return $this; } @@ -154,4 +157,5 @@ public function getDiskCachingDirectory() { return $this->_diskCachingDirectory; } + }