Bugfix: Work item 16643 - Bug In Cache System (cell reference when throwing caching errors)

General: Work item 16643 - Add file directory as a cache option for cache_to_discISAM

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@82024 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker
2011-10-26 16:16:43 +00:00
parent efc066c233
commit 77cd4ac9aa
7 changed files with 24 additions and 16 deletions
@@ -38,6 +38,8 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
private $_fileName = null;
private $_fileHandle = null;
private $_cacheDirectory = NULL;
private function _storeData() {
if ($this->_currentCellIsDirty) {
@@ -116,7 +118,7 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
parent::copyCellCollection($parent);
// Get a new id for the new file name
$baseUnique = $this->_getUniqueID();
$newFileName = PHPExcel_Shared_File::sys_get_temp_dir().'/PHPExcel.'.$baseUnique.'.cache';
$newFileName = $this->_cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
// Copy the existing cell cache file
copy ($this->_fileName,$newFileName);
$this->_fileName = $newFileName;
@@ -140,11 +142,15 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
} // function unsetWorksheetCells()
public function __construct(PHPExcel_Worksheet $parent) {
public function __construct(PHPExcel_Worksheet $parent, $arguments) {
$this->_cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== NULL))
? $arguments['dir']
: PHPExcel_Shared_File::sys_get_temp_dir();
parent::__construct($parent);
if (is_null($this->_fileHandle)) {
$baseUnique = $this->_getUniqueID();
$this->_fileName = PHPExcel_Shared_File::sys_get_temp_dir().'/PHPExcel.'.$baseUnique.'.cache';
$this->_fileName = $this->_cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
$this->_fileHandle = fopen($this->_fileName,'a+');
}
} // function __construct()