Move toward PSR-2 coding standards
This commit is contained in:
		
							parent
							
								
									fca778225c
								
							
						
					
					
						commit
						e83c359c7c
					
				
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,4 +1,15 @@ | |||||||
| <?php | <?php | ||||||
|  | 
 | ||||||
|  | PHPExcel_Autoloader::Register(); | ||||||
|  | //    As we always try to run the autoloader before anything else, we can use it to do a few
 | ||||||
|  | //        simple checks and initialisations
 | ||||||
|  | //PHPExcel_Shared_ZipStreamWrapper::register();
 | ||||||
|  | // check mbstring.func_overload
 | ||||||
|  | if (ini_get('mbstring.func_overload') & 2) { | ||||||
|  |     throw new PHPExcel_Exception('Multibyte function overloading in PHP must be disabled for string functions (2).'); | ||||||
|  | } | ||||||
|  | PHPExcel_Shared_String::buildCharacterSets(); | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * PHPExcel |  * PHPExcel | ||||||
|  * |  * | ||||||
| @ -24,66 +35,47 @@ | |||||||
|  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  * @version    ##VERSION##, ##DATE##
 |  * @version    ##VERSION##, ##DATE##
 | ||||||
|  */ |  */ | ||||||
| 
 |  | ||||||
| PHPExcel_Autoloader::Register(); |  | ||||||
| //    As we always try to run the autoloader before anything else, we can use it to do a few
 |  | ||||||
| //        simple checks and initialisations
 |  | ||||||
| //PHPExcel_Shared_ZipStreamWrapper::register();
 |  | ||||||
| // check mbstring.func_overload
 |  | ||||||
| if (ini_get('mbstring.func_overload') & 2) { |  | ||||||
|     throw new PHPExcel_Exception('Multibyte function overloading in PHP must be disabled for string functions (2).'); |  | ||||||
| } |  | ||||||
| PHPExcel_Shared_String::buildCharacterSets(); |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| /** |  | ||||||
|  * PHPExcel_Autoloader |  | ||||||
|  * |  | ||||||
|  * @category    PHPExcel |  | ||||||
|  * @package     PHPExcel |  | ||||||
|  * @copyright   Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  | ||||||
|  */ |  | ||||||
| class PHPExcel_Autoloader | class PHPExcel_Autoloader | ||||||
| { | { | ||||||
|     /** |     /** | ||||||
|      * Register the Autoloader with SPL |      * Register the Autoloader with SPL | ||||||
|      * |      * | ||||||
|      */ |      */ | ||||||
|     public static function Register() { |     public static function Register() | ||||||
|  |     { | ||||||
|         if (function_exists('__autoload')) { |         if (function_exists('__autoload')) { | ||||||
|             //    Register any existing autoloader function with SPL, so we don't get any clashes
 |             // Register any existing autoloader function with SPL, so we don't get any clashes
 | ||||||
|             spl_autoload_register('__autoload'); |             spl_autoload_register('__autoload'); | ||||||
|         } |         } | ||||||
|         //    Register ourselves with SPL
 |         // Register ourselves with SPL
 | ||||||
|         if (version_compare(PHP_VERSION, '5.3.0') >= 0) { |         if (version_compare(PHP_VERSION, '5.3.0') >= 0) { | ||||||
|             return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'), true, true); |             return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'), true, true); | ||||||
|         } else { |         } else { | ||||||
|             return spl_autoload_register(array('PHPExcel_Autoloader', 'Load')); |             return spl_autoload_register(array('PHPExcel_Autoloader', 'Load')); | ||||||
|         } |         } | ||||||
|     }   //    function Register()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Autoload a class identified by name |      * Autoload a class identified by name | ||||||
|      * |      * | ||||||
|      * @param    string    $pClassName        Name of the object to load |      * @param    string    $pClassName        Name of the object to load | ||||||
|      */ |      */ | ||||||
|     public static function Load($pClassName){ |     public static function Load($pClassName) | ||||||
|         if ((class_exists($pClassName,FALSE)) || (strpos($pClassName, 'PHPExcel') !== 0)) { |     { | ||||||
|             //    Either already loaded, or not a PHPExcel class request
 |         if ((class_exists($pClassName, false)) || (strpos($pClassName, 'PHPExcel') !== 0)) { | ||||||
|             return FALSE; |             // Either already loaded, or not a PHPExcel class request
 | ||||||
|  |             return false; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         $pClassFilePath = PHPEXCEL_ROOT . |         $pClassFilePath = PHPEXCEL_ROOT . | ||||||
|                           str_replace('_',DIRECTORY_SEPARATOR,$pClassName) . |             str_replace('_', DIRECTORY_SEPARATOR, $pClassName) . | ||||||
|                           '.php'; |             '.php'; | ||||||
| 
 | 
 | ||||||
|         if ((file_exists($pClassFilePath) === FALSE) || (is_readable($pClassFilePath) === FALSE)) { |         if ((file_exists($pClassFilePath) === false) || (is_readable($pClassFilePath) === false)) { | ||||||
|             //    Can't load
 |             // Can't load
 | ||||||
|             return FALSE; |             return false; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         require($pClassFilePath); |         require($pClassFilePath); | ||||||
|     }   //    function Load()
 |     } | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| <?php | <?php | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * PHPExcel |  * PHPExcel_CachedObjectStorage_APC | ||||||
|  * |  * | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * |  * | ||||||
| @ -24,17 +25,8 @@ | |||||||
|  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  * @version    ##VERSION##, ##DATE##
 |  * @version    ##VERSION##, ##DATE##
 | ||||||
|  */ |  */ | ||||||
| 
 | class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||||||
| 
 | { | ||||||
| /** |  | ||||||
|  * PHPExcel_CachedObjectStorage_APC |  | ||||||
|  * |  | ||||||
|  * @category   PHPExcel |  | ||||||
|  * @package    PHPExcel_CachedObjectStorage |  | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  | ||||||
|  */ |  | ||||||
| class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { |  | ||||||
| 
 |  | ||||||
|     /** |     /** | ||||||
|      * Prefix used to uniquely identify cache data for this worksheet |      * Prefix used to uniquely identify cache data for this worksheet | ||||||
|      * |      * | ||||||
| @ -51,7 +43,6 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
|      */ |      */ | ||||||
|     private $_cacheTime = 600; |     private $_cacheTime = 600; | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     /** |     /** | ||||||
|      * Store cell data in cache for the current cell object if it's "dirty", |      * Store cell data in cache for the current cell object if it's "dirty", | ||||||
|      *     and the 'nullify' the current cell object |      *     and the 'nullify' the current cell object | ||||||
| @ -60,19 +51,23 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
|      * @return  void |      * @return  void | ||||||
|      * @throws  PHPExcel_Exception |      * @throws  PHPExcel_Exception | ||||||
|      */ |      */ | ||||||
|     protected function _storeData() { |     protected function _storeData() | ||||||
|  |     { | ||||||
|         if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { |         if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { | ||||||
|             $this->_currentObject->detach(); |             $this->_currentObject->detach(); | ||||||
| 
 | 
 | ||||||
|             if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) { |             if (!apc_store( | ||||||
|  |                 $this->_cachePrefix . $this->_currentObjectID . '.cache', | ||||||
|  |                 serialize($this->_currentObject), | ||||||
|  |                 $this->_cacheTime | ||||||
|  |             )) { | ||||||
|                 $this->__destruct(); |                 $this->__destruct(); | ||||||
|                 throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in APC'); |                 throw new PHPExcel_Exception('Failed to store cell ' . $this->_currentObjectID . ' in APC'); | ||||||
|             } |             } | ||||||
|             $this->_currentCellIsDirty = false; |             $this->_currentCellIsDirty = false; | ||||||
|         } |         } | ||||||
|         $this->_currentObjectID = $this->_currentObject = null; |         $this->_currentObjectID = $this->_currentObject = null; | ||||||
|     }    //    function _storeData()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Add or Update a cell in cache identified by coordinate address |      * Add or Update a cell in cache identified by coordinate address | ||||||
| @ -83,7 +78,8 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
|      * @return  PHPExcel_Cell |      * @return  PHPExcel_Cell | ||||||
|      * @throws  PHPExcel_Exception |      * @throws  PHPExcel_Exception | ||||||
|      */ |      */ | ||||||
|     public function addCacheData($pCoord, PHPExcel_Cell $cell) { |     public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||||||
|  |     { | ||||||
|         if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { |         if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { | ||||||
|             $this->_storeData(); |             $this->_storeData(); | ||||||
|         } |         } | ||||||
| @ -94,8 +90,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
|         $this->_currentCellIsDirty = true; |         $this->_currentCellIsDirty = true; | ||||||
| 
 | 
 | ||||||
|         return $cell; |         return $cell; | ||||||
|     }    //    function addCacheData()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? |      * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? | ||||||
| @ -105,7 +100,8 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
|      * @throws  PHPExcel_Exception |      * @throws  PHPExcel_Exception | ||||||
|      * @return  boolean |      * @return  boolean | ||||||
|      */ |      */ | ||||||
|     public function isDataSet($pCoord) { |     public function isDataSet($pCoord) | ||||||
|  |     { | ||||||
|         //    Check if the requested entry is the current object, or exists in the cache
 |         //    Check if the requested entry is the current object, or exists in the cache
 | ||||||
|         if (parent::isDataSet($pCoord)) { |         if (parent::isDataSet($pCoord)) { | ||||||
|             if ($this->_currentObjectID == $pCoord) { |             if ($this->_currentObjectID == $pCoord) { | ||||||
| @ -113,7 +109,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
|             } |             } | ||||||
|             //    Check if the requested entry still exists in apc
 |             //    Check if the requested entry still exists in apc
 | ||||||
|             $success = apc_fetch($this->_cachePrefix.$pCoord.'.cache'); |             $success = apc_fetch($this->_cachePrefix.$pCoord.'.cache'); | ||||||
|             if ($success === FALSE) { |             if ($success === false) { | ||||||
|                 //    Entry no longer exists in APC, so clear it from the cache array
 |                 //    Entry no longer exists in APC, so clear it from the cache array
 | ||||||
|                 parent::deleteCacheData($pCoord); |                 parent::deleteCacheData($pCoord); | ||||||
|                 throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); |                 throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); | ||||||
| @ -121,8 +117,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|         return false; |         return false; | ||||||
|     }    //    function isDataSet()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get cell at a specific coordinate |      * Get cell at a specific coordinate | ||||||
| @ -132,7 +127,8 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
|      * @throws  PHPExcel_Exception |      * @throws  PHPExcel_Exception | ||||||
|      * @return  PHPExcel_Cell  Cell that was found, or null if not found |      * @return  PHPExcel_Cell  Cell that was found, or null if not found | ||||||
|      */ |      */ | ||||||
|     public function getCacheData($pCoord) { |     public function getCacheData($pCoord) | ||||||
|  |     { | ||||||
|         if ($pCoord === $this->_currentObjectID) { |         if ($pCoord === $this->_currentObjectID) { | ||||||
|             return $this->_currentObject; |             return $this->_currentObject; | ||||||
|         } |         } | ||||||
| @ -140,8 +136,8 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
| 
 | 
 | ||||||
|         //    Check if the entry that has been requested actually exists
 |         //    Check if the entry that has been requested actually exists
 | ||||||
|         if (parent::isDataSet($pCoord)) { |         if (parent::isDataSet($pCoord)) { | ||||||
|             $obj = apc_fetch($this->_cachePrefix.$pCoord.'.cache'); |             $obj = apc_fetch($this->_cachePrefix . $pCoord . '.cache'); | ||||||
|             if ($obj === FALSE) { |             if ($obj === false) { | ||||||
|                 //    Entry no longer exists in APC, so clear it from the cache array
 |                 //    Entry no longer exists in APC, so clear it from the cache array
 | ||||||
|                 parent::deleteCacheData($pCoord); |                 parent::deleteCacheData($pCoord); | ||||||
|                 throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); |                 throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); | ||||||
| @ -159,22 +155,21 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
| 
 | 
 | ||||||
|         //    Return requested entry
 |         //    Return requested entry
 | ||||||
|         return $this->_currentObject; |         return $this->_currentObject; | ||||||
|     }    //    function getCacheData()
 |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Get a list of all cell addresses currently held in cache | ||||||
|  |      * | ||||||
|  |      * @return  string[] | ||||||
|  |      */ | ||||||
|  |     public function getCellList() | ||||||
|  |     { | ||||||
|  |         if ($this->_currentObjectID !== null) { | ||||||
|  |             $this->_storeData(); | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
| 	/** |         return parent::getCellList(); | ||||||
| 	 * Get a list of all cell addresses currently held in cache |     } | ||||||
| 	 * |  | ||||||
| 	 * @return  string[] |  | ||||||
| 	 */ |  | ||||||
| 	public function getCellList() { |  | ||||||
| 		if ($this->_currentObjectID !== null) { |  | ||||||
| 			$this->_storeData(); |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		return parent::getCellList(); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Delete a cell in cache identified by coordinate address |      * Delete a cell in cache identified by coordinate address | ||||||
| @ -183,14 +178,14 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
|      * @param   string  $pCoord  Coordinate address of the cell to delete |      * @param   string  $pCoord  Coordinate address of the cell to delete | ||||||
|      * @throws  PHPExcel_Exception |      * @throws  PHPExcel_Exception | ||||||
|      */ |      */ | ||||||
|     public function deleteCacheData($pCoord) { |     public function deleteCacheData($pCoord) | ||||||
|  |     { | ||||||
|         //    Delete the entry from APC
 |         //    Delete the entry from APC
 | ||||||
|         apc_delete($this->_cachePrefix.$pCoord.'.cache'); |         apc_delete($this->_cachePrefix.$pCoord.'.cache'); | ||||||
| 
 | 
 | ||||||
|         //    Delete the entry from our cell address array
 |         //    Delete the entry from our cell address array
 | ||||||
|         parent::deleteCacheData($pCoord); |         parent::deleteCacheData($pCoord); | ||||||
|     }    //    function deleteCacheData()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Clone the cell collection |      * Clone the cell collection | ||||||
| @ -200,37 +195,38 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
|      * @throws  PHPExcel_Exception |      * @throws  PHPExcel_Exception | ||||||
|      * @return  void |      * @return  void | ||||||
|      */ |      */ | ||||||
|     public function copyCellCollection(PHPExcel_Worksheet $parent) { |     public function copyCellCollection(PHPExcel_Worksheet $parent) | ||||||
|  |     { | ||||||
|         parent::copyCellCollection($parent); |         parent::copyCellCollection($parent); | ||||||
|         //    Get a new id for the new file name
 |         //    Get a new id for the new file name
 | ||||||
|         $baseUnique = $this->_getUniqueID(); |         $baseUnique = $this->_getUniqueID(); | ||||||
|         $newCachePrefix = substr(md5($baseUnique),0,8).'.'; |         $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.'; | ||||||
|         $cacheList = $this->getCellList(); |         $cacheList = $this->getCellList(); | ||||||
|         foreach($cacheList as $cellID) { |         foreach ($cacheList as $cellID) { | ||||||
|             if ($cellID != $this->_currentObjectID) { |             if ($cellID != $this->_currentObjectID) { | ||||||
|                 $obj = apc_fetch($this->_cachePrefix.$cellID.'.cache'); |                 $obj = apc_fetch($this->_cachePrefix . $cellID . '.cache'); | ||||||
|                 if ($obj === FALSE) { |                 if ($obj === false) { | ||||||
|                     //    Entry no longer exists in APC, so clear it from the cache array
 |                     //    Entry no longer exists in APC, so clear it from the cache array
 | ||||||
|                     parent::deleteCacheData($cellID); |                     parent::deleteCacheData($cellID); | ||||||
|                     throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in APC'); |                     throw new PHPExcel_Exception('Cell entry ' . $cellID . ' no longer exists in APC'); | ||||||
|                 } |                 } | ||||||
|                 if (!apc_store($newCachePrefix.$cellID.'.cache',$obj,$this->_cacheTime)) { |                 if (!apc_store($newCachePrefix . $cellID . '.cache', $obj, $this->_cacheTime)) { | ||||||
|                     $this->__destruct(); |                     $this->__destruct(); | ||||||
|                     throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in APC'); |                     throw new PHPExcel_Exception('Failed to store cell ' . $cellID . ' in APC'); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         $this->_cachePrefix = $newCachePrefix; |         $this->_cachePrefix = $newCachePrefix; | ||||||
|     }    //    function copyCellCollection()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Clear the cell collection and disconnect from our parent |      * Clear the cell collection and disconnect from our parent | ||||||
|      * |      * | ||||||
|      * @return  void |      * @return  void | ||||||
|      */ |      */ | ||||||
|     public function unsetWorksheetCells() { |     public function unsetWorksheetCells() | ||||||
|         if ($this->_currentObject !== NULL) { |     { | ||||||
|  |         if ($this->_currentObject !== null) { | ||||||
|             $this->_currentObject->detach(); |             $this->_currentObject->detach(); | ||||||
|             $this->_currentObject = $this->_currentObjectID = null; |             $this->_currentObject = $this->_currentObjectID = null; | ||||||
|         } |         } | ||||||
| @ -242,8 +238,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
| 
 | 
 | ||||||
|         //    detach ourself from the worksheet, so that it can then delete this object successfully
 |         //    detach ourself from the worksheet, so that it can then delete this object successfully
 | ||||||
|         $this->_parent = null; |         $this->_parent = null; | ||||||
|     }    //    function unsetWorksheetCells()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Initialise this new cell collection |      * Initialise this new cell collection | ||||||
| @ -251,29 +246,29 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
|      * @param  PHPExcel_Worksheet  $parent     The worksheet for this cell collection |      * @param  PHPExcel_Worksheet  $parent     The worksheet for this cell collection | ||||||
|      * @param  array of mixed      $arguments  Additional initialisation arguments |      * @param  array of mixed      $arguments  Additional initialisation arguments | ||||||
|      */ |      */ | ||||||
|     public function __construct(PHPExcel_Worksheet $parent, $arguments) { |     public function __construct(PHPExcel_Worksheet $parent, $arguments) | ||||||
|  |     { | ||||||
|         $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; |         $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; | ||||||
| 
 | 
 | ||||||
|         if ($this->_cachePrefix === NULL) { |         if ($this->_cachePrefix === null) { | ||||||
|             $baseUnique = $this->_getUniqueID(); |             $baseUnique = $this->_getUniqueID(); | ||||||
|             $this->_cachePrefix = substr(md5($baseUnique),0,8).'.'; |             $this->_cachePrefix = substr(md5($baseUnique), 0, 8) . '.'; | ||||||
|             $this->_cacheTime = $cacheTime; |             $this->_cacheTime = $cacheTime; | ||||||
| 
 | 
 | ||||||
|             parent::__construct($parent); |             parent::__construct($parent); | ||||||
|         } |         } | ||||||
|     }    //    function __construct()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Destroy this cell collection |      * Destroy this cell collection | ||||||
|      */ |      */ | ||||||
|     public function __destruct() { |     public function __destruct() | ||||||
|  |     { | ||||||
|         $cacheList = $this->getCellList(); |         $cacheList = $this->getCellList(); | ||||||
|         foreach($cacheList as $cellID) { |         foreach ($cacheList as $cellID) { | ||||||
|             apc_delete($this->_cachePrefix.$cellID.'.cache'); |             apc_delete($this->_cachePrefix . $cellID . '.cache'); | ||||||
|         } |         } | ||||||
|     }    //    function __destruct()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Identify whether the caching method is currently available |      * Identify whether the caching method is currently available | ||||||
| @ -281,15 +276,15 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach | |||||||
|      * |      * | ||||||
|      * @return  boolean |      * @return  boolean | ||||||
|      */ |      */ | ||||||
|     public static function cacheMethodIsAvailable() { |     public static function cacheMethodIsAvailable() | ||||||
|  |     { | ||||||
|         if (!function_exists('apc_store')) { |         if (!function_exists('apc_store')) { | ||||||
|             return FALSE; |             return false; | ||||||
|         } |         } | ||||||
|         if (apc_sma_info() === FALSE) { |         if (apc_sma_info() === false) { | ||||||
|             return FALSE; |             return false; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         return TRUE; |         return true; | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,376 +1,368 @@ | |||||||
| <?php | <?php | ||||||
| /** | 
 | ||||||
|  * PHPExcel | /** | ||||||
|  * |  * PHPExcel_CachedObjectStorage_CacheBase | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * | ||||||
|  * |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * This library is free software; you can redistribute it and/or |  * | ||||||
|  * modify it under the terms of the GNU Lesser General Public |  * This library is free software; you can redistribute it and/or | ||||||
|  * License as published by the Free Software Foundation; either |  * modify it under the terms of the GNU Lesser General Public | ||||||
|  * version 2.1 of the License, or (at your option) any later version. |  * License as published by the Free Software Foundation; either | ||||||
|  * |  * version 2.1 of the License, or (at your option) any later version. | ||||||
|  * This library is distributed in the hope that it will be useful, |  * | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  * This library is distributed in the hope that it will be useful, | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  * Lesser General Public License for more details. |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||||
|  * |  * Lesser General Public License for more details. | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * | ||||||
|  * License along with this library; if not, write to the Free Software |  * You should have received a copy of the GNU Lesser General Public | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA |  * License along with this library; if not, write to the Free Software | ||||||
|  * |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | ||||||
|  * @category   PHPExcel |  * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |  * @category   PHPExcel | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @package    PHPExcel_CachedObjectStorage | ||||||
|  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @version    ##VERSION##, ##DATE##
 |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  */ |  * @version    ##VERSION##, ##DATE##
 | ||||||
| 
 |  */ | ||||||
| 
 | abstract class PHPExcel_CachedObjectStorage_CacheBase | ||||||
| /** | { | ||||||
|  * PHPExcel_CachedObjectStorage_CacheBase |     /** | ||||||
|  * |      * Parent worksheet | ||||||
|  * @category   PHPExcel |      * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |      * @var PHPExcel_Worksheet | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |      */ | ||||||
|  */ |     protected $_parent; | ||||||
| abstract class PHPExcel_CachedObjectStorage_CacheBase { | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * The currently active Cell | ||||||
| 	 * Parent worksheet |      * | ||||||
| 	 * |      * @var PHPExcel_Cell | ||||||
| 	 * @var PHPExcel_Worksheet |      */ | ||||||
| 	 */ |     protected $_currentObject = null; | ||||||
| 	protected $_parent; | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Coordinate address of the currently active Cell | ||||||
| 	 * The currently active Cell |      * | ||||||
| 	 * |      * @var string | ||||||
| 	 * @var PHPExcel_Cell |      */ | ||||||
| 	 */ |     protected $_currentObjectID = null; | ||||||
| 	protected $_currentObject = null; | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Flag indicating whether the currently active Cell requires saving | ||||||
| 	 * Coordinate address of the currently active Cell |      * | ||||||
| 	 * |      * @var boolean | ||||||
| 	 * @var string |      */ | ||||||
| 	 */ |     protected $_currentCellIsDirty = true; | ||||||
| 	protected $_currentObjectID = null; | 
 | ||||||
| 
 |     /** | ||||||
| 
 |      * An array of cells or cell pointers for the worksheet cells held in this cache, | ||||||
| 	/** |      *        and indexed by their coordinate address within the worksheet | ||||||
| 	 * Flag indicating whether the currently active Cell requires saving |      * | ||||||
| 	 * |      * @var array of mixed | ||||||
| 	 * @var boolean |      */ | ||||||
| 	 */ |     protected $_cellCache = array(); | ||||||
| 	protected $_currentCellIsDirty = true; | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Initialise this new cell collection | ||||||
| 	 * An array of cells or cell pointers for the worksheet cells held in this cache, |      * | ||||||
| 	 *		and indexed by their coordinate address within the worksheet |      * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection | ||||||
| 	 * |      */ | ||||||
| 	 * @var array of mixed |     public function __construct(PHPExcel_Worksheet $parent) | ||||||
| 	 */ |     { | ||||||
| 	protected $_cellCache = array(); |         //    Set our parent worksheet.
 | ||||||
| 
 |         //    This is maintained within the cache controller to facilitate re-attaching it to PHPExcel_Cell objects when
 | ||||||
| 
 |         //        they are woken from a serialized state
 | ||||||
| 	/** |         $this->_parent = $parent; | ||||||
| 	 * Initialise this new cell collection |     } | ||||||
| 	 * | 
 | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The worksheet for this cell collection |     /** | ||||||
| 	 */ |      * Return the parent worksheet for this cell collection | ||||||
| 	public function __construct(PHPExcel_Worksheet $parent) { |      * | ||||||
| 		//	Set our parent worksheet.
 |      * @return    PHPExcel_Worksheet | ||||||
| 		//	This is maintained within the cache controller to facilitate re-attaching it to PHPExcel_Cell objects when
 |      */ | ||||||
| 		//		they are woken from a serialized state
 |     public function getParent() | ||||||
| 		$this->_parent = $parent; |     { | ||||||
| 	}	//	function __construct()
 |         return $this->_parent; | ||||||
| 
 |     } | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Return the parent worksheet for this cell collection |      * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? | ||||||
| 	 * |      * | ||||||
| 	 * @return	PHPExcel_Worksheet |      * @param    string        $pCoord        Coordinate address of the cell to check | ||||||
| 	 */ |      * @return    boolean | ||||||
| 	public function getParent() |      */ | ||||||
| 	{ |     public function isDataSet($pCoord) | ||||||
| 		return $this->_parent; |     { | ||||||
| 	} |         if ($pCoord === $this->_currentObjectID) { | ||||||
| 
 |             return true; | ||||||
| 	/** |         } | ||||||
| 	 * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? |         //    Check if the requested entry exists in the cache
 | ||||||
| 	 * |         return isset($this->_cellCache[$pCoord]); | ||||||
| 	 * @param	string		$pCoord		Coordinate address of the cell to check |     } | ||||||
| 	 * @return	boolean | 
 | ||||||
| 	 */ |     /** | ||||||
| 	public function isDataSet($pCoord) { |      * Move a cell object from one address to another | ||||||
| 		if ($pCoord === $this->_currentObjectID) { |      * | ||||||
| 			return true; |      * @param    string        $fromAddress    Current address of the cell to move | ||||||
| 		} |      * @param    string        $toAddress        Destination address of the cell to move | ||||||
| 		//	Check if the requested entry exists in the cache
 |      * @return    boolean | ||||||
| 		return isset($this->_cellCache[$pCoord]); |      */ | ||||||
| 	}	//	function isDataSet()
 |     public function moveCell($fromAddress, $toAddress) | ||||||
| 
 |     { | ||||||
| 
 |         if ($fromAddress === $this->_currentObjectID) { | ||||||
| 	/** |             $this->_currentObjectID = $toAddress; | ||||||
| 	 * Move a cell object from one address to another |         } | ||||||
| 	 * |         $this->_currentCellIsDirty = true; | ||||||
| 	 * @param	string		$fromAddress	Current address of the cell to move |         if (isset($this->_cellCache[$fromAddress])) { | ||||||
| 	 * @param	string		$toAddress		Destination address of the cell to move |             $this->_cellCache[$toAddress] = &$this->_cellCache[$fromAddress]; | ||||||
| 	 * @return	boolean |             unset($this->_cellCache[$fromAddress]); | ||||||
| 	 */ |         } | ||||||
| 	public function moveCell($fromAddress, $toAddress) { | 
 | ||||||
| 		if ($fromAddress === $this->_currentObjectID) { |         return true; | ||||||
| 			$this->_currentObjectID = $toAddress; |     } | ||||||
| 		} | 
 | ||||||
| 		$this->_currentCellIsDirty = true; |     /** | ||||||
| 		if (isset($this->_cellCache[$fromAddress])) { |      * Add or Update a cell in cache | ||||||
| 			$this->_cellCache[$toAddress] = &$this->_cellCache[$fromAddress]; |      * | ||||||
| 			unset($this->_cellCache[$fromAddress]); |      * @param    PHPExcel_Cell    $cell        Cell to update | ||||||
| 		} |      * @return    PHPExcel_Cell | ||||||
| 
 |      * @throws    PHPExcel_Exception | ||||||
| 		return TRUE; |      */ | ||||||
| 	}	//	function moveCell()
 |     public function updateCacheData(PHPExcel_Cell $cell) | ||||||
| 
 |     { | ||||||
| 
 |         return $this->addCacheData($cell->getCoordinate(), $cell); | ||||||
|     /** |     } | ||||||
|      * Add or Update a cell in cache | 
 | ||||||
|      * |     /** | ||||||
|      * @param	PHPExcel_Cell	$cell		Cell to update |      * Delete a cell in cache identified by coordinate address | ||||||
| 	 * @return	PHPExcel_Cell |      * | ||||||
|      * @throws	PHPExcel_Exception |      * @param    string            $pCoord        Coordinate address of the cell to delete | ||||||
|      */ |      * @throws    PHPExcel_Exception | ||||||
| 	public function updateCacheData(PHPExcel_Cell $cell) { |      */ | ||||||
| 		return $this->addCacheData($cell->getCoordinate(),$cell); |     public function deleteCacheData($pCoord) | ||||||
| 	}	//	function updateCacheData()
 |     { | ||||||
| 
 |         if ($pCoord === $this->_currentObjectID && !is_null($this->_currentObject)) { | ||||||
| 
 |             $this->_currentObject->detach(); | ||||||
|     /** |             $this->_currentObjectID = $this->_currentObject = null; | ||||||
|      * Delete a cell in cache identified by coordinate address |         } | ||||||
|      * | 
 | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to delete |         if (is_object($this->_cellCache[$pCoord])) { | ||||||
|      * @throws	PHPExcel_Exception |             $this->_cellCache[$pCoord]->detach(); | ||||||
|      */ |             unset($this->_cellCache[$pCoord]); | ||||||
| 	public function deleteCacheData($pCoord) { |         } | ||||||
| 		if ($pCoord === $this->_currentObjectID && !is_null($this->_currentObject)) { |         $this->_currentCellIsDirty = false; | ||||||
| 			$this->_currentObject->detach(); |     } | ||||||
| 			$this->_currentObjectID = $this->_currentObject = null; | 
 | ||||||
| 		} |     /** | ||||||
| 
 |      * Get a list of all cell addresses currently held in cache | ||||||
| 		if (is_object($this->_cellCache[$pCoord])) { |      * | ||||||
| 			$this->_cellCache[$pCoord]->detach(); |      * @return    string[] | ||||||
| 			unset($this->_cellCache[$pCoord]); |      */ | ||||||
| 		} |     public function getCellList() | ||||||
| 		$this->_currentCellIsDirty = false; |     { | ||||||
| 	}	//	function deleteCacheData()
 |         return array_keys($this->_cellCache); | ||||||
| 
 |     } | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Get a list of all cell addresses currently held in cache |      * Sort the list of all cell addresses currently held in cache by row and column | ||||||
| 	 * |      * | ||||||
| 	 * @return	string[] |      * @return    string[] | ||||||
| 	 */ |      */ | ||||||
| 	public function getCellList() { |     public function getSortedCellList() | ||||||
| 		return array_keys($this->_cellCache); |     { | ||||||
| 	}	//	function getCellList()
 |         $sortKeys = array(); | ||||||
| 
 |         foreach ($this->getCellList() as $coord) { | ||||||
| 
 |             sscanf($coord, '%[A-Z]%d', $column, $row); | ||||||
| 	/** |             $sortKeys[sprintf('%09d%3s', $row, $column)] = $coord; | ||||||
| 	 * Sort the list of all cell addresses currently held in cache by row and column |         } | ||||||
| 	 * |         ksort($sortKeys); | ||||||
| 	 * @return	string[] | 
 | ||||||
| 	 */ |         return array_values($sortKeys); | ||||||
| 	public function getSortedCellList() { |     } | ||||||
| 		$sortKeys = array(); | 
 | ||||||
| 		foreach ($this->getCellList() as $coord) { |     /** | ||||||
| 			sscanf($coord,'%[A-Z]%d', $column, $row); |      * Get highest worksheet column and highest row that have cell records | ||||||
| 			$sortKeys[sprintf('%09d%3s',$row,$column)] = $coord; |      * | ||||||
| 		} |      * @return array Highest column name and highest row number | ||||||
| 		ksort($sortKeys); |      */ | ||||||
| 
 |     public function getHighestRowAndColumn() | ||||||
| 		return array_values($sortKeys); |     { | ||||||
| 	}	//	function sortCellList()
 |         // Lookup highest column and highest row
 | ||||||
| 
 |         $col = array('A' => '1A'); | ||||||
| 
 |         $row = array(1); | ||||||
| 
 |         foreach ($this->getCellList() as $coord) { | ||||||
| 	/** |             sscanf($coord, '%[A-Z]%d', $c, $r); | ||||||
| 	 * Get highest worksheet column and highest row that have cell records |             $row[$r] = $r; | ||||||
| 	 * |             $col[$c] = strlen($c).$c; | ||||||
| 	 * @return array Highest column name and highest row number |         } | ||||||
| 	 */ |         if (!empty($row)) { | ||||||
| 	public function getHighestRowAndColumn() |             // Determine highest column and row
 | ||||||
| 	{ |             $highestRow = max($row); | ||||||
| 		// Lookup highest column and highest row
 |             $highestColumn = substr(max($col), 1); | ||||||
| 		$col = array('A' => '1A'); |         } | ||||||
| 		$row = array(1); | 
 | ||||||
| 		foreach ($this->getCellList() as $coord) { |         return array( | ||||||
| 			sscanf($coord,'%[A-Z]%d', $c, $r); |             'row'    => $highestRow, | ||||||
| 			$row[$r] = $r; |             'column' => $highestColumn | ||||||
| 			$col[$c] = strlen($c).$c; |         ); | ||||||
|  		} |     } | ||||||
| 		if (!empty($row)) { | 
 | ||||||
| 			// Determine highest column and row
 |     /** | ||||||
| 			$highestRow = max($row); |      * Return the cell address of the currently active cell object | ||||||
| 			$highestColumn = substr(max($col),1); |      * | ||||||
| 		} |      * @return    string | ||||||
| 
 |      */ | ||||||
| 		return array( 'row'	   => $highestRow, |     public function getCurrentAddress() | ||||||
| 					  'column' => $highestColumn |     { | ||||||
| 					); |         return $this->_currentObjectID; | ||||||
| 	} |     } | ||||||
| 
 | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Return the column address of the currently active cell object | ||||||
| 	 * Return the cell address of the currently active cell object |      * | ||||||
| 	 * |      * @return    string | ||||||
| 	 * @return	string |      */ | ||||||
| 	 */ |     public function getCurrentColumn() | ||||||
| 	public function getCurrentAddress() |     { | ||||||
| 	{ |         sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row); | ||||||
| 		return $this->_currentObjectID; |         return $column; | ||||||
| 	} |     } | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Return the column address of the currently active cell object |      * Return the row address of the currently active cell object | ||||||
| 	 * |      * | ||||||
| 	 * @return	string |      * @return    integer | ||||||
| 	 */ |      */ | ||||||
| 	public function getCurrentColumn() |     public function getCurrentRow() | ||||||
| 	{ |     { | ||||||
| 		sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row); |         sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row); | ||||||
| 		return $column; |         return (integer) $row; | ||||||
| 	} |     } | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Return the row address of the currently active cell object |      * Get highest worksheet column | ||||||
| 	 * |      * | ||||||
| 	 * @return	integer |      * @param   string     $row        Return the highest column for the specified row, | ||||||
| 	 */ |      *                                     or the highest column of any row if no row number is passed | ||||||
| 	public function getCurrentRow() |      * @return  string     Highest column name | ||||||
| 	{ |      */ | ||||||
| 		sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row); |     public function getHighestColumn($row = null) | ||||||
| 		return (integer) $row; |     { | ||||||
| 	} |         if ($row == null) { | ||||||
| 
 |             $colRow = $this->getHighestRowAndColumn(); | ||||||
| 	/** |             return $colRow['column']; | ||||||
| 	 * Get highest worksheet column |         } | ||||||
| 	 * | 
 | ||||||
|      * @param   string     $row        Return the highest column for the specified row, |         $columnList = array(1); | ||||||
|      *                                     or the highest column of any row if no row number is passed |         foreach ($this->getCellList() as $coord) { | ||||||
| 	 * @return  string     Highest column name |             sscanf($coord, '%[A-Z]%d', $c, $r); | ||||||
| 	 */ |             if ($r != $row) { | ||||||
| 	public function getHighestColumn($row = null) |                 continue; | ||||||
| 	{ |             } | ||||||
|         if ($row == null) { |             $columnList[] = PHPExcel_Cell::columnIndexFromString($c); | ||||||
|     		$colRow = $this->getHighestRowAndColumn(); |         } | ||||||
| 	    	return $colRow['column']; |         return PHPExcel_Cell::stringFromColumnIndex(max($columnList) - 1); | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         $columnList = array(1); |     /** | ||||||
|         foreach ($this->getCellList() as $coord) { |      * Get highest worksheet row | ||||||
|             sscanf($coord,'%[A-Z]%d', $c, $r); |      * | ||||||
|             if ($r != $row) { |      * @param   string     $column     Return the highest row for the specified column, | ||||||
|                 continue; |      *                                     or the highest row of any column if no column letter is passed | ||||||
|             } |      * @return  int        Highest row number | ||||||
|             $columnList[] = PHPExcel_Cell::columnIndexFromString($c); |      */ | ||||||
|         } |     public function getHighestRow($column = null) | ||||||
|         return PHPExcel_Cell::stringFromColumnIndex(max($columnList) - 1); |     { | ||||||
|     } |         if ($column == null) { | ||||||
| 
 |             $colRow = $this->getHighestRowAndColumn(); | ||||||
| 	/** |             return $colRow['row']; | ||||||
| 	 * Get highest worksheet row |         } | ||||||
| 	 * | 
 | ||||||
|      * @param   string     $column     Return the highest row for the specified column, |         $rowList = array(0); | ||||||
|      *                                     or the highest row of any column if no column letter is passed |         foreach ($this->getCellList() as $coord) { | ||||||
| 	 * @return  int        Highest row number |             sscanf($coord, '%[A-Z]%d', $c, $r); | ||||||
| 	 */ |             if ($c != $column) { | ||||||
| 	public function getHighestRow($column = null) |                 continue; | ||||||
| 	{ |             } | ||||||
|         if ($column == null) { |             $rowList[] = $r; | ||||||
| 	    	$colRow = $this->getHighestRowAndColumn(); |         } | ||||||
|     		return $colRow['row']; | 
 | ||||||
|         } |         return max($rowList); | ||||||
| 
 |     } | ||||||
|         $rowList = array(0); | 
 | ||||||
|         foreach ($this->getCellList() as $coord) { |     /** | ||||||
|             sscanf($coord,'%[A-Z]%d', $c, $r); |      * Generate a unique ID for cache referencing | ||||||
|             if ($c != $column) { |      * | ||||||
|                 continue; |      * @return string Unique Reference | ||||||
|             } |      */ | ||||||
|             $rowList[] = $r; |     protected function _getUniqueID() | ||||||
|         } |     { | ||||||
| 
 |         if (function_exists('posix_getpid')) { | ||||||
|         return max($rowList); |             $baseUnique = posix_getpid(); | ||||||
| 	} |         } else { | ||||||
| 
 |             $baseUnique = mt_rand(); | ||||||
| 
 |         } | ||||||
| 	/** |         return uniqid($baseUnique, true); | ||||||
| 	 * Generate a unique ID for cache referencing |     } | ||||||
| 	 * | 
 | ||||||
| 	 * @return string Unique Reference |     /** | ||||||
| 	 */ |      * Clone the cell collection | ||||||
| 	protected function _getUniqueID() { |      * | ||||||
| 		if (function_exists('posix_getpid')) { |      * @param    PHPExcel_Worksheet    $parent        The new worksheet | ||||||
| 			$baseUnique = posix_getpid(); |      * @return    void | ||||||
| 		} else { |      */ | ||||||
| 			$baseUnique = mt_rand(); |     public function copyCellCollection(PHPExcel_Worksheet $parent) | ||||||
| 		} |     { | ||||||
| 		return uniqid($baseUnique,true); |         $this->_currentCellIsDirty; | ||||||
| 	} |         $this->_storeData(); | ||||||
| 
 | 
 | ||||||
| 	/** |         $this->_parent = $parent; | ||||||
| 	 * Clone the cell collection |         if (($this->_currentObject !== null) && (is_object($this->_currentObject))) { | ||||||
| 	 * |             $this->_currentObject->attach($this); | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The new worksheet |         } | ||||||
| 	 * @return	void |     }    //    function copyCellCollection()
 | ||||||
| 	 */ | 
 | ||||||
| 	public function copyCellCollection(PHPExcel_Worksheet $parent) { |     /** | ||||||
| 		$this->_currentCellIsDirty; |      * Remove a row, deleting all cells in that row | ||||||
|         $this->_storeData(); |      * | ||||||
| 
 |      * @param string    $row    Row number to remove | ||||||
| 		$this->_parent = $parent; |      * @return void | ||||||
| 		if (($this->_currentObject !== NULL) && (is_object($this->_currentObject))) { |      */ | ||||||
| 			$this->_currentObject->attach($this); |     public function removeRow($row) | ||||||
| 		} |     { | ||||||
| 	}	//	function copyCellCollection()
 |         foreach ($this->getCellList() as $coord) { | ||||||
| 
 |             sscanf($coord, '%[A-Z]%d', $c, $r); | ||||||
|     /** |             if ($r == $row) { | ||||||
|      * Remove a row, deleting all cells in that row |                 $this->deleteCacheData($coord); | ||||||
|      * |             } | ||||||
|      * @param string    $row    Row number to remove |         } | ||||||
|      * @return void |     } | ||||||
|      */ | 
 | ||||||
|     public function removeRow($row) { |     /** | ||||||
|         foreach ($this->getCellList() as $coord) { |      * Remove a column, deleting all cells in that column | ||||||
|             sscanf($coord,'%[A-Z]%d', $c, $r); |      * | ||||||
|             if ($r == $row) { |      * @param string    $column    Column ID to remove | ||||||
|                 $this->deleteCacheData($coord); |      * @return void | ||||||
|             } |      */ | ||||||
|         } |     public function removeColumn($column) | ||||||
|     } |     { | ||||||
| 
 |         foreach ($this->getCellList() as $coord) { | ||||||
|     /** |             sscanf($coord, '%[A-Z]%d', $c, $r); | ||||||
|      * Remove a column, deleting all cells in that column |             if ($c == $column) { | ||||||
|      * |                 $this->deleteCacheData($coord); | ||||||
|      * @param string    $column    Column ID to remove |             } | ||||||
|      * @return void |         } | ||||||
|      */ |     } | ||||||
|     public function removeColumn($column) { | 
 | ||||||
|         foreach ($this->getCellList() as $coord) { |     /** | ||||||
|             sscanf($coord,'%[A-Z]%d', $c, $r); |      * Identify whether the caching method is currently available | ||||||
|             if ($c == $column) { |      * Some methods are dependent on the availability of certain extensions being enabled in the PHP build | ||||||
|                 $this->deleteCacheData($coord); |      * | ||||||
|             } |      * @return    boolean | ||||||
|         } |      */ | ||||||
|     } |     public static function cacheMethodIsAvailable() | ||||||
| 
 |     { | ||||||
| 	/** |         return true; | ||||||
| 	 * Identify whether the caching method is currently available |     } | ||||||
| 	 * Some methods are dependent on the availability of certain extensions being enabled in the PHP build | } | ||||||
| 	 * |  | ||||||
| 	 * @return	boolean |  | ||||||
| 	 */ |  | ||||||
| 	public static function cacheMethodIsAvailable() { |  | ||||||
| 		return true; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -1,219 +1,208 @@ | |||||||
| <?php | <?php | ||||||
| /** | 
 | ||||||
|  * PHPExcel | /** | ||||||
|  * |  * PHPExcel_CachedObjectStorage_DiscISAM | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * | ||||||
|  * |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * This library is free software; you can redistribute it and/or |  * | ||||||
|  * modify it under the terms of the GNU Lesser General Public |  * This library is free software; you can redistribute it and/or | ||||||
|  * License as published by the Free Software Foundation; either |  * modify it under the terms of the GNU Lesser General Public | ||||||
|  * version 2.1 of the License, or (at your option) any later version. |  * License as published by the Free Software Foundation; either | ||||||
|  * |  * version 2.1 of the License, or (at your option) any later version. | ||||||
|  * This library is distributed in the hope that it will be useful, |  * | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  * This library is distributed in the hope that it will be useful, | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  * Lesser General Public License for more details. |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||||
|  * |  * Lesser General Public License for more details. | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * | ||||||
|  * License along with this library; if not, write to the Free Software |  * You should have received a copy of the GNU Lesser General Public | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA |  * License along with this library; if not, write to the Free Software | ||||||
|  * |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | ||||||
|  * @category   PHPExcel |  * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |  * @category   PHPExcel | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @package    PHPExcel_CachedObjectStorage | ||||||
|  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @version    ##VERSION##, ##DATE##
 |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  */ |  * @version    ##VERSION##, ##DATE##
 | ||||||
| 
 |  */ | ||||||
| 
 | class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||||||
| /** | { | ||||||
|  * PHPExcel_CachedObjectStorage_DiscISAM |     /** | ||||||
|  * |      * Name of the file for this cache | ||||||
|  * @category   PHPExcel |      * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |      * @var string | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |      */ | ||||||
|  */ |     private $_fileName = null; | ||||||
| class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * File handle for this cache file | ||||||
| 	 * Name of the file for this cache |      * | ||||||
| 	 * |      * @var resource | ||||||
| 	 * @var string |      */ | ||||||
| 	 */ |     private $_fileHandle = null; | ||||||
| 	private $_fileName = NULL; | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Directory/Folder where the cache file is located | ||||||
| 	 * File handle for this cache file |      * | ||||||
| 	 * |      * @var string | ||||||
| 	 * @var resource |      */ | ||||||
| 	 */ |     private $_cacheDirectory = null; | ||||||
| 	private $_fileHandle = NULL; | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Store cell data in cache for the current cell object if it's "dirty", | ||||||
| 	 * Directory/Folder where the cache file is located |      *     and the 'nullify' the current cell object | ||||||
| 	 * |      * | ||||||
| 	 * @var string |      * @return    void | ||||||
| 	 */ |      * @throws    PHPExcel_Exception | ||||||
| 	private $_cacheDirectory = NULL; |      */ | ||||||
| 
 |     protected function _storeData() | ||||||
| 
 |     { | ||||||
|     /** |         if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { | ||||||
|      * Store cell data in cache for the current cell object if it's "dirty", |             $this->_currentObject->detach(); | ||||||
|      *     and the 'nullify' the current cell object | 
 | ||||||
|      * |             fseek($this->_fileHandle, 0, SEEK_END); | ||||||
| 	 * @return	void | 
 | ||||||
|      * @throws	PHPExcel_Exception |             $this->_cellCache[$this->_currentObjectID] = array( | ||||||
|      */ |                 'ptr' => ftell($this->_fileHandle), | ||||||
| 	protected function _storeData() { |                 'sz'  => fwrite($this->_fileHandle, serialize($this->_currentObject)) | ||||||
| 		if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { |             ); | ||||||
| 			$this->_currentObject->detach(); |             $this->_currentCellIsDirty = false; | ||||||
| 
 |         } | ||||||
| 			fseek($this->_fileHandle,0,SEEK_END); |         $this->_currentObjectID = $this->_currentObject = null; | ||||||
| 
 |     } | ||||||
| 			$this->_cellCache[$this->_currentObjectID] = array( | 
 | ||||||
|                 'ptr' => ftell($this->_fileHandle), |     /** | ||||||
| 				'sz'  => fwrite($this->_fileHandle, serialize($this->_currentObject)) |      * Add or Update a cell in cache identified by coordinate address | ||||||
| 			); |      * | ||||||
| 			$this->_currentCellIsDirty = false; |      * @param    string            $pCoord        Coordinate address of the cell to update | ||||||
| 		} |      * @param    PHPExcel_Cell    $cell        Cell to update | ||||||
| 		$this->_currentObjectID = $this->_currentObject = null; |      * @return    PHPExcel_Cell | ||||||
| 	}	//	function _storeData()
 |      * @throws    PHPExcel_Exception | ||||||
| 
 |      */ | ||||||
| 
 |     public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||||||
|     /** |     { | ||||||
|      * Add or Update a cell in cache identified by coordinate address |         if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { | ||||||
|      * |             $this->_storeData(); | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to update |         } | ||||||
|      * @param	PHPExcel_Cell	$cell		Cell to update | 
 | ||||||
| 	 * @return	PHPExcel_Cell |         $this->_currentObjectID = $pCoord; | ||||||
|      * @throws	PHPExcel_Exception |         $this->_currentObject = $cell; | ||||||
|      */ |         $this->_currentCellIsDirty = true; | ||||||
| 	public function addCacheData($pCoord, PHPExcel_Cell $cell) { | 
 | ||||||
| 		if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { |         return $cell; | ||||||
| 			$this->_storeData(); |     } | ||||||
| 		} | 
 | ||||||
| 
 |     /** | ||||||
| 		$this->_currentObjectID = $pCoord; |      * Get cell at a specific coordinate | ||||||
| 		$this->_currentObject = $cell; |      * | ||||||
| 		$this->_currentCellIsDirty = true; |      * @param     string             $pCoord        Coordinate of the cell | ||||||
| 
 |      * @throws     PHPExcel_Exception | ||||||
| 		return $cell; |      * @return     PHPExcel_Cell     Cell that was found, or null if not found | ||||||
| 	}	//	function addCacheData()
 |      */ | ||||||
| 
 |     public function getCacheData($pCoord) | ||||||
| 
 |     { | ||||||
|     /** |         if ($pCoord === $this->_currentObjectID) { | ||||||
|      * Get cell at a specific coordinate |             return $this->_currentObject; | ||||||
|      * |         } | ||||||
|      * @param 	string 			$pCoord		Coordinate of the cell |         $this->_storeData(); | ||||||
|      * @throws 	PHPExcel_Exception | 
 | ||||||
|      * @return 	PHPExcel_Cell 	Cell that was found, or null if not found |         //    Check if the entry that has been requested actually exists
 | ||||||
|      */ |         if (!isset($this->_cellCache[$pCoord])) { | ||||||
| 	public function getCacheData($pCoord) { |             //    Return null if requested entry doesn't exist in cache
 | ||||||
| 		if ($pCoord === $this->_currentObjectID) { |             return null; | ||||||
| 			return $this->_currentObject; |         } | ||||||
| 		} | 
 | ||||||
| 		$this->_storeData(); |         //    Set current entry to the requested entry
 | ||||||
| 
 |         $this->_currentObjectID = $pCoord; | ||||||
| 		//	Check if the entry that has been requested actually exists
 |         fseek($this->_fileHandle, $this->_cellCache[$pCoord]['ptr']); | ||||||
| 		if (!isset($this->_cellCache[$pCoord])) { |         $this->_currentObject = unserialize(fread($this->_fileHandle, $this->_cellCache[$pCoord]['sz'])); | ||||||
| 			//	Return null if requested entry doesn't exist in cache
 |         //    Re-attach this as the cell's parent
 | ||||||
| 			return null; |         $this->_currentObject->attach($this); | ||||||
| 		} | 
 | ||||||
| 
 |         //    Return requested entry
 | ||||||
| 		//	Set current entry to the requested entry
 |         return $this->_currentObject; | ||||||
| 		$this->_currentObjectID = $pCoord; |     } | ||||||
| 		fseek($this->_fileHandle, $this->_cellCache[$pCoord]['ptr']); | 
 | ||||||
| 		$this->_currentObject = unserialize(fread($this->_fileHandle, $this->_cellCache[$pCoord]['sz'])); |     /** | ||||||
|         //    Re-attach this as the cell's parent
 |      * Get a list of all cell addresses currently held in cache | ||||||
|         $this->_currentObject->attach($this); |      * | ||||||
| 
 |      * @return  string[] | ||||||
| 		//	Return requested entry
 |      */ | ||||||
| 		return $this->_currentObject; |     public function getCellList() | ||||||
| 	}	//	function getCacheData()
 |     { | ||||||
| 
 |         if ($this->_currentObjectID !== null) { | ||||||
| 
 |             $this->_storeData(); | ||||||
| 	/** |         } | ||||||
| 	 * Get a list of all cell addresses currently held in cache | 
 | ||||||
| 	 * |         return parent::getCellList(); | ||||||
| 	 * @return  string[] |     } | ||||||
| 	 */ | 
 | ||||||
| 	public function getCellList() { |     /** | ||||||
| 		if ($this->_currentObjectID !== null) { |      * Clone the cell collection | ||||||
| 			$this->_storeData(); |      * | ||||||
| 		} |      * @param    PHPExcel_Worksheet    $parent        The new worksheet | ||||||
| 
 |      */ | ||||||
| 		return parent::getCellList(); |     public function copyCellCollection(PHPExcel_Worksheet $parent) | ||||||
| 	} |     { | ||||||
| 
 |         parent::copyCellCollection($parent); | ||||||
| 
 |         //    Get a new id for the new file name
 | ||||||
| 	/** |         $baseUnique = $this->_getUniqueID(); | ||||||
| 	 * Clone the cell collection |         $newFileName = $this->_cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache'; | ||||||
| 	 * |         //    Copy the existing cell cache file
 | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The new worksheet |         copy($this->_fileName, $newFileName); | ||||||
| 	 * @return	void |         $this->_fileName = $newFileName; | ||||||
| 	 */ |         //    Open the copied cell cache file
 | ||||||
| 	public function copyCellCollection(PHPExcel_Worksheet $parent) { |         $this->_fileHandle = fopen($this->_fileName, 'a+'); | ||||||
| 		parent::copyCellCollection($parent); |     } | ||||||
| 		//	Get a new id for the new file name
 | 
 | ||||||
| 		$baseUnique = $this->_getUniqueID(); |     /** | ||||||
| 		$newFileName = $this->_cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache'; |      * Clear the cell collection and disconnect from our parent | ||||||
| 		//	Copy the existing cell cache file
 |      * | ||||||
| 		copy ($this->_fileName,$newFileName); |      */ | ||||||
| 		$this->_fileName = $newFileName; |     public function unsetWorksheetCells() | ||||||
| 		//	Open the copied cell cache file
 |     { | ||||||
| 		$this->_fileHandle = fopen($this->_fileName,'a+'); |         if (!is_null($this->_currentObject)) { | ||||||
| 	}	//	function copyCellCollection()
 |             $this->_currentObject->detach(); | ||||||
| 
 |             $this->_currentObject = $this->_currentObjectID = null; | ||||||
| 
 |         } | ||||||
| 	/** |         $this->_cellCache = array(); | ||||||
| 	 * Clear the cell collection and disconnect from our parent | 
 | ||||||
| 	 * |         //    detach ourself from the worksheet, so that it can then delete this object successfully
 | ||||||
| 	 * @return	void |         $this->_parent = null; | ||||||
| 	 */ | 
 | ||||||
| 	public function unsetWorksheetCells() { |         //    Close down the temporary cache file
 | ||||||
| 		if(!is_null($this->_currentObject)) { |         $this->__destruct(); | ||||||
| 			$this->_currentObject->detach(); |     } | ||||||
| 			$this->_currentObject = $this->_currentObjectID = null; | 
 | ||||||
| 		} |     /** | ||||||
| 		$this->_cellCache = array(); |      * Initialise this new cell collection | ||||||
| 
 |      * | ||||||
| 		//	detach ourself from the worksheet, so that it can then delete this object successfully
 |      * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection | ||||||
| 		$this->_parent = null; |      * @param    array of mixed        $arguments    Additional initialisation arguments | ||||||
| 
 |      */ | ||||||
| 		//	Close down the temporary cache file
 |     public function __construct(PHPExcel_Worksheet $parent, $arguments) | ||||||
| 		$this->__destruct(); |     { | ||||||
| 	}	//	function unsetWorksheetCells()
 |         $this->_cacheDirectory    = ((isset($arguments['dir'])) && ($arguments['dir'] !== null)) | ||||||
| 
 |                                     ? $arguments['dir'] | ||||||
| 
 |                                     : PHPExcel_Shared_File::sys_get_temp_dir(); | ||||||
| 	/** | 
 | ||||||
| 	 * Initialise this new cell collection |         parent::__construct($parent); | ||||||
| 	 * |         if (is_null($this->_fileHandle)) { | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The worksheet for this cell collection |             $baseUnique = $this->_getUniqueID(); | ||||||
| 	 * @param	array of mixed		$arguments	Additional initialisation arguments |             $this->_fileName = $this->_cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache'; | ||||||
| 	 */ |             $this->_fileHandle = fopen($this->_fileName, 'a+'); | ||||||
| 	public function __construct(PHPExcel_Worksheet $parent, $arguments) { |         } | ||||||
| 		$this->_cacheDirectory	= ((isset($arguments['dir'])) && ($arguments['dir'] !== NULL)) |     } | ||||||
| 									? $arguments['dir'] | 
 | ||||||
| 									: PHPExcel_Shared_File::sys_get_temp_dir(); |     /** | ||||||
| 
 |      * Destroy this cell collection | ||||||
| 		parent::__construct($parent); |      */ | ||||||
| 		if (is_null($this->_fileHandle)) { |     public function __destruct() | ||||||
| 			$baseUnique = $this->_getUniqueID(); |     { | ||||||
| 			$this->_fileName = $this->_cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache'; |         if (!is_null($this->_fileHandle)) { | ||||||
| 			$this->_fileHandle = fopen($this->_fileName,'a+'); |             fclose($this->_fileHandle); | ||||||
| 		} |             unlink($this->_fileName); | ||||||
| 	}	//	function __construct()
 |         } | ||||||
| 
 |         $this->_fileHandle = null; | ||||||
| 
 |     } | ||||||
| 	/** | } | ||||||
| 	 * Destroy this cell collection |  | ||||||
| 	 */ |  | ||||||
| 	public function __destruct() { |  | ||||||
| 		if (!is_null($this->_fileHandle)) { |  | ||||||
| 			fclose($this->_fileHandle); |  | ||||||
| 			unlink($this->_fileName); |  | ||||||
| 		} |  | ||||||
| 		$this->_fileHandle = null; |  | ||||||
| 	}	//	function __destruct()
 |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| <?php | <?php | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * PHPExcel |  * PHPExcel_CachedObjectStorage_ICache | ||||||
|  * |  * | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * |  * | ||||||
| @ -21,92 +22,82 @@ | |||||||
|  * @category   PHPExcel |  * @category   PHPExcel | ||||||
|  * @package    PHPExcel_CachedObjectStorage |  * @package    PHPExcel_CachedObjectStorage | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  * @version    ##VERSION##, ##DATE##
 |  * @version    ##VERSION##, ##DATE##
 | ||||||
|  */ |  */ | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| /** |  | ||||||
|  * PHPExcel_CachedObjectStorage_ICache |  | ||||||
|  * |  | ||||||
|  * @category   PHPExcel |  | ||||||
|  * @package    PHPExcel_CachedObjectStorage |  | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  | ||||||
|  */ |  | ||||||
| interface PHPExcel_CachedObjectStorage_ICache | interface PHPExcel_CachedObjectStorage_ICache | ||||||
| { | { | ||||||
|     /** |     /** | ||||||
|      * Add or Update a cell in cache identified by coordinate address |      * Add or Update a cell in cache identified by coordinate address | ||||||
|      * |      * | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to update |      * @param    string            $pCoord        Coordinate address of the cell to update | ||||||
|      * @param	PHPExcel_Cell	$cell		Cell to update |      * @param    PHPExcel_Cell    $cell        Cell to update | ||||||
| 	 * @return	PHPExcel_Cell |      * @return    PHPExcel_Cell | ||||||
|      * @throws	PHPExcel_Exception |      * @throws    PHPExcel_Exception | ||||||
|      */ |      */ | ||||||
| 	public function addCacheData($pCoord, PHPExcel_Cell $cell); |     public function addCacheData($pCoord, PHPExcel_Cell $cell); | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Add or Update a cell in cache |      * Add or Update a cell in cache | ||||||
|      * |      * | ||||||
|      * @param	PHPExcel_Cell	$cell		Cell to update |      * @param    PHPExcel_Cell    $cell        Cell to update | ||||||
| 	 * @return	PHPExcel_Cell |      * @return    PHPExcel_Cell | ||||||
|      * @throws	PHPExcel_Exception |      * @throws    PHPExcel_Exception | ||||||
|      */ |      */ | ||||||
| 	public function updateCacheData(PHPExcel_Cell $cell); |     public function updateCacheData(PHPExcel_Cell $cell); | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Fetch a cell from cache identified by coordinate address |      * Fetch a cell from cache identified by coordinate address | ||||||
|      * |      * | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to retrieve |      * @param    string            $pCoord        Coordinate address of the cell to retrieve | ||||||
|      * @return PHPExcel_Cell 	Cell that was found, or null if not found |      * @return PHPExcel_Cell     Cell that was found, or null if not found | ||||||
|      * @throws	PHPExcel_Exception |      * @throws    PHPExcel_Exception | ||||||
|      */ |      */ | ||||||
| 	public function getCacheData($pCoord); |     public function getCacheData($pCoord); | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Delete a cell in cache identified by coordinate address |      * Delete a cell in cache identified by coordinate address | ||||||
|      * |      * | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to delete |      * @param    string            $pCoord        Coordinate address of the cell to delete | ||||||
|      * @throws	PHPExcel_Exception |      * @throws    PHPExcel_Exception | ||||||
|      */ |      */ | ||||||
| 	public function deleteCacheData($pCoord); |     public function deleteCacheData($pCoord); | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? |      * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? | ||||||
| 	 * |      * | ||||||
| 	 * @param	string		$pCoord		Coordinate address of the cell to check |      * @param    string        $pCoord        Coordinate address of the cell to check | ||||||
| 	 * @return	boolean |      * @return    boolean | ||||||
| 	 */ |      */ | ||||||
| 	public function isDataSet($pCoord); |     public function isDataSet($pCoord); | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Get a list of all cell addresses currently held in cache |      * Get a list of all cell addresses currently held in cache | ||||||
| 	 * |      * | ||||||
| 	 * @return	string[] |      * @return    string[] | ||||||
| 	 */ |      */ | ||||||
| 	public function getCellList(); |     public function getCellList(); | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Get the list of all cell addresses currently held in cache sorted by column and row |      * Get the list of all cell addresses currently held in cache sorted by column and row | ||||||
| 	 * |      * | ||||||
| 	 * @return	string[] |      * @return    string[] | ||||||
| 	 */ |      */ | ||||||
| 	public function getSortedCellList(); |     public function getSortedCellList(); | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Clone the cell collection |      * Clone the cell collection | ||||||
| 	 * |      * | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The new worksheet |      * @param    PHPExcel_Worksheet    $parent        The new worksheet | ||||||
| 	 * @return	void |      * @return    void | ||||||
| 	 */ |      */ | ||||||
| 	public function copyCellCollection(PHPExcel_Worksheet $parent); |     public function copyCellCollection(PHPExcel_Worksheet $parent); | ||||||
| 
 |  | ||||||
| 	/** |  | ||||||
| 	 * Identify whether the caching method is currently available |  | ||||||
| 	 * Some methods are dependent on the availability of certain extensions being enabled in the PHP build |  | ||||||
| 	 * |  | ||||||
| 	 * @return	boolean |  | ||||||
| 	 */ |  | ||||||
| 	public static function cacheMethodIsAvailable(); |  | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Identify whether the caching method is currently available | ||||||
|  |      * Some methods are dependent on the availability of certain extensions being enabled in the PHP build | ||||||
|  |      * | ||||||
|  |      * @return    boolean | ||||||
|  |      */ | ||||||
|  |     public static function cacheMethodIsAvailable(); | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,152 +1,149 @@ | |||||||
| <?php | <?php | ||||||
| /** | 
 | ||||||
|  * PHPExcel | /** | ||||||
|  * |  * PHPExcel_CachedObjectStorage_Igbinary | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * | ||||||
|  * |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * This library is free software; you can redistribute it and/or |  * | ||||||
|  * modify it under the terms of the GNU Lesser General Public |  * This library is free software; you can redistribute it and/or | ||||||
|  * License as published by the Free Software Foundation; either |  * modify it under the terms of the GNU Lesser General Public | ||||||
|  * version 2.1 of the License, or (at your option) any later version. |  * License as published by the Free Software Foundation; either | ||||||
|  * |  * version 2.1 of the License, or (at your option) any later version. | ||||||
|  * This library is distributed in the hope that it will be useful, |  * | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  * This library is distributed in the hope that it will be useful, | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  * Lesser General Public License for more details. |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||||
|  * |  * Lesser General Public License for more details. | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * | ||||||
|  * License along with this library; if not, write to the Free Software |  * You should have received a copy of the GNU Lesser General Public | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA |  * License along with this library; if not, write to the Free Software | ||||||
|  * |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | ||||||
|  * @category   PHPExcel |  * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |  * @category   PHPExcel | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @package    PHPExcel_CachedObjectStorage | ||||||
|  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @version    ##VERSION##, ##DATE##
 |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  */ |  * @version    ##VERSION##, ##DATE##
 | ||||||
| 
 |  */ | ||||||
| 
 | class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||||||
| /** | { | ||||||
|  * PHPExcel_CachedObjectStorage_Igbinary |     /** | ||||||
|  * |      * Store cell data in cache for the current cell object if it's "dirty", | ||||||
|  * @category   PHPExcel |      *     and the 'nullify' the current cell object | ||||||
|  * @package    PHPExcel_CachedObjectStorage |      * | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |      * @return    void | ||||||
|  */ |      * @throws    PHPExcel_Exception | ||||||
| class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { |      */ | ||||||
| 
 |     protected function _storeData() | ||||||
|     /** |     { | ||||||
|      * Store cell data in cache for the current cell object if it's "dirty", |         if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { | ||||||
|      *     and the 'nullify' the current cell object |             $this->_currentObject->detach(); | ||||||
|      * | 
 | ||||||
| 	 * @return	void |             $this->_cellCache[$this->_currentObjectID] = igbinary_serialize($this->_currentObject); | ||||||
|      * @throws	PHPExcel_Exception |             $this->_currentCellIsDirty = false; | ||||||
|      */ |         } | ||||||
| 	protected function _storeData() { |         $this->_currentObjectID = $this->_currentObject = null; | ||||||
| 		if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { |     }    //    function _storeData()
 | ||||||
| 			$this->_currentObject->detach(); | 
 | ||||||
| 
 | 
 | ||||||
| 			$this->_cellCache[$this->_currentObjectID] = igbinary_serialize($this->_currentObject); |     /** | ||||||
| 			$this->_currentCellIsDirty = false; |      * Add or Update a cell in cache identified by coordinate address | ||||||
| 		} |      * | ||||||
| 		$this->_currentObjectID = $this->_currentObject = null; |      * @param    string            $pCoord        Coordinate address of the cell to update | ||||||
| 	}	//	function _storeData()
 |      * @param    PHPExcel_Cell    $cell        Cell to update | ||||||
| 
 |      * @return    PHPExcel_Cell | ||||||
| 
 |      * @throws    PHPExcel_Exception | ||||||
|     /** |      */ | ||||||
|      * Add or Update a cell in cache identified by coordinate address |     public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||||||
|      * |     { | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to update |         if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { | ||||||
|      * @param	PHPExcel_Cell	$cell		Cell to update |             $this->_storeData(); | ||||||
| 	 * @return	PHPExcel_Cell |         } | ||||||
|      * @throws	PHPExcel_Exception | 
 | ||||||
|      */ |         $this->_currentObjectID = $pCoord; | ||||||
| 	public function addCacheData($pCoord, PHPExcel_Cell $cell) { |         $this->_currentObject = $cell; | ||||||
| 		if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { |         $this->_currentCellIsDirty = true; | ||||||
| 			$this->_storeData(); | 
 | ||||||
| 		} |         return $cell; | ||||||
| 
 |     }    //    function addCacheData()
 | ||||||
| 		$this->_currentObjectID = $pCoord; | 
 | ||||||
| 		$this->_currentObject = $cell; | 
 | ||||||
| 		$this->_currentCellIsDirty = true; |     /** | ||||||
| 
 |      * Get cell at a specific coordinate | ||||||
| 		return $cell; |      * | ||||||
| 	}	//	function addCacheData()
 |      * @param     string             $pCoord        Coordinate of the cell | ||||||
| 
 |      * @throws     PHPExcel_Exception | ||||||
| 
 |      * @return     PHPExcel_Cell     Cell that was found, or null if not found | ||||||
|     /** |      */ | ||||||
|      * Get cell at a specific coordinate |     public function getCacheData($pCoord) | ||||||
|      * |     { | ||||||
|      * @param 	string 			$pCoord		Coordinate of the cell |         if ($pCoord === $this->_currentObjectID) { | ||||||
|      * @throws 	PHPExcel_Exception |             return $this->_currentObject; | ||||||
|      * @return 	PHPExcel_Cell 	Cell that was found, or null if not found |         } | ||||||
|      */ |         $this->_storeData(); | ||||||
| 	public function getCacheData($pCoord) { | 
 | ||||||
| 		if ($pCoord === $this->_currentObjectID) { |         //    Check if the entry that has been requested actually exists
 | ||||||
| 			return $this->_currentObject; |         if (!isset($this->_cellCache[$pCoord])) { | ||||||
| 		} |             //    Return null if requested entry doesn't exist in cache
 | ||||||
| 		$this->_storeData(); |             return null; | ||||||
| 
 |         } | ||||||
| 		//	Check if the entry that has been requested actually exists
 | 
 | ||||||
| 		if (!isset($this->_cellCache[$pCoord])) { |         //    Set current entry to the requested entry
 | ||||||
| 			//	Return null if requested entry doesn't exist in cache
 |         $this->_currentObjectID = $pCoord; | ||||||
| 			return null; |         $this->_currentObject = igbinary_unserialize($this->_cellCache[$pCoord]); | ||||||
| 		} |         //    Re-attach this as the cell's parent
 | ||||||
| 
 |         $this->_currentObject->attach($this); | ||||||
| 		//	Set current entry to the requested entry
 | 
 | ||||||
| 		$this->_currentObjectID = $pCoord; |         //    Return requested entry
 | ||||||
| 		$this->_currentObject = igbinary_unserialize($this->_cellCache[$pCoord]); |         return $this->_currentObject; | ||||||
|         //    Re-attach this as the cell's parent
 |     }    //    function getCacheData()
 | ||||||
|         $this->_currentObject->attach($this); | 
 | ||||||
| 
 | 
 | ||||||
| 		//	Return requested entry
 |     /** | ||||||
| 		return $this->_currentObject; |      * Get a list of all cell addresses currently held in cache | ||||||
| 	}	//	function getCacheData()
 |      * | ||||||
| 
 |      * @return  string[] | ||||||
| 
 |      */ | ||||||
| 	/** |     public function getCellList() | ||||||
| 	 * Get a list of all cell addresses currently held in cache |     { | ||||||
| 	 * |         if ($this->_currentObjectID !== null) { | ||||||
| 	 * @return  string[] |             $this->_storeData(); | ||||||
| 	 */ |         } | ||||||
| 	public function getCellList() { | 
 | ||||||
| 		if ($this->_currentObjectID !== null) { |         return parent::getCellList(); | ||||||
| 			$this->_storeData(); |     } | ||||||
| 		} | 
 | ||||||
| 
 | 
 | ||||||
| 		return parent::getCellList(); |     /** | ||||||
| 	} |      * Clear the cell collection and disconnect from our parent | ||||||
| 
 |      * | ||||||
| 
 |      * @return    void | ||||||
| 	/** |      */ | ||||||
| 	 * Clear the cell collection and disconnect from our parent |     public function unsetWorksheetCells() | ||||||
| 	 * |     { | ||||||
| 	 * @return	void |         if (!is_null($this->_currentObject)) { | ||||||
| 	 */ |             $this->_currentObject->detach(); | ||||||
| 	public function unsetWorksheetCells() { |             $this->_currentObject = $this->_currentObjectID = null; | ||||||
| 		if(!is_null($this->_currentObject)) { |         } | ||||||
| 			$this->_currentObject->detach(); |         $this->_cellCache = array(); | ||||||
| 			$this->_currentObject = $this->_currentObjectID = null; | 
 | ||||||
| 		} |         //    detach ourself from the worksheet, so that it can then delete this object successfully
 | ||||||
| 		$this->_cellCache = array(); |         $this->_parent = null; | ||||||
| 
 |     }    //    function unsetWorksheetCells()
 | ||||||
| 		//	detach ourself from the worksheet, so that it can then delete this object successfully
 | 
 | ||||||
| 		$this->_parent = null; | 
 | ||||||
| 	}	//	function unsetWorksheetCells()
 |     /** | ||||||
| 
 |      * Identify whether the caching method is currently available | ||||||
| 
 |      * Some methods are dependent on the availability of certain extensions being enabled in the PHP build | ||||||
| 	/** |      * | ||||||
| 	 * Identify whether the caching method is currently available |      * @return    boolean | ||||||
| 	 * Some methods are dependent on the availability of certain extensions being enabled in the PHP build |      */ | ||||||
| 	 * |     public static function cacheMethodIsAvailable() | ||||||
| 	 * @return	boolean |     { | ||||||
| 	 */ |         if (!function_exists('igbinary_serialize')) { | ||||||
| 	public static function cacheMethodIsAvailable() { |             return false; | ||||||
| 		if (!function_exists('igbinary_serialize')) { |         } | ||||||
| 			return false; | 
 | ||||||
| 		} |         return true; | ||||||
| 
 |     } | ||||||
| 		return true; | } | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -1,312 +1,308 @@ | |||||||
| <?php | <?php | ||||||
| /** | 
 | ||||||
|  * PHPExcel | /** | ||||||
|  * |  * PHPExcel_CachedObjectStorage_Memcache | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * | ||||||
|  * |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * This library is free software; you can redistribute it and/or |  * | ||||||
|  * modify it under the terms of the GNU Lesser General Public |  * This library is free software; you can redistribute it and/or | ||||||
|  * License as published by the Free Software Foundation; either |  * modify it under the terms of the GNU Lesser General Public | ||||||
|  * version 2.1 of the License, or (at your option) any later version. |  * License as published by the Free Software Foundation; either | ||||||
|  * |  * version 2.1 of the License, or (at your option) any later version. | ||||||
|  * This library is distributed in the hope that it will be useful, |  * | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  * This library is distributed in the hope that it will be useful, | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  * Lesser General Public License for more details. |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||||
|  * |  * Lesser General Public License for more details. | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * | ||||||
|  * License along with this library; if not, write to the Free Software |  * You should have received a copy of the GNU Lesser General Public | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA |  * License along with this library; if not, write to the Free Software | ||||||
|  * |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | ||||||
|  * @category   PHPExcel |  * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |  * @category   PHPExcel | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @package    PHPExcel_CachedObjectStorage | ||||||
|  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @version    ##VERSION##, ##DATE##
 |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  */ |  * @version    ##VERSION##, ##DATE##
 | ||||||
| 
 |  */ | ||||||
| 
 | class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||||||
| /** | { | ||||||
|  * PHPExcel_CachedObjectStorage_Memcache |     /** | ||||||
|  * |      * Prefix used to uniquely identify cache data for this worksheet | ||||||
|  * @category   PHPExcel |      * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |      * @var string | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |      */ | ||||||
|  */ |     private $_cachePrefix = null; | ||||||
| class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Cache timeout | ||||||
| 	 * Prefix used to uniquely identify cache data for this worksheet |      * | ||||||
| 	 * |      * @var integer | ||||||
| 	 * @var string |      */ | ||||||
| 	 */ |     private $_cacheTime = 600; | ||||||
| 	private $_cachePrefix = null; | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Memcache interface | ||||||
| 	 * Cache timeout |      * | ||||||
| 	 * |      * @var resource | ||||||
| 	 * @var integer |      */ | ||||||
| 	 */ |     private $_memcache = null; | ||||||
| 	private $_cacheTime = 600; | 
 | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Memcache interface |      * Store cell data in cache for the current cell object if it's "dirty", | ||||||
| 	 * |      *     and the 'nullify' the current cell object | ||||||
| 	 * @var resource |      * | ||||||
| 	 */ |      * @return    void | ||||||
| 	private $_memcache = null; |      * @throws    PHPExcel_Exception | ||||||
| 
 |      */ | ||||||
| 
 |     protected function _storeData() | ||||||
|     /** |     { | ||||||
|      * Store cell data in cache for the current cell object if it's "dirty", |         if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { | ||||||
|      *     and the 'nullify' the current cell object |             $this->_currentObject->detach(); | ||||||
|      * | 
 | ||||||
| 	 * @return	void |             $obj = serialize($this->_currentObject); | ||||||
|      * @throws	PHPExcel_Exception |             if (!$this->_memcache->replace($this->_cachePrefix . $this->_currentObjectID . '.cache', $obj, null, $this->_cacheTime)) { | ||||||
|      */ |                 if (!$this->_memcache->add($this->_cachePrefix . $this->_currentObjectID . '.cache', $obj, null, $this->_cacheTime)) { | ||||||
| 	protected function _storeData() { |                     $this->__destruct(); | ||||||
| 		if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { |                     throw new PHPExcel_Exception("Failed to store cell {$this->_currentObjectID} in MemCache"); | ||||||
| 			$this->_currentObject->detach(); |                 } | ||||||
| 
 |             } | ||||||
| 			$obj = serialize($this->_currentObject); |             $this->_currentCellIsDirty = false; | ||||||
| 			if (!$this->_memcache->replace($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) { |         } | ||||||
| 				if (!$this->_memcache->add($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) { |         $this->_currentObjectID = $this->_currentObject = null; | ||||||
| 					$this->__destruct(); |     }    //    function _storeData()
 | ||||||
| 					throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache'); | 
 | ||||||
| 				} | 
 | ||||||
| 			} |     /** | ||||||
| 			$this->_currentCellIsDirty = false; |      * Add or Update a cell in cache identified by coordinate address | ||||||
| 		} |      * | ||||||
| 		$this->_currentObjectID = $this->_currentObject = null; |      * @param    string            $pCoord        Coordinate address of the cell to update | ||||||
| 	}	//	function _storeData()
 |      * @param    PHPExcel_Cell    $cell        Cell to update | ||||||
| 
 |      * @return    PHPExcel_Cell | ||||||
| 
 |      * @throws    PHPExcel_Exception | ||||||
|     /** |      */ | ||||||
|      * Add or Update a cell in cache identified by coordinate address |     public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||||||
|      * |     { | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to update |         if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { | ||||||
|      * @param	PHPExcel_Cell	$cell		Cell to update |             $this->_storeData(); | ||||||
| 	 * @return	PHPExcel_Cell |         } | ||||||
|      * @throws	PHPExcel_Exception |         $this->_cellCache[$pCoord] = true; | ||||||
|      */ | 
 | ||||||
| 	public function addCacheData($pCoord, PHPExcel_Cell $cell) { |         $this->_currentObjectID = $pCoord; | ||||||
| 		if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { |         $this->_currentObject = $cell; | ||||||
| 			$this->_storeData(); |         $this->_currentCellIsDirty = true; | ||||||
| 		} | 
 | ||||||
| 		$this->_cellCache[$pCoord] = true; |         return $cell; | ||||||
| 
 |     }    //    function addCacheData()
 | ||||||
| 		$this->_currentObjectID = $pCoord; | 
 | ||||||
| 		$this->_currentObject = $cell; | 
 | ||||||
| 		$this->_currentCellIsDirty = true; |     /** | ||||||
| 
 |      * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? | ||||||
| 		return $cell; |      * | ||||||
| 	}	//	function addCacheData()
 |      * @param    string        $pCoord        Coordinate address of the cell to check | ||||||
| 
 |      * @return    boolean | ||||||
| 
 |      * @return    boolean | ||||||
| 	/** |      */ | ||||||
| 	 * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? |     public function isDataSet($pCoord) | ||||||
| 	 * |     { | ||||||
| 	 * @param	string		$pCoord		Coordinate address of the cell to check |         //    Check if the requested entry is the current object, or exists in the cache
 | ||||||
| 	 * @return	boolean |         if (parent::isDataSet($pCoord)) { | ||||||
| 	 * @return	boolean |             if ($this->_currentObjectID == $pCoord) { | ||||||
| 	 */ |                 return true; | ||||||
| 	public function isDataSet($pCoord) { |             } | ||||||
| 		//	Check if the requested entry is the current object, or exists in the cache
 |             //    Check if the requested entry still exists in Memcache
 | ||||||
| 		if (parent::isDataSet($pCoord)) { |             $success = $this->_memcache->get($this->_cachePrefix.$pCoord.'.cache'); | ||||||
| 			if ($this->_currentObjectID == $pCoord) { |             if ($success === false) { | ||||||
| 				return true; |                 //    Entry no longer exists in Memcache, so clear it from the cache array
 | ||||||
| 			} |                 parent::deleteCacheData($pCoord); | ||||||
| 			//	Check if the requested entry still exists in Memcache
 |                 throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); | ||||||
| 			$success = $this->_memcache->get($this->_cachePrefix.$pCoord.'.cache'); |             } | ||||||
| 			if ($success === false) { |             return true; | ||||||
| 				//	Entry no longer exists in Memcache, so clear it from the cache array
 |         } | ||||||
| 				parent::deleteCacheData($pCoord); |         return false; | ||||||
| 				throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); |     } | ||||||
| 			} | 
 | ||||||
| 			return true; | 
 | ||||||
| 		} |     /** | ||||||
| 		return false; |      * Get cell at a specific coordinate | ||||||
| 	}	//	function isDataSet()
 |      * | ||||||
| 
 |      * @param     string             $pCoord        Coordinate of the cell | ||||||
| 
 |      * @throws     PHPExcel_Exception | ||||||
| 	/** |      * @return     PHPExcel_Cell     Cell that was found, or null if not found | ||||||
|      * Get cell at a specific coordinate |      */ | ||||||
|      * |     public function getCacheData($pCoord) | ||||||
|      * @param 	string 			$pCoord		Coordinate of the cell |     { | ||||||
|      * @throws 	PHPExcel_Exception |         if ($pCoord === $this->_currentObjectID) { | ||||||
|      * @return 	PHPExcel_Cell 	Cell that was found, or null if not found |             return $this->_currentObject; | ||||||
|      */ |         } | ||||||
| 	public function getCacheData($pCoord) { |         $this->_storeData(); | ||||||
| 		if ($pCoord === $this->_currentObjectID) { | 
 | ||||||
| 			return $this->_currentObject; |         //    Check if the entry that has been requested actually exists
 | ||||||
| 		} |         if (parent::isDataSet($pCoord)) { | ||||||
| 		$this->_storeData(); |             $obj = $this->_memcache->get($this->_cachePrefix . $pCoord . '.cache'); | ||||||
| 
 |             if ($obj === false) { | ||||||
| 		//	Check if the entry that has been requested actually exists
 |                 //    Entry no longer exists in Memcache, so clear it from the cache array
 | ||||||
| 		if (parent::isDataSet($pCoord)) { |                 parent::deleteCacheData($pCoord); | ||||||
| 			$obj = $this->_memcache->get($this->_cachePrefix.$pCoord.'.cache'); |                 throw new PHPExcel_Exception("Cell entry {$pCoord} no longer exists in MemCache"); | ||||||
| 			if ($obj === false) { |             } | ||||||
| 				//	Entry no longer exists in Memcache, so clear it from the cache array
 |         } else { | ||||||
| 				parent::deleteCacheData($pCoord); |             //    Return null if requested entry doesn't exist in cache
 | ||||||
| 				throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); |             return null; | ||||||
| 			} |         } | ||||||
| 		} else { | 
 | ||||||
| 			//	Return null if requested entry doesn't exist in cache
 |         //    Set current entry to the requested entry
 | ||||||
| 			return null; |         $this->_currentObjectID = $pCoord; | ||||||
| 		} |         $this->_currentObject = unserialize($obj); | ||||||
| 
 |         //    Re-attach this as the cell's parent
 | ||||||
| 		//	Set current entry to the requested entry
 |         $this->_currentObject->attach($this); | ||||||
| 		$this->_currentObjectID = $pCoord; | 
 | ||||||
| 		$this->_currentObject = unserialize($obj); |         //    Return requested entry
 | ||||||
|         //    Re-attach this as the cell's parent
 |         return $this->_currentObject; | ||||||
|         $this->_currentObject->attach($this); |     } | ||||||
| 
 | 
 | ||||||
| 		//	Return requested entry
 |     /** | ||||||
| 		return $this->_currentObject; |      * Get a list of all cell addresses currently held in cache | ||||||
| 	}	//	function getCacheData()
 |      * | ||||||
| 
 |      * @return  string[] | ||||||
| 
 |      */ | ||||||
| 	/** |     public function getCellList() | ||||||
| 	 * Get a list of all cell addresses currently held in cache |     { | ||||||
| 	 * |         if ($this->_currentObjectID !== null) { | ||||||
| 	 * @return  string[] |             $this->_storeData(); | ||||||
| 	 */ |         } | ||||||
| 	public function getCellList() { | 
 | ||||||
| 		if ($this->_currentObjectID !== null) { |         return parent::getCellList(); | ||||||
| 			$this->_storeData(); |     } | ||||||
| 		} | 
 | ||||||
| 
 |     /** | ||||||
| 		return parent::getCellList(); |      * Delete a cell in cache identified by coordinate address | ||||||
| 	} |      * | ||||||
| 
 |      * @param    string            $pCoord        Coordinate address of the cell to delete | ||||||
| 
 |      * @throws    PHPExcel_Exception | ||||||
|     /** |      */ | ||||||
|      * Delete a cell in cache identified by coordinate address |     public function deleteCacheData($pCoord) | ||||||
|      * |     { | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to delete |         //    Delete the entry from Memcache
 | ||||||
|      * @throws	PHPExcel_Exception |         $this->_memcache->delete($this->_cachePrefix . $pCoord . '.cache'); | ||||||
|      */ | 
 | ||||||
| 	public function deleteCacheData($pCoord) { |         //    Delete the entry from our cell address array
 | ||||||
| 		//	Delete the entry from Memcache
 |         parent::deleteCacheData($pCoord); | ||||||
| 		$this->_memcache->delete($this->_cachePrefix.$pCoord.'.cache'); |     } | ||||||
| 
 | 
 | ||||||
| 		//	Delete the entry from our cell address array
 |     /** | ||||||
| 		parent::deleteCacheData($pCoord); |      * Clone the cell collection | ||||||
| 	}	//	function deleteCacheData()
 |      * | ||||||
| 
 |      * @param    PHPExcel_Worksheet    $parent        The new worksheet | ||||||
| 
 |      * @return    void | ||||||
| 	/** |      */ | ||||||
| 	 * Clone the cell collection |     public function copyCellCollection(PHPExcel_Worksheet $parent) | ||||||
| 	 * |     { | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The new worksheet |         parent::copyCellCollection($parent); | ||||||
| 	 * @return	void |         //    Get a new id for the new file name
 | ||||||
| 	 */ |         $baseUnique = $this->_getUniqueID(); | ||||||
| 	public function copyCellCollection(PHPExcel_Worksheet $parent) { |         $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.'; | ||||||
| 		parent::copyCellCollection($parent); |         $cacheList = $this->getCellList(); | ||||||
| 		//	Get a new id for the new file name
 |         foreach ($cacheList as $cellID) { | ||||||
| 		$baseUnique = $this->_getUniqueID(); |             if ($cellID != $this->_currentObjectID) { | ||||||
| 		$newCachePrefix = substr(md5($baseUnique),0,8).'.'; |                 $obj = $this->_memcache->get($this->_cachePrefix.$cellID.'.cache'); | ||||||
| 		$cacheList = $this->getCellList(); |                 if ($obj === false) { | ||||||
| 		foreach($cacheList as $cellID) { |                     //    Entry no longer exists in Memcache, so clear it from the cache array
 | ||||||
| 			if ($cellID != $this->_currentObjectID) { |                     parent::deleteCacheData($cellID); | ||||||
| 				$obj = $this->_memcache->get($this->_cachePrefix.$cellID.'.cache'); |                     throw new PHPExcel_Exception("Cell entry {$cellID} no longer exists in MemCache"); | ||||||
| 				if ($obj === false) { |                 } | ||||||
| 					//	Entry no longer exists in Memcache, so clear it from the cache array
 |                 if (!$this->_memcache->add($newCachePrefix . $cellID . '.cache', $obj, null, $this->_cacheTime)) { | ||||||
| 					parent::deleteCacheData($cellID); |                     $this->__destruct(); | ||||||
| 					throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in MemCache'); |                     throw new PHPExcel_Exception("Failed to store cell {$cellID} in MemCache"); | ||||||
| 				} |                 } | ||||||
| 				if (!$this->_memcache->add($newCachePrefix.$cellID.'.cache',$obj,NULL,$this->_cacheTime)) { |             } | ||||||
| 					$this->__destruct(); |         } | ||||||
| 					throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in MemCache'); |         $this->_cachePrefix = $newCachePrefix; | ||||||
| 				} |     } | ||||||
| 			} | 
 | ||||||
| 		} |     /** | ||||||
| 		$this->_cachePrefix = $newCachePrefix; |      * Clear the cell collection and disconnect from our parent | ||||||
| 	}	//	function copyCellCollection()
 |      * | ||||||
| 
 |      * @return    void | ||||||
| 
 |      */ | ||||||
| 	/** |     public function unsetWorksheetCells() | ||||||
| 	 * Clear the cell collection and disconnect from our parent |     { | ||||||
| 	 * |         if (!is_null($this->_currentObject)) { | ||||||
| 	 * @return	void |             $this->_currentObject->detach(); | ||||||
| 	 */ |             $this->_currentObject = $this->_currentObjectID = null; | ||||||
| 	public function unsetWorksheetCells() { |         } | ||||||
| 		if(!is_null($this->_currentObject)) { | 
 | ||||||
| 			$this->_currentObject->detach(); |         //    Flush the Memcache cache
 | ||||||
| 			$this->_currentObject = $this->_currentObjectID = null; |         $this->__destruct(); | ||||||
| 		} | 
 | ||||||
| 
 |         $this->_cellCache = array(); | ||||||
| 		//	Flush the Memcache cache
 | 
 | ||||||
| 		$this->__destruct(); |         //    detach ourself from the worksheet, so that it can then delete this object successfully
 | ||||||
| 
 |         $this->_parent = null; | ||||||
| 		$this->_cellCache = array(); |     } | ||||||
| 
 | 
 | ||||||
| 		//	detach ourself from the worksheet, so that it can then delete this object successfully
 |     /** | ||||||
| 		$this->_parent = null; |      * Initialise this new cell collection | ||||||
| 	}	//	function unsetWorksheetCells()
 |      * | ||||||
| 
 |      * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection | ||||||
| 
 |      * @param    array of mixed        $arguments    Additional initialisation arguments | ||||||
| 	/** |      */ | ||||||
| 	 * Initialise this new cell collection |     public function __construct(PHPExcel_Worksheet $parent, $arguments) | ||||||
| 	 * |     { | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The worksheet for this cell collection |         $memcacheServer = (isset($arguments['memcacheServer'])) ? $arguments['memcacheServer'] : 'localhost'; | ||||||
| 	 * @param	array of mixed		$arguments	Additional initialisation arguments |         $memcachePort = (isset($arguments['memcachePort'])) ? $arguments['memcachePort'] : 11211; | ||||||
| 	 */ |         $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; | ||||||
| 	public function __construct(PHPExcel_Worksheet $parent, $arguments) { | 
 | ||||||
| 		$memcacheServer	= (isset($arguments['memcacheServer']))	? $arguments['memcacheServer']	: 'localhost'; |         if (is_null($this->_cachePrefix)) { | ||||||
| 		$memcachePort	= (isset($arguments['memcachePort']))	? $arguments['memcachePort']	: 11211; |             $baseUnique = $this->_getUniqueID(); | ||||||
| 		$cacheTime		= (isset($arguments['cacheTime']))		? $arguments['cacheTime']		: 600; |             $this->_cachePrefix = substr(md5($baseUnique), 0, 8) . '.'; | ||||||
| 
 | 
 | ||||||
| 		if (is_null($this->_cachePrefix)) { |             //    Set a new Memcache object and connect to the Memcache server
 | ||||||
| 			$baseUnique = $this->_getUniqueID(); |             $this->_memcache = new Memcache(); | ||||||
| 			$this->_cachePrefix = substr(md5($baseUnique),0,8).'.'; |             if (!$this->_memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) { | ||||||
| 
 |                 throw new PHPExcel_Exception("Could not connect to MemCache server at {$memcacheServer}:{$memcachePort}"; | ||||||
| 			//	Set a new Memcache object and connect to the Memcache server
 |             } | ||||||
| 			$this->_memcache = new Memcache(); |             $this->_cacheTime = $cacheTime; | ||||||
| 			if (!$this->_memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) { | 
 | ||||||
| 				throw new PHPExcel_Exception('Could not connect to MemCache server at '.$memcacheServer.':'.$memcachePort); |             parent::__construct($parent); | ||||||
| 			} |         } | ||||||
| 			$this->_cacheTime = $cacheTime; |     } | ||||||
| 
 | 
 | ||||||
| 			parent::__construct($parent); |     /** | ||||||
| 		} |      * Memcache error handler | ||||||
| 	}	//	function __construct()
 |      * | ||||||
| 
 |      * @param    string    $host        Memcache server | ||||||
| 
 |      * @param    integer    $port        Memcache port | ||||||
| 	/** |      * @throws    PHPExcel_Exception | ||||||
| 	 * Memcache error handler |      */ | ||||||
| 	 * |     public function failureCallback($host, $port) | ||||||
| 	 * @param	string	$host		Memcache server |     { | ||||||
| 	 * @param	integer	$port		Memcache port |         throw new PHPExcel_Exception("memcache {$host}:{$port} failed"); | ||||||
|      * @throws	PHPExcel_Exception |     } | ||||||
| 	 */ | 
 | ||||||
| 	public function failureCallback($host, $port) { |     /** | ||||||
| 		throw new PHPExcel_Exception('memcache '.$host.':'.$port.' failed'); |      * Destroy this cell collection | ||||||
| 	} |      */ | ||||||
| 
 |     public function __destruct() | ||||||
| 
 |     { | ||||||
| 	/** |         $cacheList = $this->getCellList(); | ||||||
| 	 * Destroy this cell collection |         foreach ($cacheList as $cellID) { | ||||||
| 	 */ |             $this->_memcache->delete($this->_cachePrefix.$cellID . '.cache'); | ||||||
| 	public function __destruct() { |         } | ||||||
| 		$cacheList = $this->getCellList(); |     } | ||||||
| 		foreach($cacheList as $cellID) { | 
 | ||||||
| 			$this->_memcache->delete($this->_cachePrefix.$cellID.'.cache'); |     /** | ||||||
| 		} |      * Identify whether the caching method is currently available | ||||||
| 	}	//	function __destruct()
 |      * Some methods are dependent on the availability of certain extensions being enabled in the PHP build | ||||||
| 
 |      * | ||||||
| 	/** |      * @return    boolean | ||||||
| 	 * Identify whether the caching method is currently available |      */ | ||||||
| 	 * Some methods are dependent on the availability of certain extensions being enabled in the PHP build |     public static function cacheMethodIsAvailable() | ||||||
| 	 * |     { | ||||||
| 	 * @return	boolean |         if (!function_exists('memcache_add')) { | ||||||
| 	 */ |             return false; | ||||||
| 	public static function cacheMethodIsAvailable() { |         } | ||||||
| 		if (!function_exists('memcache_add')) { | 
 | ||||||
| 			return false; |         return true; | ||||||
| 		} |     } | ||||||
| 
 | } | ||||||
| 		return true; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -1,125 +1,118 @@ | |||||||
| <?php | <?php | ||||||
| /** | 
 | ||||||
|  * PHPExcel | /** | ||||||
|  * |  * PHPExcel_CachedObjectStorage_Memory | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * | ||||||
|  * |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * This library is free software; you can redistribute it and/or |  * | ||||||
|  * modify it under the terms of the GNU Lesser General Public |  * This library is free software; you can redistribute it and/or | ||||||
|  * License as published by the Free Software Foundation; either |  * modify it under the terms of the GNU Lesser General Public | ||||||
|  * version 2.1 of the License, or (at your option) any later version. |  * License as published by the Free Software Foundation; either | ||||||
|  * |  * version 2.1 of the License, or (at your option) any later version. | ||||||
|  * This library is distributed in the hope that it will be useful, |  * | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  * This library is distributed in the hope that it will be useful, | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  * Lesser General Public License for more details. |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||||
|  * |  * Lesser General Public License for more details. | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * | ||||||
|  * License along with this library; if not, write to the Free Software |  * You should have received a copy of the GNU Lesser General Public | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA |  * License along with this library; if not, write to the Free Software | ||||||
|  * |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | ||||||
|  * @category   PHPExcel |  * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |  * @category   PHPExcel | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @package    PHPExcel_CachedObjectStorage | ||||||
|  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @version    ##VERSION##, ##DATE##
 |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  */ |  * @version    ##VERSION##, ##DATE##
 | ||||||
| 
 |  */ | ||||||
| 
 | class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||||||
| /** | { | ||||||
|  * PHPExcel_CachedObjectStorage_Memory |     /** | ||||||
|  * |      * Dummy method callable from CacheBase, but unused by Memory cache | ||||||
|  * @category   PHPExcel |      * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |      * @return    void | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |      */ | ||||||
|  */ |     protected function _storeData() | ||||||
| class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { |     { | ||||||
| 
 |     } | ||||||
|     /** | 
 | ||||||
|      * Dummy method callable from CacheBase, but unused by Memory cache |     /** | ||||||
|      * |      * Add or Update a cell in cache identified by coordinate address | ||||||
| 	 * @return	void |      * | ||||||
|      */ |      * @param    string            $pCoord        Coordinate address of the cell to update | ||||||
| 	protected function _storeData() { |      * @param    PHPExcel_Cell    $cell        Cell to update | ||||||
| 	}	//	function _storeData()
 |      * @return    PHPExcel_Cell | ||||||
| 
 |      * @throws    PHPExcel_Exception | ||||||
|     /** |      */ | ||||||
|      * Add or Update a cell in cache identified by coordinate address |     public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||||||
|      * |     { | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to update |         $this->_cellCache[$pCoord] = $cell; | ||||||
|      * @param	PHPExcel_Cell	$cell		Cell to update | 
 | ||||||
| 	 * @return	PHPExcel_Cell |         //    Set current entry to the new/updated entry
 | ||||||
|      * @throws	PHPExcel_Exception |         $this->_currentObjectID = $pCoord; | ||||||
|      */ | 
 | ||||||
| 	public function addCacheData($pCoord, PHPExcel_Cell $cell) { |         return $cell; | ||||||
| 		$this->_cellCache[$pCoord] = $cell; |     } | ||||||
| 
 | 
 | ||||||
| 		//	Set current entry to the new/updated entry
 | 
 | ||||||
| 		$this->_currentObjectID = $pCoord; |     /** | ||||||
| 
 |      * Get cell at a specific coordinate | ||||||
| 		return $cell; |      * | ||||||
| 	}	//	function addCacheData()
 |      * @param     string             $pCoord        Coordinate of the cell | ||||||
| 
 |      * @throws     PHPExcel_Exception | ||||||
| 
 |      * @return     PHPExcel_Cell     Cell that was found, or null if not found | ||||||
|     /** |      */ | ||||||
|      * Get cell at a specific coordinate |     public function getCacheData($pCoord) | ||||||
|      * |     { | ||||||
|      * @param 	string 			$pCoord		Coordinate of the cell |         //    Check if the entry that has been requested actually exists
 | ||||||
|      * @throws 	PHPExcel_Exception |         if (!isset($this->_cellCache[$pCoord])) { | ||||||
|      * @return 	PHPExcel_Cell 	Cell that was found, or null if not found |             $this->_currentObjectID = null; | ||||||
|      */ |             //    Return null if requested entry doesn't exist in cache
 | ||||||
| 	public function getCacheData($pCoord) { |             return null; | ||||||
| 		//	Check if the entry that has been requested actually exists
 |         } | ||||||
| 		if (!isset($this->_cellCache[$pCoord])) { | 
 | ||||||
| 			$this->_currentObjectID = NULL; |         //    Set current entry to the requested entry
 | ||||||
| 			//	Return null if requested entry doesn't exist in cache
 |         $this->_currentObjectID = $pCoord; | ||||||
| 			return null; | 
 | ||||||
| 		} |         //    Return requested entry
 | ||||||
| 
 |         return $this->_cellCache[$pCoord]; | ||||||
| 		//	Set current entry to the requested entry
 |     } | ||||||
| 		$this->_currentObjectID = $pCoord; | 
 | ||||||
| 
 | 
 | ||||||
| 		//	Return requested entry
 |     /** | ||||||
| 		return $this->_cellCache[$pCoord]; |      * Clone the cell collection | ||||||
| 	}	//	function getCacheData()
 |      * | ||||||
| 
 |      * @param    PHPExcel_Worksheet    $parent        The new worksheet | ||||||
| 
 |      */ | ||||||
| 	/** |     public function copyCellCollection(PHPExcel_Worksheet $parent) | ||||||
| 	 * Clone the cell collection |     { | ||||||
| 	 * |         parent::copyCellCollection($parent); | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The new worksheet | 
 | ||||||
| 	 * @return	void |         $newCollection = array(); | ||||||
| 	 */ |         foreach ($this->_cellCache as $k => &$cell) { | ||||||
| 	public function copyCellCollection(PHPExcel_Worksheet $parent) { |             $newCollection[$k] = clone $cell; | ||||||
| 		parent::copyCellCollection($parent); |             $newCollection[$k]->attach($this); | ||||||
| 
 |         } | ||||||
| 		$newCollection = array(); | 
 | ||||||
| 		foreach($this->_cellCache as $k => &$cell) { |         $this->_cellCache = $newCollection; | ||||||
| 			$newCollection[$k] = clone $cell; |     } | ||||||
| 			$newCollection[$k]->attach($this); | 
 | ||||||
| 		} |     /** | ||||||
| 
 |      * Clear the cell collection and disconnect from our parent | ||||||
| 		$this->_cellCache = $newCollection; |      * | ||||||
| 	} |      */ | ||||||
| 
 |     public function unsetWorksheetCells() | ||||||
| 
 |     { | ||||||
| 	/** |         // Because cells are all stored as intact objects in memory, we need to detach each one from the parent
 | ||||||
| 	 * Clear the cell collection and disconnect from our parent |         foreach ($this->_cellCache as $k => &$cell) { | ||||||
| 	 * |             $cell->detach(); | ||||||
| 	 * @return	void |             $this->_cellCache[$k] = null; | ||||||
| 	 */ |         } | ||||||
| 	public function unsetWorksheetCells() { |         unset($cell); | ||||||
| 		//	Because cells are all stored as intact objects in memory, we need to detach each one from the parent
 | 
 | ||||||
| 		foreach($this->_cellCache as $k => &$cell) { |         $this->_cellCache = array(); | ||||||
| 			$cell->detach(); | 
 | ||||||
| 			$this->_cellCache[$k] = null; |         //    detach ourself from the worksheet, so that it can then delete this object successfully
 | ||||||
| 		} |         $this->_parent = null; | ||||||
| 		unset($cell); |     } | ||||||
| 
 | } | ||||||
| 		$this->_cellCache = array(); |  | ||||||
| 
 |  | ||||||
| 		//	detach ourself from the worksheet, so that it can then delete this object successfully
 |  | ||||||
| 		$this->_parent = null; |  | ||||||
| 	}	//	function unsetWorksheetCells()
 |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -1,137 +1,133 @@ | |||||||
| <?php | <?php | ||||||
| /** | 
 | ||||||
|  * PHPExcel | /** | ||||||
|  * |  * PHPExcel_CachedObjectStorage_MemoryGZip | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * | ||||||
|  * |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * This library is free software; you can redistribute it and/or |  * | ||||||
|  * modify it under the terms of the GNU Lesser General Public |  * This library is free software; you can redistribute it and/or | ||||||
|  * License as published by the Free Software Foundation; either |  * modify it under the terms of the GNU Lesser General Public | ||||||
|  * version 2.1 of the License, or (at your option) any later version. |  * License as published by the Free Software Foundation; either | ||||||
|  * |  * version 2.1 of the License, or (at your option) any later version. | ||||||
|  * This library is distributed in the hope that it will be useful, |  * | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  * This library is distributed in the hope that it will be useful, | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  * Lesser General Public License for more details. |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||||
|  * |  * Lesser General Public License for more details. | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * | ||||||
|  * License along with this library; if not, write to the Free Software |  * You should have received a copy of the GNU Lesser General Public | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA |  * License along with this library; if not, write to the Free Software | ||||||
|  * |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | ||||||
|  * @category   PHPExcel |  * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |  * @category   PHPExcel | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @package    PHPExcel_CachedObjectStorage | ||||||
|  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @version    ##VERSION##, ##DATE##
 |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  */ |  * @version    ##VERSION##, ##DATE##
 | ||||||
| 
 |  */ | ||||||
| 
 | class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||||||
| /** | { | ||||||
|  * PHPExcel_CachedObjectStorage_MemoryGZip |     /** | ||||||
|  * |      * Store cell data in cache for the current cell object if it's "dirty", | ||||||
|  * @category   PHPExcel |      *     and the 'nullify' the current cell object | ||||||
|  * @package    PHPExcel_CachedObjectStorage |      * | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |      * @return    void | ||||||
|  */ |      * @throws    PHPExcel_Exception | ||||||
| class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { |      */ | ||||||
| 
 |     protected function _storeData() | ||||||
|     /** |     { | ||||||
|      * Store cell data in cache for the current cell object if it's "dirty", |         if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { | ||||||
|      *     and the 'nullify' the current cell object |             $this->_currentObject->detach(); | ||||||
|      * | 
 | ||||||
| 	 * @return	void |             $this->_cellCache[$this->_currentObjectID] = gzdeflate(serialize($this->_currentObject)); | ||||||
|      * @throws	PHPExcel_Exception |             $this->_currentCellIsDirty = false; | ||||||
|      */ |         } | ||||||
| 	protected function _storeData() { |         $this->_currentObjectID = $this->_currentObject = null; | ||||||
| 		if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { |     } | ||||||
| 			$this->_currentObject->detach(); | 
 | ||||||
| 
 | 
 | ||||||
| 			$this->_cellCache[$this->_currentObjectID] = gzdeflate(serialize($this->_currentObject)); |     /** | ||||||
| 			$this->_currentCellIsDirty = false; |      * Add or Update a cell in cache identified by coordinate address | ||||||
| 		} |      * | ||||||
| 		$this->_currentObjectID = $this->_currentObject = null; |      * @param    string            $pCoord        Coordinate address of the cell to update | ||||||
| 	}	//	function _storeData()
 |      * @param    PHPExcel_Cell    $cell        Cell to update | ||||||
| 
 |      * @return    PHPExcel_Cell | ||||||
| 
 |      * @throws    PHPExcel_Exception | ||||||
|     /** |      */ | ||||||
|      * Add or Update a cell in cache identified by coordinate address |     public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||||||
|      * |     { | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to update |         if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { | ||||||
|      * @param	PHPExcel_Cell	$cell		Cell to update |             $this->_storeData(); | ||||||
| 	 * @return	PHPExcel_Cell |         } | ||||||
|      * @throws	PHPExcel_Exception | 
 | ||||||
|      */ |         $this->_currentObjectID = $pCoord; | ||||||
| 	public function addCacheData($pCoord, PHPExcel_Cell $cell) { |         $this->_currentObject = $cell; | ||||||
| 		if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { |         $this->_currentCellIsDirty = true; | ||||||
| 			$this->_storeData(); | 
 | ||||||
| 		} |         return $cell; | ||||||
| 
 |     } | ||||||
| 		$this->_currentObjectID = $pCoord; | 
 | ||||||
| 		$this->_currentObject = $cell; | 
 | ||||||
| 		$this->_currentCellIsDirty = true; |     /** | ||||||
| 
 |      * Get cell at a specific coordinate | ||||||
| 		return $cell; |      * | ||||||
| 	}	//	function addCacheData()
 |      * @param     string             $pCoord        Coordinate of the cell | ||||||
| 
 |      * @throws     PHPExcel_Exception | ||||||
| 
 |      * @return     PHPExcel_Cell     Cell that was found, or null if not found | ||||||
|     /** |      */ | ||||||
|      * Get cell at a specific coordinate |     public function getCacheData($pCoord) | ||||||
|      * |     { | ||||||
|      * @param 	string 			$pCoord		Coordinate of the cell |         if ($pCoord === $this->_currentObjectID) { | ||||||
|      * @throws 	PHPExcel_Exception |             return $this->_currentObject; | ||||||
|      * @return 	PHPExcel_Cell 	Cell that was found, or null if not found |         } | ||||||
|      */ |         $this->_storeData(); | ||||||
| 	public function getCacheData($pCoord) { | 
 | ||||||
| 		if ($pCoord === $this->_currentObjectID) { |         //    Check if the entry that has been requested actually exists
 | ||||||
| 			return $this->_currentObject; |         if (!isset($this->_cellCache[$pCoord])) { | ||||||
| 		} |             //    Return null if requested entry doesn't exist in cache
 | ||||||
| 		$this->_storeData(); |             return null; | ||||||
| 
 |         } | ||||||
| 		//	Check if the entry that has been requested actually exists
 | 
 | ||||||
| 		if (!isset($this->_cellCache[$pCoord])) { |         //    Set current entry to the requested entry
 | ||||||
| 			//	Return null if requested entry doesn't exist in cache
 |         $this->_currentObjectID = $pCoord; | ||||||
| 			return null; |         $this->_currentObject = unserialize(gzinflate($this->_cellCache[$pCoord])); | ||||||
| 		} |         //    Re-attach this as the cell's parent
 | ||||||
| 
 |         $this->_currentObject->attach($this); | ||||||
| 		//	Set current entry to the requested entry
 | 
 | ||||||
| 		$this->_currentObjectID = $pCoord; |         //    Return requested entry
 | ||||||
| 		$this->_currentObject = unserialize(gzinflate($this->_cellCache[$pCoord])); |         return $this->_currentObject; | ||||||
|         //    Re-attach this as the cell's parent
 |     } | ||||||
|         $this->_currentObject->attach($this); | 
 | ||||||
| 
 | 
 | ||||||
| 		//	Return requested entry
 |     /** | ||||||
| 		return $this->_currentObject; |      * Get a list of all cell addresses currently held in cache | ||||||
| 	}	//	function getCacheData()
 |      * | ||||||
| 
 |      * @return  string[] | ||||||
| 
 |      */ | ||||||
| 	/** |     public function getCellList() | ||||||
| 	 * Get a list of all cell addresses currently held in cache |     { | ||||||
| 	 * |         if ($this->_currentObjectID !== null) { | ||||||
| 	 * @return  string[] |             $this->_storeData(); | ||||||
| 	 */ |         } | ||||||
| 	public function getCellList() { | 
 | ||||||
| 		if ($this->_currentObjectID !== null) { |         return parent::getCellList(); | ||||||
| 			$this->_storeData(); |     } | ||||||
| 		} | 
 | ||||||
| 
 | 
 | ||||||
| 		return parent::getCellList(); |     /** | ||||||
| 	} |      * Clear the cell collection and disconnect from our parent | ||||||
| 
 |      * | ||||||
| 
 |      * @return    void | ||||||
| 	/** |      */ | ||||||
| 	 * Clear the cell collection and disconnect from our parent |     public function unsetWorksheetCells() | ||||||
| 	 * |     { | ||||||
| 	 * @return	void |         if (!is_null($this->_currentObject)) { | ||||||
| 	 */ |             $this->_currentObject->detach(); | ||||||
| 	public function unsetWorksheetCells() { |             $this->_currentObject = $this->_currentObjectID = null; | ||||||
| 		if(!is_null($this->_currentObject)) { |         } | ||||||
| 			$this->_currentObject->detach(); |         $this->_cellCache = array(); | ||||||
| 			$this->_currentObject = $this->_currentObjectID = null; | 
 | ||||||
| 		} |         //    detach ourself from the worksheet, so that it can then delete this object successfully
 | ||||||
| 		$this->_cellCache = array(); |         $this->_parent = null; | ||||||
| 
 |     } | ||||||
| 		//	detach ourself from the worksheet, so that it can then delete this object successfully
 | } | ||||||
| 		$this->_parent = null; |  | ||||||
| 	}	//	function unsetWorksheetCells()
 |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -1,137 +1,129 @@ | |||||||
| <?php | <?php | ||||||
| /** | 
 | ||||||
|  * PHPExcel | /** | ||||||
|  * |  * PHPExcel_CachedObjectStorage_MemorySerialized | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * | ||||||
|  * |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * This library is free software; you can redistribute it and/or |  * | ||||||
|  * modify it under the terms of the GNU Lesser General Public |  * This library is free software; you can redistribute it and/or | ||||||
|  * License as published by the Free Software Foundation; either |  * modify it under the terms of the GNU Lesser General Public | ||||||
|  * version 2.1 of the License, or (at your option) any later version. |  * License as published by the Free Software Foundation; either | ||||||
|  * |  * version 2.1 of the License, or (at your option) any later version. | ||||||
|  * This library is distributed in the hope that it will be useful, |  * | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  * This library is distributed in the hope that it will be useful, | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  * Lesser General Public License for more details. |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||||
|  * |  * Lesser General Public License for more details. | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * | ||||||
|  * License along with this library; if not, write to the Free Software |  * You should have received a copy of the GNU Lesser General Public | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA |  * License along with this library; if not, write to the Free Software | ||||||
|  * |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | ||||||
|  * @category   PHPExcel |  * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |  * @category   PHPExcel | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @package    PHPExcel_CachedObjectStorage | ||||||
|  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @version    ##VERSION##, ##DATE##
 |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  */ |  * @version    ##VERSION##, ##DATE##
 | ||||||
| 
 |  */ | ||||||
| 
 | class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||||||
| /** | { | ||||||
|  * PHPExcel_CachedObjectStorage_MemorySerialized |     /** | ||||||
|  * |      * Store cell data in cache for the current cell object if it's "dirty", | ||||||
|  * @category   PHPExcel |      *     and the 'nullify' the current cell object | ||||||
|  * @package    PHPExcel_CachedObjectStorage |      * | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |      * @return    void | ||||||
|  */ |      * @throws    PHPExcel_Exception | ||||||
| class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { |      */ | ||||||
| 
 |     protected function _storeData() | ||||||
|     /** |     { | ||||||
|      * Store cell data in cache for the current cell object if it's "dirty", |         if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { | ||||||
|      *     and the 'nullify' the current cell object |             $this->_currentObject->detach(); | ||||||
|      * | 
 | ||||||
| 	 * @return	void |             $this->_cellCache[$this->_currentObjectID] = serialize($this->_currentObject); | ||||||
|      * @throws	PHPExcel_Exception |             $this->_currentCellIsDirty = false; | ||||||
|      */ |         } | ||||||
| 	protected function _storeData() { |         $this->_currentObjectID = $this->_currentObject = null; | ||||||
| 		if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { |     } | ||||||
| 			$this->_currentObject->detach(); | 
 | ||||||
| 
 |     /** | ||||||
| 			$this->_cellCache[$this->_currentObjectID] = serialize($this->_currentObject); |      * Add or Update a cell in cache identified by coordinate address | ||||||
| 			$this->_currentCellIsDirty = false; |      * | ||||||
| 		} |      * @param    string            $pCoord        Coordinate address of the cell to update | ||||||
| 		$this->_currentObjectID = $this->_currentObject = null; |      * @param    PHPExcel_Cell    $cell        Cell to update | ||||||
| 	}	//	function _storeData()
 |      * @return    PHPExcel_Cell | ||||||
| 
 |      * @throws    PHPExcel_Exception | ||||||
| 
 |      */ | ||||||
|     /** |     public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||||||
|      * Add or Update a cell in cache identified by coordinate address |     { | ||||||
|      * |         if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to update |             $this->_storeData(); | ||||||
|      * @param	PHPExcel_Cell	$cell		Cell to update |         } | ||||||
| 	 * @return	PHPExcel_Cell | 
 | ||||||
|      * @throws	PHPExcel_Exception |         $this->_currentObjectID = $pCoord; | ||||||
|      */ |         $this->_currentObject = $cell; | ||||||
| 	public function addCacheData($pCoord, PHPExcel_Cell $cell) { |         $this->_currentCellIsDirty = true; | ||||||
| 		if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { | 
 | ||||||
| 			$this->_storeData(); |         return $cell; | ||||||
| 		} |     } | ||||||
| 
 | 
 | ||||||
| 		$this->_currentObjectID = $pCoord; |     /** | ||||||
| 		$this->_currentObject = $cell; |      * Get cell at a specific coordinate | ||||||
| 		$this->_currentCellIsDirty = true; |      * | ||||||
| 
 |      * @param     string             $pCoord        Coordinate of the cell | ||||||
| 		return $cell; |      * @throws     PHPExcel_Exception | ||||||
| 	}	//	function addCacheData()
 |      * @return     PHPExcel_Cell     Cell that was found, or null if not found | ||||||
| 
 |      */ | ||||||
| 
 |     public function getCacheData($pCoord) | ||||||
|     /** |     { | ||||||
|      * Get cell at a specific coordinate |         if ($pCoord === $this->_currentObjectID) { | ||||||
|      * |             return $this->_currentObject; | ||||||
|      * @param 	string 			$pCoord		Coordinate of the cell |         } | ||||||
|      * @throws 	PHPExcel_Exception |         $this->_storeData(); | ||||||
|      * @return 	PHPExcel_Cell 	Cell that was found, or null if not found | 
 | ||||||
|      */ |         //    Check if the entry that has been requested actually exists
 | ||||||
| 	public function getCacheData($pCoord) { |         if (!isset($this->_cellCache[$pCoord])) { | ||||||
| 		if ($pCoord === $this->_currentObjectID) { |             //    Return null if requested entry doesn't exist in cache
 | ||||||
| 			return $this->_currentObject; |             return null; | ||||||
| 		} |         } | ||||||
| 		$this->_storeData(); | 
 | ||||||
| 
 |         //    Set current entry to the requested entry
 | ||||||
| 		//	Check if the entry that has been requested actually exists
 |         $this->_currentObjectID = $pCoord; | ||||||
| 		if (!isset($this->_cellCache[$pCoord])) { |         $this->_currentObject = unserialize($this->_cellCache[$pCoord]); | ||||||
| 			//	Return null if requested entry doesn't exist in cache
 |         //    Re-attach this as the cell's parent
 | ||||||
| 			return null; |         $this->_currentObject->attach($this); | ||||||
| 		} | 
 | ||||||
| 
 |         //    Return requested entry
 | ||||||
| 		//	Set current entry to the requested entry
 |         return $this->_currentObject; | ||||||
| 		$this->_currentObjectID = $pCoord; |     } | ||||||
| 		$this->_currentObject = unserialize($this->_cellCache[$pCoord]); | 
 | ||||||
|         //    Re-attach this as the cell's parent
 |     /** | ||||||
|         $this->_currentObject->attach($this); |      * Get a list of all cell addresses currently held in cache | ||||||
| 
 |      * | ||||||
| 		//	Return requested entry
 |      * @return  string[] | ||||||
| 		return $this->_currentObject; |      */ | ||||||
| 	}	//	function getCacheData()
 |     public function getCellList() | ||||||
| 
 |     { | ||||||
| 
 |         if ($this->_currentObjectID !== null) { | ||||||
| 	/** |             $this->_storeData(); | ||||||
| 	 * Get a list of all cell addresses currently held in cache |         } | ||||||
| 	 * | 
 | ||||||
| 	 * @return  string[] |         return parent::getCellList(); | ||||||
| 	 */ |     } | ||||||
| 	public function getCellList() { | 
 | ||||||
| 		if ($this->_currentObjectID !== null) { |     /** | ||||||
| 			$this->_storeData(); |      * Clear the cell collection and disconnect from our parent | ||||||
| 		} |      * | ||||||
| 
 |      * @return    void | ||||||
| 		return parent::getCellList(); |      */ | ||||||
| 	} |     public function unsetWorksheetCells() | ||||||
| 
 |     { | ||||||
| 
 |         if (!is_null($this->_currentObject)) { | ||||||
| 	/** |             $this->_currentObject->detach(); | ||||||
| 	 * Clear the cell collection and disconnect from our parent |             $this->_currentObject = $this->_currentObjectID = null; | ||||||
| 	 * |         } | ||||||
| 	 * @return	void |         $this->_cellCache = array(); | ||||||
| 	 */ | 
 | ||||||
| 	public function unsetWorksheetCells() { |         //    detach ourself from the worksheet, so that it can then delete this object successfully
 | ||||||
| 		if(!is_null($this->_currentObject)) { |         $this->_parent = null; | ||||||
| 			$this->_currentObject->detach(); |     } | ||||||
| 			$this->_currentObject = $this->_currentObjectID = null; | } | ||||||
| 		} |  | ||||||
| 		$this->_cellCache = array(); |  | ||||||
| 
 |  | ||||||
| 		//	detach ourself from the worksheet, so that it can then delete this object successfully
 |  | ||||||
| 		$this->_parent = null; |  | ||||||
| 	}	//	function unsetWorksheetCells()
 |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -1,206 +1,200 @@ | |||||||
| <?php | <?php | ||||||
| /** | 
 | ||||||
|  * PHPExcel | /** | ||||||
|  * |  * PHPExcel_CachedObjectStorage_PHPTemp | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * | ||||||
|  * |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * This library is free software; you can redistribute it and/or |  * | ||||||
|  * modify it under the terms of the GNU Lesser General Public |  * This library is free software; you can redistribute it and/or | ||||||
|  * License as published by the Free Software Foundation; either |  * modify it under the terms of the GNU Lesser General Public | ||||||
|  * version 2.1 of the License, or (at your option) any later version. |  * License as published by the Free Software Foundation; either | ||||||
|  * |  * version 2.1 of the License, or (at your option) any later version. | ||||||
|  * This library is distributed in the hope that it will be useful, |  * | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  * This library is distributed in the hope that it will be useful, | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  * Lesser General Public License for more details. |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||||
|  * |  * Lesser General Public License for more details. | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * | ||||||
|  * License along with this library; if not, write to the Free Software |  * You should have received a copy of the GNU Lesser General Public | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA |  * License along with this library; if not, write to the Free Software | ||||||
|  * |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | ||||||
|  * @category   PHPExcel |  * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |  * @category   PHPExcel | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @package    PHPExcel_CachedObjectStorage | ||||||
|  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @version    ##VERSION##, ##DATE##
 |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  */ |  * @version    ##VERSION##, ##DATE##
 | ||||||
| 
 |  */ | ||||||
| 
 | class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||||||
| /** | { | ||||||
|  * PHPExcel_CachedObjectStorage_PHPTemp |     /** | ||||||
|  * |      * Name of the file for this cache | ||||||
|  * @category   PHPExcel |      * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |      * @var string | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |      */ | ||||||
|  */ |     private $_fileHandle = null; | ||||||
| class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Memory limit to use before reverting to file cache | ||||||
| 	 * Name of the file for this cache |      * | ||||||
| 	 * |      * @var integer | ||||||
| 	 * @var string |      */ | ||||||
| 	 */ |     private $_memoryCacheSize = null; | ||||||
| 	private $_fileHandle = null; | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Store cell data in cache for the current cell object if it's "dirty", | ||||||
| 	 * Memory limit to use before reverting to file cache |      *     and the 'nullify' the current cell object | ||||||
| 	 * |      * | ||||||
| 	 * @var integer |      * @return    void | ||||||
| 	 */ |      * @throws    PHPExcel_Exception | ||||||
| 	private $_memoryCacheSize = null; |      */ | ||||||
| 
 |     protected function _storeData() | ||||||
|     /** |     { | ||||||
|      * Store cell data in cache for the current cell object if it's "dirty", |         if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { | ||||||
|      *     and the 'nullify' the current cell object |             $this->_currentObject->detach(); | ||||||
|      * | 
 | ||||||
| 	 * @return	void |             fseek($this->_fileHandle, 0, SEEK_END); | ||||||
|      * @throws	PHPExcel_Exception | 
 | ||||||
|      */ |             $this->_cellCache[$this->_currentObjectID] = array( | ||||||
| 	protected function _storeData() { |                 'ptr' => ftell($this->_fileHandle), | ||||||
| 		if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { |                 'sz'  => fwrite($this->_fileHandle, serialize($this->_currentObject)) | ||||||
| 			$this->_currentObject->detach(); |             ); | ||||||
| 
 |             $this->_currentCellIsDirty = false; | ||||||
| 			fseek($this->_fileHandle,0,SEEK_END); |         } | ||||||
| 
 |         $this->_currentObjectID = $this->_currentObject = null; | ||||||
| 			$this->_cellCache[$this->_currentObjectID] = array( |     } | ||||||
|                 'ptr' => ftell($this->_fileHandle), | 
 | ||||||
| 				'sz'  => fwrite($this->_fileHandle, serialize($this->_currentObject)) | 
 | ||||||
| 			); |     /** | ||||||
| 			$this->_currentCellIsDirty = false; |      * Add or Update a cell in cache identified by coordinate address | ||||||
| 		} |      * | ||||||
| 		$this->_currentObjectID = $this->_currentObject = null; |      * @param    string            $pCoord        Coordinate address of the cell to update | ||||||
| 	}	//	function _storeData()
 |      * @param    PHPExcel_Cell    $cell        Cell to update | ||||||
| 
 |      * @return    PHPExcel_Cell | ||||||
| 
 |      * @throws    PHPExcel_Exception | ||||||
|     /** |      */ | ||||||
|      * Add or Update a cell in cache identified by coordinate address |     public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||||||
|      * |     { | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to update |         if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { | ||||||
|      * @param	PHPExcel_Cell	$cell		Cell to update |             $this->_storeData(); | ||||||
| 	 * @return	PHPExcel_Cell |         } | ||||||
|      * @throws	PHPExcel_Exception | 
 | ||||||
|      */ |         $this->_currentObjectID = $pCoord; | ||||||
| 	public function addCacheData($pCoord, PHPExcel_Cell $cell) { |         $this->_currentObject = $cell; | ||||||
| 		if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { |         $this->_currentCellIsDirty = true; | ||||||
| 			$this->_storeData(); | 
 | ||||||
| 		} |         return $cell; | ||||||
| 
 |     } | ||||||
| 		$this->_currentObjectID = $pCoord; | 
 | ||||||
| 		$this->_currentObject = $cell; | 
 | ||||||
| 		$this->_currentCellIsDirty = true; |     /** | ||||||
| 
 |      * Get cell at a specific coordinate | ||||||
| 		return $cell; |      * | ||||||
| 	}	//	function addCacheData()
 |      * @param     string             $pCoord        Coordinate of the cell | ||||||
| 
 |      * @throws     PHPExcel_Exception | ||||||
| 
 |      * @return     PHPExcel_Cell     Cell that was found, or null if not found | ||||||
|     /** |      */ | ||||||
|      * Get cell at a specific coordinate |     public function getCacheData($pCoord) | ||||||
|      * |     { | ||||||
|      * @param 	string 			$pCoord		Coordinate of the cell |         if ($pCoord === $this->_currentObjectID) { | ||||||
|      * @throws 	PHPExcel_Exception |             return $this->_currentObject; | ||||||
|      * @return 	PHPExcel_Cell 	Cell that was found, or null if not found |         } | ||||||
|      */ |         $this->_storeData(); | ||||||
| 	public function getCacheData($pCoord) { | 
 | ||||||
| 		if ($pCoord === $this->_currentObjectID) { |         //    Check if the entry that has been requested actually exists
 | ||||||
| 			return $this->_currentObject; |         if (!isset($this->_cellCache[$pCoord])) { | ||||||
| 		} |             //    Return null if requested entry doesn't exist in cache
 | ||||||
| 		$this->_storeData(); |             return null; | ||||||
| 
 |         } | ||||||
| 		//	Check if the entry that has been requested actually exists
 | 
 | ||||||
| 		if (!isset($this->_cellCache[$pCoord])) { |         //    Set current entry to the requested entry
 | ||||||
| 			//	Return null if requested entry doesn't exist in cache
 |         $this->_currentObjectID = $pCoord; | ||||||
| 			return null; |         fseek($this->_fileHandle, $this->_cellCache[$pCoord]['ptr']); | ||||||
| 		} |         $this->_currentObject = unserialize(fread($this->_fileHandle, $this->_cellCache[$pCoord]['sz'])); | ||||||
| 
 |         //    Re-attach this as the cell's parent
 | ||||||
| 		//	Set current entry to the requested entry
 |         $this->_currentObject->attach($this); | ||||||
| 		$this->_currentObjectID = $pCoord; | 
 | ||||||
| 		fseek($this->_fileHandle,$this->_cellCache[$pCoord]['ptr']); |         //    Return requested entry
 | ||||||
| 		$this->_currentObject = unserialize(fread($this->_fileHandle,$this->_cellCache[$pCoord]['sz'])); |         return $this->_currentObject; | ||||||
|         //    Re-attach this as the cell's parent
 |     } | ||||||
|         $this->_currentObject->attach($this); | 
 | ||||||
| 
 |     /** | ||||||
| 		//	Return requested entry
 |      * Get a list of all cell addresses currently held in cache | ||||||
| 		return $this->_currentObject; |      * | ||||||
| 	}	//	function getCacheData()
 |      * @return  string[] | ||||||
| 
 |      */ | ||||||
| 
 |     public function getCellList() | ||||||
| 	/** |     { | ||||||
| 	 * Get a list of all cell addresses currently held in cache |         if ($this->_currentObjectID !== null) { | ||||||
| 	 * |             $this->_storeData(); | ||||||
| 	 * @return  string[] |         } | ||||||
| 	 */ | 
 | ||||||
| 	public function getCellList() { |         return parent::getCellList(); | ||||||
| 		if ($this->_currentObjectID !== null) { |     } | ||||||
| 			$this->_storeData(); | 
 | ||||||
| 		} |     /** | ||||||
| 
 |      * Clone the cell collection | ||||||
| 		return parent::getCellList(); |      * | ||||||
| 	} |      * @param    PHPExcel_Worksheet    $parent        The new worksheet | ||||||
| 
 |      * @return    void | ||||||
| 
 |      */ | ||||||
| 	/** |     public function copyCellCollection(PHPExcel_Worksheet $parent) | ||||||
| 	 * Clone the cell collection |     { | ||||||
| 	 * |         parent::copyCellCollection($parent); | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The new worksheet |         //    Open a new stream for the cell cache data
 | ||||||
| 	 * @return	void |         $newFileHandle = fopen('php://temp/maxmemory:' . $this->_memoryCacheSize, 'a+'); | ||||||
| 	 */ |         //    Copy the existing cell cache data to the new stream
 | ||||||
| 	public function copyCellCollection(PHPExcel_Worksheet $parent) { |         fseek($this->_fileHandle, 0); | ||||||
| 		parent::copyCellCollection($parent); |         while (!feof($this->_fileHandle)) { | ||||||
| 		//	Open a new stream for the cell cache data
 |             fwrite($newFileHandle, fread($this->_fileHandle, 1024)); | ||||||
| 		$newFileHandle = fopen('php://temp/maxmemory:'.$this->_memoryCacheSize,'a+'); |         } | ||||||
| 		//	Copy the existing cell cache data to the new stream
 |         $this->_fileHandle = $newFileHandle; | ||||||
| 		fseek($this->_fileHandle,0); |     } | ||||||
| 		while (!feof($this->_fileHandle)) { | 
 | ||||||
| 			fwrite($newFileHandle,fread($this->_fileHandle, 1024)); |     /** | ||||||
| 		} |      * Clear the cell collection and disconnect from our parent | ||||||
| 		$this->_fileHandle = $newFileHandle; |      * | ||||||
| 	}	//	function copyCellCollection()
 |      * @return    void | ||||||
| 
 |      */ | ||||||
| 
 |     public function unsetWorksheetCells() | ||||||
| 	/** |     { | ||||||
| 	 * Clear the cell collection and disconnect from our parent |         if (!is_null($this->_currentObject)) { | ||||||
| 	 * |             $this->_currentObject->detach(); | ||||||
| 	 * @return	void |             $this->_currentObject = $this->_currentObjectID = null; | ||||||
| 	 */ |         } | ||||||
| 	public function unsetWorksheetCells() { |         $this->_cellCache = array(); | ||||||
| 		if(!is_null($this->_currentObject)) { | 
 | ||||||
| 			$this->_currentObject->detach(); |         //    detach ourself from the worksheet, so that it can then delete this object successfully
 | ||||||
| 			$this->_currentObject = $this->_currentObjectID = null; |         $this->_parent = null; | ||||||
| 		} | 
 | ||||||
| 		$this->_cellCache = array(); |         //    Close down the php://temp file
 | ||||||
| 
 |         $this->__destruct(); | ||||||
| 		//	detach ourself from the worksheet, so that it can then delete this object successfully
 |     } | ||||||
| 		$this->_parent = null; | 
 | ||||||
| 
 |     /** | ||||||
| 		//	Close down the php://temp file
 |      * Initialise this new cell collection | ||||||
| 		$this->__destruct(); |      * | ||||||
| 	}	//	function unsetWorksheetCells()
 |      * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection | ||||||
| 
 |      * @param    array of mixed        $arguments    Additional initialisation arguments | ||||||
| 
 |      */ | ||||||
| 	/** |     public function __construct(PHPExcel_Worksheet $parent, $arguments) | ||||||
| 	 * Initialise this new cell collection |     { | ||||||
| 	 * |         $this->_memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB'; | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The worksheet for this cell collection | 
 | ||||||
| 	 * @param	array of mixed		$arguments	Additional initialisation arguments |         parent::__construct($parent); | ||||||
| 	 */ |         if (is_null($this->_fileHandle)) { | ||||||
| 	public function __construct(PHPExcel_Worksheet $parent, $arguments) { |             $this->_fileHandle = fopen('php://temp/maxmemory:' . $this->_memoryCacheSize, 'a+'); | ||||||
| 		$this->_memoryCacheSize	= (isset($arguments['memoryCacheSize']))	? $arguments['memoryCacheSize']	: '1MB'; |         } | ||||||
| 
 |     } | ||||||
| 		parent::__construct($parent); | 
 | ||||||
| 		if (is_null($this->_fileHandle)) { |     /** | ||||||
| 			$this->_fileHandle = fopen('php://temp/maxmemory:'.$this->_memoryCacheSize,'a+'); |      * Destroy this cell collection | ||||||
| 		} |      */ | ||||||
| 	}	//	function __construct()
 |     public function __destruct() | ||||||
| 
 |     { | ||||||
| 
 |         if (!is_null($this->_fileHandle)) { | ||||||
| 	/** |             fclose($this->_fileHandle); | ||||||
| 	 * Destroy this cell collection |         } | ||||||
| 	 */ |         $this->_fileHandle = null; | ||||||
| 	public function __destruct() { |     } | ||||||
| 		if (!is_null($this->_fileHandle)) { | } | ||||||
| 			fclose($this->_fileHandle); |  | ||||||
| 		} |  | ||||||
| 		$this->_fileHandle = null; |  | ||||||
| 	}	//	function __destruct()
 |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -1,306 +1,307 @@ | |||||||
| <?php | <?php | ||||||
| /** | 
 | ||||||
|  * PHPExcel | /** | ||||||
|  * |  * PHPExcel_CachedObjectStorage_SQLite | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * | ||||||
|  * |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * This library is free software; you can redistribute it and/or |  * | ||||||
|  * modify it under the terms of the GNU Lesser General Public |  * This library is free software; you can redistribute it and/or | ||||||
|  * License as published by the Free Software Foundation; either |  * modify it under the terms of the GNU Lesser General Public | ||||||
|  * version 2.1 of the License, or (at your option) any later version. |  * License as published by the Free Software Foundation; either | ||||||
|  * |  * version 2.1 of the License, or (at your option) any later version. | ||||||
|  * This library is distributed in the hope that it will be useful, |  * | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  * This library is distributed in the hope that it will be useful, | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  * Lesser General Public License for more details. |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||||
|  * |  * Lesser General Public License for more details. | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * | ||||||
|  * License along with this library; if not, write to the Free Software |  * You should have received a copy of the GNU Lesser General Public | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA |  * License along with this library; if not, write to the Free Software | ||||||
|  * |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | ||||||
|  * @category   PHPExcel |  * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |  * @category   PHPExcel | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @package    PHPExcel_CachedObjectStorage | ||||||
|  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @version    ##VERSION##, ##DATE##
 |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  */ |  * @version    ##VERSION##, ##DATE##
 | ||||||
| 
 |  */ | ||||||
| 
 | class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||||||
| /** | { | ||||||
|  * PHPExcel_CachedObjectStorage_SQLite |     /** | ||||||
|  * |      * Database table name | ||||||
|  * @category   PHPExcel |      * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |      * @var string | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |      */ | ||||||
|  */ |     private $_TableName = null; | ||||||
| class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Database handle | ||||||
| 	 * Database table name |      * | ||||||
| 	 * |      * @var resource | ||||||
| 	 * @var string |      */ | ||||||
| 	 */ |     private $_DBHandle = null; | ||||||
| 	private $_TableName = null; | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Store cell data in cache for the current cell object if it's "dirty", | ||||||
| 	 * Database handle |      *     and the 'nullify' the current cell object | ||||||
| 	 * |      * | ||||||
| 	 * @var resource |      * @return    void | ||||||
| 	 */ |      * @throws    PHPExcel_Exception | ||||||
| 	private $_DBHandle = null; |      */ | ||||||
| 
 |     protected function _storeData() | ||||||
|     /** |     { | ||||||
|      * Store cell data in cache for the current cell object if it's "dirty", |         if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { | ||||||
|      *     and the 'nullify' the current cell object |             $this->_currentObject->detach(); | ||||||
|      * | 
 | ||||||
| 	 * @return	void |             if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')")) { | ||||||
|      * @throws	PHPExcel_Exception |                 throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); | ||||||
|      */ |             } | ||||||
| 	protected function _storeData() { |             $this->_currentCellIsDirty = false; | ||||||
| 		if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { |         } | ||||||
| 			$this->_currentObject->detach(); |         $this->_currentObjectID = $this->_currentObject = null; | ||||||
| 
 |     } | ||||||
| 			if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')")) | 
 | ||||||
| 				throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); |     /** | ||||||
| 			$this->_currentCellIsDirty = false; |      * Add or Update a cell in cache identified by coordinate address | ||||||
| 		} |      * | ||||||
| 		$this->_currentObjectID = $this->_currentObject = null; |      * @param    string            $pCoord        Coordinate address of the cell to update | ||||||
| 	}	//	function _storeData()
 |      * @param    PHPExcel_Cell    $cell        Cell to update | ||||||
| 
 |      * @return    PHPExcel_Cell | ||||||
| 
 |      * @throws    PHPExcel_Exception | ||||||
|     /** |      */ | ||||||
|      * Add or Update a cell in cache identified by coordinate address |     public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||||||
|      * |     { | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to update |         if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { | ||||||
|      * @param	PHPExcel_Cell	$cell		Cell to update |             $this->_storeData(); | ||||||
| 	 * @return	PHPExcel_Cell |         } | ||||||
|      * @throws	PHPExcel_Exception | 
 | ||||||
|      */ |         $this->_currentObjectID = $pCoord; | ||||||
| 	public function addCacheData($pCoord, PHPExcel_Cell $cell) { |         $this->_currentObject = $cell; | ||||||
| 		if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { |         $this->_currentCellIsDirty = true; | ||||||
| 			$this->_storeData(); | 
 | ||||||
| 		} |         return $cell; | ||||||
| 
 |     } | ||||||
| 		$this->_currentObjectID = $pCoord; | 
 | ||||||
| 		$this->_currentObject = $cell; |     /** | ||||||
| 		$this->_currentCellIsDirty = true; |      * Get cell at a specific coordinate | ||||||
| 
 |      * | ||||||
| 		return $cell; |      * @param     string             $pCoord        Coordinate of the cell | ||||||
| 	}	//	function addCacheData()
 |      * @throws     PHPExcel_Exception | ||||||
| 
 |      * @return     PHPExcel_Cell     Cell that was found, or null if not found | ||||||
| 
 |      */ | ||||||
|     /** |     public function getCacheData($pCoord) | ||||||
|      * Get cell at a specific coordinate |     { | ||||||
|      * |         if ($pCoord === $this->_currentObjectID) { | ||||||
|      * @param 	string 			$pCoord		Coordinate of the cell |             return $this->_currentObject; | ||||||
|      * @throws 	PHPExcel_Exception |         } | ||||||
|      * @return 	PHPExcel_Cell 	Cell that was found, or null if not found |         $this->_storeData(); | ||||||
|      */ | 
 | ||||||
| 	public function getCacheData($pCoord) { |         $query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; | ||||||
| 		if ($pCoord === $this->_currentObjectID) { |         $cellResultSet = $this->_DBHandle->query($query, SQLITE_ASSOC); | ||||||
| 			return $this->_currentObject; |         if ($cellResultSet === false) { | ||||||
| 		} |             throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); | ||||||
| 		$this->_storeData(); |         } elseif ($cellResultSet->numRows() == 0) { | ||||||
| 
 |             //    Return null if requested entry doesn't exist in cache
 | ||||||
| 		$query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; |             return null; | ||||||
| 		$cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC); |         } | ||||||
| 		if ($cellResultSet === false) { | 
 | ||||||
| 			throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); |         //    Set current entry to the requested entry
 | ||||||
| 		} elseif ($cellResultSet->numRows() == 0) { |         $this->_currentObjectID = $pCoord; | ||||||
| 			//	Return null if requested entry doesn't exist in cache
 | 
 | ||||||
| 			return null; |         $cellResult = $cellResultSet->fetchSingle(); | ||||||
| 		} |         $this->_currentObject = unserialize($cellResult); | ||||||
| 
 |         //    Re-attach this as the cell's parent
 | ||||||
| 		//	Set current entry to the requested entry
 |         $this->_currentObject->attach($this); | ||||||
| 		$this->_currentObjectID = $pCoord; | 
 | ||||||
| 
 |         //    Return requested entry
 | ||||||
| 		$cellResult = $cellResultSet->fetchSingle(); |         return $this->_currentObject; | ||||||
| 		$this->_currentObject = unserialize($cellResult); |     } | ||||||
|         //    Re-attach this as the cell's parent
 | 
 | ||||||
|         $this->_currentObject->attach($this); |     /** | ||||||
| 
 |      * Is a value set for an indexed cell? | ||||||
| 		//	Return requested entry
 |      * | ||||||
| 		return $this->_currentObject; |      * @param    string        $pCoord        Coordinate address of the cell to check | ||||||
| 	}	//	function getCacheData()
 |      * @return    boolean | ||||||
| 
 |      */ | ||||||
| 
 |     public function isDataSet($pCoord) | ||||||
| 	/** |     { | ||||||
| 	 * Is a value set for an indexed cell? |         if ($pCoord === $this->_currentObjectID) { | ||||||
| 	 * |             return true; | ||||||
| 	 * @param	string		$pCoord		Coordinate address of the cell to check |         } | ||||||
| 	 * @return	boolean | 
 | ||||||
| 	 */ |         //    Check if the requested entry exists in the cache
 | ||||||
| 	public function isDataSet($pCoord) { |         $query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; | ||||||
| 		if ($pCoord === $this->_currentObjectID) { |         $cellResultSet = $this->_DBHandle->query($query, SQLITE_ASSOC); | ||||||
| 			return true; |         if ($cellResultSet === false) { | ||||||
| 		} |             throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); | ||||||
| 
 |         } elseif ($cellResultSet->numRows() == 0) { | ||||||
| 		//	Check if the requested entry exists in the cache
 |             //    Return null if requested entry doesn't exist in cache
 | ||||||
| 		$query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; |             return false; | ||||||
| 		$cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC); |         } | ||||||
| 		if ($cellResultSet === false) { |         return true; | ||||||
| 			throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); |     } | ||||||
| 		} elseif ($cellResultSet->numRows() == 0) { | 
 | ||||||
| 			//	Return null if requested entry doesn't exist in cache
 |     /** | ||||||
| 			return false; |      * Delete a cell in cache identified by coordinate address | ||||||
| 		} |      * | ||||||
| 		return true; |      * @param    string            $pCoord        Coordinate address of the cell to delete | ||||||
| 	}	//	function isDataSet()
 |      * @throws    PHPExcel_Exception | ||||||
| 
 |      */ | ||||||
| 
 |     public function deleteCacheData($pCoord) | ||||||
|     /** |     { | ||||||
|      * Delete a cell in cache identified by coordinate address |         if ($pCoord === $this->_currentObjectID) { | ||||||
|      * |             $this->_currentObject->detach(); | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to delete |             $this->_currentObjectID = $this->_currentObject = null; | ||||||
|      * @throws	PHPExcel_Exception |         } | ||||||
|      */ | 
 | ||||||
| 	public function deleteCacheData($pCoord) { |         //    Check if the requested entry exists in the cache
 | ||||||
| 		if ($pCoord === $this->_currentObjectID) { |         $query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; | ||||||
| 			$this->_currentObject->detach(); |         if (!$this->_DBHandle->queryExec($query)) { | ||||||
| 			$this->_currentObjectID = $this->_currentObject = null; |             throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); | ||||||
| 		} |         } | ||||||
| 
 | 
 | ||||||
| 		//	Check if the requested entry exists in the cache
 |         $this->_currentCellIsDirty = false; | ||||||
| 		$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; |     } | ||||||
| 		if (!$this->_DBHandle->queryExec($query)) | 
 | ||||||
| 			throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); |     /** | ||||||
| 
 |      * Move a cell object from one address to another | ||||||
| 		$this->_currentCellIsDirty = false; |      * | ||||||
| 	}	//	function deleteCacheData()
 |      * @param    string        $fromAddress    Current address of the cell to move | ||||||
| 
 |      * @param    string        $toAddress        Destination address of the cell to move | ||||||
| 
 |      * @return    boolean | ||||||
| 	/** |      */ | ||||||
| 	 * Move a cell object from one address to another |     public function moveCell($fromAddress, $toAddress) | ||||||
| 	 * |     { | ||||||
| 	 * @param	string		$fromAddress	Current address of the cell to move |         if ($fromAddress === $this->_currentObjectID) { | ||||||
| 	 * @param	string		$toAddress		Destination address of the cell to move |             $this->_currentObjectID = $toAddress; | ||||||
| 	 * @return	boolean |         } | ||||||
| 	 */ | 
 | ||||||
| 	public function moveCell($fromAddress, $toAddress) { |         $query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$toAddress."'"; | ||||||
| 		if ($fromAddress === $this->_currentObjectID) { |         $result = $this->_DBHandle->exec($query); | ||||||
| 			$this->_currentObjectID = $toAddress; |         if ($result === false) { | ||||||
| 		} |             throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); | ||||||
| 
 |         } | ||||||
| 		$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$toAddress."'"; | 
 | ||||||
| 		$result = $this->_DBHandle->exec($query); |         $query = "UPDATE kvp_".$this->_TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'"; | ||||||
| 		if ($result === false) |         $result = $this->_DBHandle->exec($query); | ||||||
| 			throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); |         if ($result === false) { | ||||||
| 
 |             throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); | ||||||
| 		$query = "UPDATE kvp_".$this->_TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'"; |         } | ||||||
| 		$result = $this->_DBHandle->exec($query); | 
 | ||||||
| 		if ($result === false) |         return true; | ||||||
| 			throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); |     } | ||||||
| 
 | 
 | ||||||
| 		return TRUE; |     /** | ||||||
| 	}	//	function moveCell()
 |      * Get a list of all cell addresses currently held in cache | ||||||
| 
 |      * | ||||||
| 
 |      * @return    string[] | ||||||
| 	/** |      */ | ||||||
| 	 * Get a list of all cell addresses currently held in cache |     public function getCellList() | ||||||
| 	 * |     { | ||||||
| 	 * @return	string[] |         if ($this->_currentObjectID !== null) { | ||||||
| 	 */ |             $this->_storeData(); | ||||||
| 	public function getCellList() { |         } | ||||||
| 		if ($this->_currentObjectID !== null) { | 
 | ||||||
| 			$this->_storeData(); |         $query = "SELECT id FROM kvp_".$this->_TableName; | ||||||
| 		} |         $cellIdsResult = $this->_DBHandle->unbufferedQuery($query, SQLITE_ASSOC); | ||||||
| 
 |         if ($cellIdsResult === false) { | ||||||
| 		$query = "SELECT id FROM kvp_".$this->_TableName; |             throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); | ||||||
| 		$cellIdsResult = $this->_DBHandle->unbufferedQuery($query,SQLITE_ASSOC); |         } | ||||||
| 		if ($cellIdsResult === false) | 
 | ||||||
| 			throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); |         $cellKeys = array(); | ||||||
| 
 |         foreach ($cellIdsResult as $row) { | ||||||
| 		$cellKeys = array(); |             $cellKeys[] = $row['id']; | ||||||
| 		foreach($cellIdsResult as $row) { |         } | ||||||
| 			$cellKeys[] = $row['id']; | 
 | ||||||
| 		} |         return $cellKeys; | ||||||
| 
 |     } | ||||||
| 		return $cellKeys; | 
 | ||||||
| 	}	//	function getCellList()
 |     /** | ||||||
| 
 |      * Clone the cell collection | ||||||
| 
 |      * | ||||||
| 	/** |      * @param    PHPExcel_Worksheet    $parent        The new worksheet | ||||||
| 	 * Clone the cell collection |      * @return    void | ||||||
| 	 * |      */ | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The new worksheet |     public function copyCellCollection(PHPExcel_Worksheet $parent) | ||||||
| 	 * @return	void |     { | ||||||
| 	 */ |         $this->_currentCellIsDirty; | ||||||
| 	public function copyCellCollection(PHPExcel_Worksheet $parent) { |         $this->_storeData(); | ||||||
| 		$this->_currentCellIsDirty; | 
 | ||||||
|         $this->_storeData(); |         //    Get a new id for the new table name
 | ||||||
| 
 |         $tableName = str_replace('.', '_', $this->_getUniqueID()); | ||||||
| 		//	Get a new id for the new table name
 |         if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) | ||||||
| 		$tableName = str_replace('.','_',$this->_getUniqueID()); |             AS SELECT * FROM kvp_'.$this->_TableName) | ||||||
| 		if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) |         ) { | ||||||
| 													AS SELECT * FROM kvp_'.$this->_TableName)) |             throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); | ||||||
| 			throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); |         } | ||||||
| 
 | 
 | ||||||
| 		//	Copy the existing cell cache file
 |         //    Copy the existing cell cache file
 | ||||||
| 		$this->_TableName = $tableName; |         $this->_TableName = $tableName; | ||||||
| 	}	//	function copyCellCollection()
 |     } | ||||||
| 
 | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Clear the cell collection and disconnect from our parent | ||||||
| 	 * Clear the cell collection and disconnect from our parent |      * | ||||||
| 	 * |      * @return    void | ||||||
| 	 * @return	void |      */ | ||||||
| 	 */ |     public function unsetWorksheetCells() | ||||||
| 	public function unsetWorksheetCells() { |     { | ||||||
| 		if(!is_null($this->_currentObject)) { |         if (!is_null($this->_currentObject)) { | ||||||
| 			$this->_currentObject->detach(); |             $this->_currentObject->detach(); | ||||||
| 			$this->_currentObject = $this->_currentObjectID = null; |             $this->_currentObject = $this->_currentObjectID = null; | ||||||
| 		} |         } | ||||||
| 		//	detach ourself from the worksheet, so that it can then delete this object successfully
 |         //    detach ourself from the worksheet, so that it can then delete this object successfully
 | ||||||
| 		$this->_parent = null; |         $this->_parent = null; | ||||||
| 
 | 
 | ||||||
| 		//	Close down the temporary cache file
 |         //    Close down the temporary cache file
 | ||||||
| 		$this->__destruct(); |         $this->__destruct(); | ||||||
| 	}	//	function unsetWorksheetCells()
 |     } | ||||||
| 
 | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Initialise this new cell collection | ||||||
| 	 * Initialise this new cell collection |      * | ||||||
| 	 * |      * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The worksheet for this cell collection |      */ | ||||||
| 	 */ |     public function __construct(PHPExcel_Worksheet $parent) | ||||||
| 	public function __construct(PHPExcel_Worksheet $parent) { |     { | ||||||
| 		parent::__construct($parent); |         parent::__construct($parent); | ||||||
| 		if (is_null($this->_DBHandle)) { |         if (is_null($this->_DBHandle)) { | ||||||
| 			$this->_TableName = str_replace('.','_',$this->_getUniqueID()); |             $this->_TableName = str_replace('.', '_', $this->_getUniqueID()); | ||||||
| 			$_DBName = ':memory:'; |             $_DBName = ':memory:'; | ||||||
| 
 | 
 | ||||||
| 			$this->_DBHandle = new SQLiteDatabase($_DBName); |             $this->_DBHandle = new SQLiteDatabase($_DBName); | ||||||
| 			if ($this->_DBHandle === false) |             if ($this->_DBHandle === false) { | ||||||
| 				throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); |                 throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); | ||||||
| 			if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) |             } | ||||||
| 				throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); |             if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) { | ||||||
| 		} |                 throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); | ||||||
| 	}	//	function __construct()
 |             } | ||||||
| 
 |         } | ||||||
| 
 |     } | ||||||
| 	/** | 
 | ||||||
| 	 * Destroy this cell collection |     /** | ||||||
| 	 */ |      * Destroy this cell collection | ||||||
| 	public function __destruct() { |      */ | ||||||
| 		if (!is_null($this->_DBHandle)) { |     public function __destruct() | ||||||
| 			$this->_DBHandle->queryExec('DROP TABLE kvp_'.$this->_TableName); |     { | ||||||
| 		} |         if (!is_null($this->_DBHandle)) { | ||||||
| 		$this->_DBHandle = null; |             $this->_DBHandle->queryExec('DROP TABLE kvp_'.$this->_TableName); | ||||||
| 	}	//	function __destruct()
 |         } | ||||||
| 
 |         $this->_DBHandle = null; | ||||||
| 
 |     } | ||||||
| 	/** | 
 | ||||||
| 	 * Identify whether the caching method is currently available |     /** | ||||||
| 	 * Some methods are dependent on the availability of certain extensions being enabled in the PHP build |      * Identify whether the caching method is currently available | ||||||
| 	 * |      * Some methods are dependent on the availability of certain extensions being enabled in the PHP build | ||||||
| 	 * @return	boolean |      * | ||||||
| 	 */ |      * @return    boolean | ||||||
| 	public static function cacheMethodIsAvailable() { |      */ | ||||||
| 		if (!function_exists('sqlite_open')) { |     public static function cacheMethodIsAvailable() | ||||||
| 			return false; |     { | ||||||
| 		} |         if (!function_exists('sqlite_open')) { | ||||||
| 
 |             return false; | ||||||
| 		return true; |         } | ||||||
| 	} | 
 | ||||||
| 
 |         return true; | ||||||
| } |     } | ||||||
|  | } | ||||||
|  | |||||||
| @ -1,345 +1,346 @@ | |||||||
| <?php | <?php | ||||||
| /** | 
 | ||||||
|  * PHPExcel | /** | ||||||
|  * |  * PHPExcel_CachedObjectStorage_SQLite3 | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * | ||||||
|  * |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * This library is free software; you can redistribute it and/or |  * | ||||||
|  * modify it under the terms of the GNU Lesser General Public |  * This library is free software; you can redistribute it and/or | ||||||
|  * License as published by the Free Software Foundation; either |  * modify it under the terms of the GNU Lesser General Public | ||||||
|  * version 2.1 of the License, or (at your option) any later version. |  * License as published by the Free Software Foundation; either | ||||||
|  * |  * version 2.1 of the License, or (at your option) any later version. | ||||||
|  * This library is distributed in the hope that it will be useful, |  * | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  * This library is distributed in the hope that it will be useful, | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  * Lesser General Public License for more details. |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||||
|  * |  * Lesser General Public License for more details. | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * | ||||||
|  * License along with this library; if not, write to the Free Software |  * You should have received a copy of the GNU Lesser General Public | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA |  * License along with this library; if not, write to the Free Software | ||||||
|  * |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | ||||||
|  * @category   PHPExcel |  * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |  * @category   PHPExcel | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @package    PHPExcel_CachedObjectStorage | ||||||
|  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @version    ##VERSION##, ##DATE##
 |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  */ |  * @version    ##VERSION##, ##DATE##
 | ||||||
| 
 |  */ | ||||||
| 
 | class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||||||
| /** | { | ||||||
|  * PHPExcel_CachedObjectStorage_SQLite3 |     /** | ||||||
|  * |      * Database table name | ||||||
|  * @category   PHPExcel |      * | ||||||
|  * @package    PHPExcel_CachedObjectStorage |      * @var string | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |      */ | ||||||
|  */ |     private $_TableName = null; | ||||||
| class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Database handle | ||||||
| 	 * Database table name |      * | ||||||
| 	 * |      * @var resource | ||||||
| 	 * @var string |      */ | ||||||
| 	 */ |     private $_DBHandle = null; | ||||||
| 	private $_TableName = null; | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Prepared statement for a SQLite3 select query | ||||||
| 	 * Database handle |      * | ||||||
| 	 * |      * @var SQLite3Stmt | ||||||
| 	 * @var resource |      */ | ||||||
| 	 */ |     private $_selectQuery; | ||||||
| 	private $_DBHandle = null; | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Prepared statement for a SQLite3 insert query | ||||||
| 	 * Prepared statement for a SQLite3 select query |      * | ||||||
| 	 * |      * @var SQLite3Stmt | ||||||
| 	 * @var SQLite3Stmt |      */ | ||||||
| 	 */ |     private $_insertQuery; | ||||||
| 	private $_selectQuery; | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Prepared statement for a SQLite3 update query | ||||||
| 	 * Prepared statement for a SQLite3 insert query |      * | ||||||
| 	 * |      * @var SQLite3Stmt | ||||||
| 	 * @var SQLite3Stmt |      */ | ||||||
| 	 */ |     private $_updateQuery; | ||||||
| 	private $_insertQuery; | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Prepared statement for a SQLite3 delete query | ||||||
| 	 * Prepared statement for a SQLite3 update query |      * | ||||||
| 	 * |      * @var SQLite3Stmt | ||||||
| 	 * @var SQLite3Stmt |      */ | ||||||
| 	 */ |     private $_deleteQuery; | ||||||
| 	private $_updateQuery; | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Store cell data in cache for the current cell object if it's "dirty", | ||||||
| 	 * Prepared statement for a SQLite3 delete query |      *     and the 'nullify' the current cell object | ||||||
| 	 * |      * | ||||||
| 	 * @var SQLite3Stmt |      * @return    void | ||||||
| 	 */ |      * @throws    PHPExcel_Exception | ||||||
| 	private $_deleteQuery; |      */ | ||||||
| 
 |     protected function _storeData() | ||||||
|     /** |     { | ||||||
|      * Store cell data in cache for the current cell object if it's "dirty", |         if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { | ||||||
|      *     and the 'nullify' the current cell object |             $this->_currentObject->detach(); | ||||||
|      * | 
 | ||||||
| 	 * @return	void |             $this->_insertQuery->bindValue('id', $this->_currentObjectID, SQLITE3_TEXT); | ||||||
|      * @throws	PHPExcel_Exception |             $this->_insertQuery->bindValue('data', serialize($this->_currentObject), SQLITE3_BLOB); | ||||||
|      */ |             $result = $this->_insertQuery->execute(); | ||||||
| 	protected function _storeData() { |             if ($result === false) { | ||||||
| 		if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { |                 throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); | ||||||
| 			$this->_currentObject->detach(); |             } | ||||||
| 
 |             $this->_currentCellIsDirty = false; | ||||||
| 			$this->_insertQuery->bindValue('id',$this->_currentObjectID,SQLITE3_TEXT); |         } | ||||||
| 			$this->_insertQuery->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB); |         $this->_currentObjectID = $this->_currentObject = null; | ||||||
| 			$result = $this->_insertQuery->execute(); |     } | ||||||
| 			if ($result === false) | 
 | ||||||
| 				throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); |     /** | ||||||
| 			$this->_currentCellIsDirty = false; |      * Add or Update a cell in cache identified by coordinate address | ||||||
| 		} |      * | ||||||
| 		$this->_currentObjectID = $this->_currentObject = null; |      * @param    string            $pCoord        Coordinate address of the cell to update | ||||||
| 	}	//	function _storeData()
 |      * @param    PHPExcel_Cell    $cell        Cell to update | ||||||
| 
 |      * @return    PHPExcel_Cell | ||||||
| 
 |      * @throws    PHPExcel_Exception | ||||||
|     /** |      */ | ||||||
|      * Add or Update a cell in cache identified by coordinate address |     public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||||||
|      * |     { | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to update |         if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { | ||||||
|      * @param	PHPExcel_Cell	$cell		Cell to update |             $this->_storeData(); | ||||||
| 	 * @return	PHPExcel_Cell |         } | ||||||
|      * @throws	PHPExcel_Exception | 
 | ||||||
|      */ |         $this->_currentObjectID = $pCoord; | ||||||
| 	public function addCacheData($pCoord, PHPExcel_Cell $cell) { |         $this->_currentObject = $cell; | ||||||
| 		if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { |         $this->_currentCellIsDirty = true; | ||||||
| 			$this->_storeData(); | 
 | ||||||
| 		} |         return $cell; | ||||||
| 
 |     } | ||||||
| 		$this->_currentObjectID = $pCoord; | 
 | ||||||
| 		$this->_currentObject = $cell; |     /** | ||||||
| 		$this->_currentCellIsDirty = true; |      * Get cell at a specific coordinate | ||||||
| 
 |      * | ||||||
| 		return $cell; |      * @param     string             $pCoord        Coordinate of the cell | ||||||
| 	}	//	function addCacheData()
 |      * @throws     PHPExcel_Exception | ||||||
| 
 |      * @return     PHPExcel_Cell     Cell that was found, or null if not found | ||||||
| 
 |      */ | ||||||
|     /** |     public function getCacheData($pCoord) | ||||||
|      * Get cell at a specific coordinate |     { | ||||||
|      * |         if ($pCoord === $this->_currentObjectID) { | ||||||
|      * @param 	string 			$pCoord		Coordinate of the cell |             return $this->_currentObject; | ||||||
|      * @throws 	PHPExcel_Exception |         } | ||||||
|      * @return 	PHPExcel_Cell 	Cell that was found, or null if not found |         $this->_storeData(); | ||||||
|      */ | 
 | ||||||
| 	public function getCacheData($pCoord) { |         $this->_selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT); | ||||||
| 		if ($pCoord === $this->_currentObjectID) { |         $cellResult = $this->_selectQuery->execute(); | ||||||
| 			return $this->_currentObject; |         if ($cellResult === false) { | ||||||
| 		} |             throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); | ||||||
| 		$this->_storeData(); |         } | ||||||
| 
 |         $cellData = $cellResult->fetchArray(SQLITE3_ASSOC); | ||||||
| 		$this->_selectQuery->bindValue('id',$pCoord,SQLITE3_TEXT); |         if ($cellData === false) { | ||||||
| 		$cellResult = $this->_selectQuery->execute(); |             //    Return null if requested entry doesn't exist in cache
 | ||||||
| 		if ($cellResult === FALSE) { |             return null; | ||||||
| 			throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); |         } | ||||||
| 		} | 
 | ||||||
| 		$cellData = $cellResult->fetchArray(SQLITE3_ASSOC); |         //    Set current entry to the requested entry
 | ||||||
| 		if ($cellData === FALSE) { |         $this->_currentObjectID = $pCoord; | ||||||
| 			//	Return null if requested entry doesn't exist in cache
 | 
 | ||||||
| 			return NULL; |         $this->_currentObject = unserialize($cellData['value']); | ||||||
| 		} |         //    Re-attach this as the cell's parent
 | ||||||
| 
 |         $this->_currentObject->attach($this); | ||||||
| 		//	Set current entry to the requested entry
 | 
 | ||||||
| 		$this->_currentObjectID = $pCoord; |         //    Return requested entry
 | ||||||
| 
 |         return $this->_currentObject; | ||||||
| 		$this->_currentObject = unserialize($cellData['value']); |     } | ||||||
|         //    Re-attach this as the cell's parent
 | 
 | ||||||
|         $this->_currentObject->attach($this); |     /** | ||||||
| 
 |      *    Is a value set for an indexed cell? | ||||||
| 		//	Return requested entry
 |      * | ||||||
| 		return $this->_currentObject; |      * @param    string        $pCoord        Coordinate address of the cell to check | ||||||
| 	}	//	function getCacheData()
 |      * @return    boolean | ||||||
| 
 |      */ | ||||||
| 
 |     public function isDataSet($pCoord) | ||||||
| 	/** |     { | ||||||
| 	 *	Is a value set for an indexed cell? |         if ($pCoord === $this->_currentObjectID) { | ||||||
| 	 * |             return true; | ||||||
| 	 * @param	string		$pCoord		Coordinate address of the cell to check |         } | ||||||
| 	 * @return	boolean | 
 | ||||||
| 	 */ |         //    Check if the requested entry exists in the cache
 | ||||||
| 	public function isDataSet($pCoord) { |         $this->_selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT); | ||||||
| 		if ($pCoord === $this->_currentObjectID) { |         $cellResult = $this->_selectQuery->execute(); | ||||||
| 			return TRUE; |         if ($cellResult === false) { | ||||||
| 		} |             throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); | ||||||
| 
 |         } | ||||||
| 		//	Check if the requested entry exists in the cache
 |         $cellData = $cellResult->fetchArray(SQLITE3_ASSOC); | ||||||
| 		$this->_selectQuery->bindValue('id',$pCoord,SQLITE3_TEXT); | 
 | ||||||
| 		$cellResult = $this->_selectQuery->execute(); |         return ($cellData === false) ? false : true; | ||||||
| 		if ($cellResult === FALSE) { |     } | ||||||
| 			throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); | 
 | ||||||
| 		} |     /** | ||||||
| 		$cellData = $cellResult->fetchArray(SQLITE3_ASSOC); |      *    Delete a cell in cache identified by coordinate address | ||||||
| 
 |      * | ||||||
| 		return ($cellData === FALSE) ? FALSE : TRUE; |      * @param    string            $pCoord        Coordinate address of the cell to delete | ||||||
| 	}	//	function isDataSet()
 |      * @throws    PHPExcel_Exception | ||||||
| 
 |      */ | ||||||
| 
 |     public function deleteCacheData($pCoord) | ||||||
|     /** |     { | ||||||
|      *	Delete a cell in cache identified by coordinate address |         if ($pCoord === $this->_currentObjectID) { | ||||||
|      * |             $this->_currentObject->detach(); | ||||||
|      * @param	string			$pCoord		Coordinate address of the cell to delete |             $this->_currentObjectID = $this->_currentObject = null; | ||||||
|      * @throws	PHPExcel_Exception |         } | ||||||
|      */ | 
 | ||||||
| 	public function deleteCacheData($pCoord) { |         //    Check if the requested entry exists in the cache
 | ||||||
| 		if ($pCoord === $this->_currentObjectID) { |         $this->_deleteQuery->bindValue('id', $pCoord, SQLITE3_TEXT); | ||||||
| 			$this->_currentObject->detach(); |         $result = $this->_deleteQuery->execute(); | ||||||
| 			$this->_currentObjectID = $this->_currentObject = NULL; |         if ($result === false) { | ||||||
| 		} |             throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); | ||||||
| 
 |         } | ||||||
| 		//	Check if the requested entry exists in the cache
 | 
 | ||||||
| 		$this->_deleteQuery->bindValue('id',$pCoord,SQLITE3_TEXT); |         $this->_currentCellIsDirty = false; | ||||||
| 		$result = $this->_deleteQuery->execute(); |     } | ||||||
| 		if ($result === FALSE) | 
 | ||||||
| 			throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); |     /** | ||||||
| 
 |      * Move a cell object from one address to another | ||||||
| 		$this->_currentCellIsDirty = FALSE; |      * | ||||||
| 	}	//	function deleteCacheData()
 |      * @param    string        $fromAddress    Current address of the cell to move | ||||||
| 
 |      * @param    string        $toAddress        Destination address of the cell to move | ||||||
| 
 |      * @return    boolean | ||||||
| 	/** |      */ | ||||||
| 	 * Move a cell object from one address to another |     public function moveCell($fromAddress, $toAddress) | ||||||
| 	 * |     { | ||||||
| 	 * @param	string		$fromAddress	Current address of the cell to move |         if ($fromAddress === $this->_currentObjectID) { | ||||||
| 	 * @param	string		$toAddress		Destination address of the cell to move |             $this->_currentObjectID = $toAddress; | ||||||
| 	 * @return	boolean |         } | ||||||
| 	 */ | 
 | ||||||
| 	public function moveCell($fromAddress, $toAddress) { |         $this->_deleteQuery->bindValue('id', $toAddress, SQLITE3_TEXT); | ||||||
| 		if ($fromAddress === $this->_currentObjectID) { |         $result = $this->_deleteQuery->execute(); | ||||||
| 			$this->_currentObjectID = $toAddress; |         if ($result === false) { | ||||||
| 		} |             throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); | ||||||
| 
 |         } | ||||||
| 		$this->_deleteQuery->bindValue('id',$toAddress,SQLITE3_TEXT); | 
 | ||||||
| 		$result = $this->_deleteQuery->execute(); |         $this->_updateQuery->bindValue('toid', $toAddress, SQLITE3_TEXT); | ||||||
| 		if ($result === false) |         $this->_updateQuery->bindValue('fromid', $fromAddress, SQLITE3_TEXT); | ||||||
| 			throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); |         $result = $this->_updateQuery->execute(); | ||||||
| 
 |         if ($result === false) { | ||||||
| 		$this->_updateQuery->bindValue('toid',$toAddress,SQLITE3_TEXT); |             throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); | ||||||
| 		$this->_updateQuery->bindValue('fromid',$fromAddress,SQLITE3_TEXT); |         } | ||||||
| 		$result = $this->_updateQuery->execute(); | 
 | ||||||
| 		if ($result === false) |         return true; | ||||||
| 			throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); |     } | ||||||
| 
 | 
 | ||||||
| 		return TRUE; |     /** | ||||||
| 	}	//	function moveCell()
 |      * Get a list of all cell addresses currently held in cache | ||||||
| 
 |      * | ||||||
| 
 |      * @return    string[] | ||||||
| 	/** |      */ | ||||||
| 	 * Get a list of all cell addresses currently held in cache |     public function getCellList() | ||||||
| 	 * |     { | ||||||
| 	 * @return	string[] |         if ($this->_currentObjectID !== null) { | ||||||
| 	 */ |             $this->_storeData(); | ||||||
| 	public function getCellList() { |         } | ||||||
| 		if ($this->_currentObjectID !== null) { | 
 | ||||||
| 			$this->_storeData(); |         $query = "SELECT id FROM kvp_".$this->_TableName; | ||||||
| 		} |         $cellIdsResult = $this->_DBHandle->query($query); | ||||||
| 
 |         if ($cellIdsResult === false) { | ||||||
| 		$query = "SELECT id FROM kvp_".$this->_TableName; |             throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); | ||||||
| 		$cellIdsResult = $this->_DBHandle->query($query); |         } | ||||||
| 		if ($cellIdsResult === false) | 
 | ||||||
| 			throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); |         $cellKeys = array(); | ||||||
| 
 |         while ($row = $cellIdsResult->fetchArray(SQLITE3_ASSOC)) { | ||||||
| 		$cellKeys = array(); |             $cellKeys[] = $row['id']; | ||||||
| 		while ($row = $cellIdsResult->fetchArray(SQLITE3_ASSOC)) { |         } | ||||||
| 			$cellKeys[] = $row['id']; | 
 | ||||||
| 		} |         return $cellKeys; | ||||||
| 
 |     } | ||||||
| 		return $cellKeys; | 
 | ||||||
| 	}	//	function getCellList()
 |     /** | ||||||
| 
 |      * Clone the cell collection | ||||||
| 
 |      * | ||||||
| 	/** |      * @param    PHPExcel_Worksheet    $parent        The new worksheet | ||||||
| 	 * Clone the cell collection |      * @return    void | ||||||
| 	 * |      */ | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The new worksheet |     public function copyCellCollection(PHPExcel_Worksheet $parent) | ||||||
| 	 * @return	void |     { | ||||||
| 	 */ |         $this->_currentCellIsDirty; | ||||||
| 	public function copyCellCollection(PHPExcel_Worksheet $parent) { |         $this->_storeData(); | ||||||
| 		$this->_currentCellIsDirty; | 
 | ||||||
|         $this->_storeData(); |         //    Get a new id for the new table name
 | ||||||
| 
 |         $tableName = str_replace('.', '_', $this->_getUniqueID()); | ||||||
| 		//	Get a new id for the new table name
 |         if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) | ||||||
| 		$tableName = str_replace('.','_',$this->_getUniqueID()); |             AS SELECT * FROM kvp_'.$this->_TableName) | ||||||
| 		if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) |         ) { | ||||||
| 		                                       AS SELECT * FROM kvp_'.$this->_TableName)) |             throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); | ||||||
| 			throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); |         } | ||||||
| 
 | 
 | ||||||
| 		//	Copy the existing cell cache file
 |         //    Copy the existing cell cache file
 | ||||||
| 		$this->_TableName = $tableName; |         $this->_TableName = $tableName; | ||||||
| 	}	//	function copyCellCollection()
 |     } | ||||||
| 
 | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Clear the cell collection and disconnect from our parent | ||||||
| 	 * Clear the cell collection and disconnect from our parent |      * | ||||||
| 	 * |      * @return    void | ||||||
| 	 * @return	void |      */ | ||||||
| 	 */ |     public function unsetWorksheetCells() | ||||||
| 	public function unsetWorksheetCells() { |     { | ||||||
| 		if(!is_null($this->_currentObject)) { |         if (!is_null($this->_currentObject)) { | ||||||
| 			$this->_currentObject->detach(); |             $this->_currentObject->detach(); | ||||||
| 			$this->_currentObject = $this->_currentObjectID = null; |             $this->_currentObject = $this->_currentObjectID = null; | ||||||
| 		} |         } | ||||||
| 		//	detach ourself from the worksheet, so that it can then delete this object successfully
 |         //    detach ourself from the worksheet, so that it can then delete this object successfully
 | ||||||
| 		$this->_parent = null; |         $this->_parent = null; | ||||||
| 
 | 
 | ||||||
| 		//	Close down the temporary cache file
 |         //    Close down the temporary cache file
 | ||||||
| 		$this->__destruct(); |         $this->__destruct(); | ||||||
| 	}	//	function unsetWorksheetCells()
 |     } | ||||||
| 
 | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Initialise this new cell collection | ||||||
| 	 * Initialise this new cell collection |      * | ||||||
| 	 * |      * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The worksheet for this cell collection |      */ | ||||||
| 	 */ |     public function __construct(PHPExcel_Worksheet $parent) | ||||||
| 	public function __construct(PHPExcel_Worksheet $parent) { |     { | ||||||
| 		parent::__construct($parent); |         parent::__construct($parent); | ||||||
| 		if (is_null($this->_DBHandle)) { |         if (is_null($this->_DBHandle)) { | ||||||
| 			$this->_TableName = str_replace('.','_',$this->_getUniqueID()); |             $this->_TableName = str_replace('.', '_', $this->_getUniqueID()); | ||||||
| 			$_DBName = ':memory:'; |             $_DBName = ':memory:'; | ||||||
| 
 | 
 | ||||||
| 			$this->_DBHandle = new SQLite3($_DBName); |             $this->_DBHandle = new SQLite3($_DBName); | ||||||
| 			if ($this->_DBHandle === false) |             if ($this->_DBHandle === false) { | ||||||
| 				throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); |                 throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); | ||||||
| 			if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) |             } | ||||||
| 				throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); |             if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) { | ||||||
| 		} |                 throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); | ||||||
| 
 |             } | ||||||
| 		$this->_selectQuery = $this->_DBHandle->prepare("SELECT value FROM kvp_".$this->_TableName." WHERE id = :id"); |         } | ||||||
| 		$this->_insertQuery = $this->_DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES(:id,:data)"); | 
 | ||||||
| 		$this->_updateQuery = $this->_DBHandle->prepare("UPDATE kvp_".$this->_TableName." SET id=:toId WHERE id=:fromId"); |         $this->_selectQuery = $this->_DBHandle->prepare("SELECT value FROM kvp_".$this->_TableName." WHERE id = :id"); | ||||||
| 		$this->_deleteQuery = $this->_DBHandle->prepare("DELETE FROM kvp_".$this->_TableName." WHERE id = :id"); |         $this->_insertQuery = $this->_DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES(:id,:data)"); | ||||||
| 	}	//	function __construct()
 |         $this->_updateQuery = $this->_DBHandle->prepare("UPDATE kvp_".$this->_TableName." SET id=:toId WHERE id=:fromId"); | ||||||
| 
 |         $this->_deleteQuery = $this->_DBHandle->prepare("DELETE FROM kvp_".$this->_TableName." WHERE id = :id"); | ||||||
| 
 |     } | ||||||
| 	/** | 
 | ||||||
| 	 * Destroy this cell collection |     /** | ||||||
| 	 */ |      * Destroy this cell collection | ||||||
| 	public function __destruct() { |      */ | ||||||
| 		if (!is_null($this->_DBHandle)) { |     public function __destruct() | ||||||
| 			$this->_DBHandle->exec('DROP TABLE kvp_'.$this->_TableName); |     { | ||||||
| 			$this->_DBHandle->close(); |         if (!is_null($this->_DBHandle)) { | ||||||
| 		} |             $this->_DBHandle->exec('DROP TABLE kvp_'.$this->_TableName); | ||||||
| 		$this->_DBHandle = null; |             $this->_DBHandle->close(); | ||||||
| 	}	//	function __destruct()
 |         } | ||||||
| 
 |         $this->_DBHandle = null; | ||||||
| 
 |     } | ||||||
| 	/** | 
 | ||||||
| 	 * Identify whether the caching method is currently available |     /** | ||||||
| 	 * Some methods are dependent on the availability of certain extensions being enabled in the PHP build |      * Identify whether the caching method is currently available | ||||||
| 	 * |      * Some methods are dependent on the availability of certain extensions being enabled in the PHP build | ||||||
| 	 * @return	boolean |      * | ||||||
| 	 */ |      * @return    boolean | ||||||
| 	public static function cacheMethodIsAvailable() { |      */ | ||||||
| 		if (!class_exists('SQLite3',FALSE)) { |     public static function cacheMethodIsAvailable() | ||||||
| 			return false; |     { | ||||||
| 		} |         if (!class_exists('SQLite3', false)) { | ||||||
| 
 |             return false; | ||||||
| 		return true; |         } | ||||||
| 	} | 
 | ||||||
| 
 |         return true; | ||||||
| } |     } | ||||||
|  | } | ||||||
|  | |||||||
| @ -1,294 +1,289 @@ | |||||||
| <?php | <?php | ||||||
| /** | 
 | ||||||
|  * PHPExcel | /** | ||||||
|  * |  * PHPExcel_CachedObjectStorage_Wincache | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * | ||||||
|  * |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * This library is free software; you can redistribute it and/or |  * | ||||||
|  * modify it under the terms of the GNU Lesser General Public |  * This library is free software; you can redistribute it and/or | ||||||
|  * License as published by the Free Software Foundation; either |  * modify it under the terms of the GNU Lesser General Public | ||||||
|  * version 2.1 of the License, or (at your option) any later version. |  * License as published by the Free Software Foundation; either | ||||||
|  * |  * version 2.1 of the License, or (at your option) any later version. | ||||||
|  * This library is distributed in the hope that it will be useful, |  * | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  * This library is distributed in the hope that it will be useful, | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  * Lesser General Public License for more details. |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||||
|  * |  * Lesser General Public License for more details. | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * | ||||||
|  * License along with this library; if not, write to the Free Software |  * You should have received a copy of the GNU Lesser General Public | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA |  * License along with this library; if not, write to the Free Software | ||||||
|  * |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | ||||||
|  * @category   PHPExcel |  * | ||||||
|  * @package	PHPExcel_CachedObjectStorage |  * @category   PHPExcel | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @package    PHPExcel_CachedObjectStorage | ||||||
|  * @license	http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @version	##VERSION##, ##DATE##
 |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  */ |  * @version    ##VERSION##, ##DATE##
 | ||||||
| 
 |  */ | ||||||
| 
 | class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||||||
| /** | { | ||||||
|  * PHPExcel_CachedObjectStorage_Wincache |     /** | ||||||
|  * |      * Prefix used to uniquely identify cache data for this worksheet | ||||||
|  * @category   PHPExcel |      * | ||||||
|  * @package	PHPExcel_CachedObjectStorage |      * @var string | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |      */ | ||||||
|  */ |     private $_cachePrefix = null; | ||||||
| class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { | 
 | ||||||
| 
 |     /** | ||||||
| 	/** |      * Cache timeout | ||||||
| 	 * Prefix used to uniquely identify cache data for this worksheet |      * | ||||||
| 	 * |      * @var integer | ||||||
| 	 * @var string |      */ | ||||||
| 	 */ |     private $_cacheTime = 600; | ||||||
| 	private $_cachePrefix = null; | 
 | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Cache timeout |      * Store cell data in cache for the current cell object if it's "dirty", | ||||||
| 	 * |      *     and the 'nullify' the current cell object | ||||||
| 	 * @var integer |      * | ||||||
| 	 */ |      * @return    void | ||||||
| 	private $_cacheTime = 600; |      * @throws    PHPExcel_Exception | ||||||
| 
 |      */ | ||||||
| 
 |     protected function _storeData() | ||||||
|     /** |     { | ||||||
|      * Store cell data in cache for the current cell object if it's "dirty", |         if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { | ||||||
|      *     and the 'nullify' the current cell object |             $this->_currentObject->detach(); | ||||||
|      * | 
 | ||||||
| 	 * @return	void |             $obj = serialize($this->_currentObject); | ||||||
|      * @throws	PHPExcel_Exception |             if (wincache_ucache_exists($this->_cachePrefix.$this->_currentObjectID.'.cache')) { | ||||||
|      */ |                 if (!wincache_ucache_set($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) { | ||||||
| 	protected function _storeData() { |                     $this->__destruct(); | ||||||
| 		if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { |                     throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); | ||||||
| 			$this->_currentObject->detach(); |                 } | ||||||
| 
 |             } else { | ||||||
| 			$obj = serialize($this->_currentObject); |                 if (!wincache_ucache_add($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) { | ||||||
| 			if (wincache_ucache_exists($this->_cachePrefix.$this->_currentObjectID.'.cache')) { |                     $this->__destruct(); | ||||||
| 				if (!wincache_ucache_set($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) { |                     throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); | ||||||
| 					$this->__destruct(); |                 } | ||||||
| 					throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); |             } | ||||||
| 				} |             $this->_currentCellIsDirty = false; | ||||||
| 			} else { |         } | ||||||
| 				if (!wincache_ucache_add($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) { | 
 | ||||||
| 					$this->__destruct(); |         $this->_currentObjectID = $this->_currentObject = null; | ||||||
| 					throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); |     } | ||||||
| 				} | 
 | ||||||
| 			} |     /** | ||||||
| 			$this->_currentCellIsDirty = false; |      * Add or Update a cell in cache identified by coordinate address | ||||||
| 		} |      * | ||||||
| 
 |      * @param    string            $pCoord        Coordinate address of the cell to update | ||||||
| 		$this->_currentObjectID = $this->_currentObject = null; |      * @param    PHPExcel_Cell    $cell        Cell to update | ||||||
| 	}	//	function _storeData()
 |      * @return    PHPExcel_Cell | ||||||
| 
 |      * @throws    PHPExcel_Exception | ||||||
| 
 |      */ | ||||||
| 	/** |     public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||||||
| 	 * Add or Update a cell in cache identified by coordinate address |     { | ||||||
| 	 * |         if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { | ||||||
| 	 * @param	string			$pCoord		Coordinate address of the cell to update |             $this->_storeData(); | ||||||
| 	 * @param	PHPExcel_Cell	$cell		Cell to update |         } | ||||||
| 	 * @return	PHPExcel_Cell |         $this->_cellCache[$pCoord] = true; | ||||||
| 	 * @throws	PHPExcel_Exception | 
 | ||||||
| 	 */ |         $this->_currentObjectID = $pCoord; | ||||||
| 	public function addCacheData($pCoord, PHPExcel_Cell $cell) { |         $this->_currentObject = $cell; | ||||||
| 		if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { |         $this->_currentCellIsDirty = true; | ||||||
| 			$this->_storeData(); | 
 | ||||||
| 		} |         return $cell; | ||||||
| 		$this->_cellCache[$pCoord] = true; |     } | ||||||
| 
 | 
 | ||||||
| 		$this->_currentObjectID = $pCoord; |     /** | ||||||
| 		$this->_currentObject = $cell; |      * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? | ||||||
| 		$this->_currentCellIsDirty = true; |      * | ||||||
| 
 |      * @param    string        $pCoord        Coordinate address of the cell to check | ||||||
| 		return $cell; |      * @return    boolean | ||||||
| 	}	//	function addCacheData()
 |      */ | ||||||
| 
 |     public function isDataSet($pCoord) | ||||||
| 
 |     { | ||||||
| 	/** |         //    Check if the requested entry is the current object, or exists in the cache
 | ||||||
| 	 * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? |         if (parent::isDataSet($pCoord)) { | ||||||
| 	 * |             if ($this->_currentObjectID == $pCoord) { | ||||||
| 	 * @param	string		$pCoord		Coordinate address of the cell to check |                 return true; | ||||||
| 	 * @return	boolean |             } | ||||||
| 	 */ |             //    Check if the requested entry still exists in cache
 | ||||||
| 	public function isDataSet($pCoord) { |             $success = wincache_ucache_exists($this->_cachePrefix.$pCoord.'.cache'); | ||||||
| 		//	Check if the requested entry is the current object, or exists in the cache
 |             if ($success === false) { | ||||||
| 		if (parent::isDataSet($pCoord)) { |                 //    Entry no longer exists in Wincache, so clear it from the cache array
 | ||||||
| 			if ($this->_currentObjectID == $pCoord) { |                 parent::deleteCacheData($pCoord); | ||||||
| 				return true; |                 throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); | ||||||
| 			} |             } | ||||||
| 			//	Check if the requested entry still exists in cache
 |             return true; | ||||||
| 			$success = wincache_ucache_exists($this->_cachePrefix.$pCoord.'.cache'); |         } | ||||||
| 			if ($success === false) { |         return false; | ||||||
| 				//	Entry no longer exists in Wincache, so clear it from the cache array
 |     } | ||||||
| 				parent::deleteCacheData($pCoord); | 
 | ||||||
| 				throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); | 
 | ||||||
| 			} |     /** | ||||||
| 			return true; |      * Get cell at a specific coordinate | ||||||
| 		} |      * | ||||||
| 		return false; |      * @param    string            $pCoord        Coordinate of the cell | ||||||
| 	}	//	function isDataSet()
 |      * @throws    PHPExcel_Exception | ||||||
| 
 |      * @return    PHPExcel_Cell    Cell that was found, or null if not found | ||||||
| 
 |      */ | ||||||
| 	/** |     public function getCacheData($pCoord) | ||||||
| 	 * Get cell at a specific coordinate |     { | ||||||
| 	 * |         if ($pCoord === $this->_currentObjectID) { | ||||||
| 	 * @param	string			$pCoord		Coordinate of the cell |             return $this->_currentObject; | ||||||
| 	 * @throws	PHPExcel_Exception |         } | ||||||
| 	 * @return	PHPExcel_Cell	Cell that was found, or null if not found |         $this->_storeData(); | ||||||
| 	 */ | 
 | ||||||
| 	public function getCacheData($pCoord) { |         //    Check if the entry that has been requested actually exists
 | ||||||
| 		if ($pCoord === $this->_currentObjectID) { |         $obj = null; | ||||||
| 			return $this->_currentObject; |         if (parent::isDataSet($pCoord)) { | ||||||
| 		} |             $success = false; | ||||||
| 		$this->_storeData(); |             $obj = wincache_ucache_get($this->_cachePrefix.$pCoord.'.cache', $success); | ||||||
| 
 |             if ($success === false) { | ||||||
| 		//	Check if the entry that has been requested actually exists
 |                 //    Entry no longer exists in WinCache, so clear it from the cache array
 | ||||||
| 		$obj = null; |                 parent::deleteCacheData($pCoord); | ||||||
| 		if (parent::isDataSet($pCoord)) { |                 throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); | ||||||
| 			$success = false; |             } | ||||||
| 			$obj = wincache_ucache_get($this->_cachePrefix.$pCoord.'.cache', $success); |         } else { | ||||||
| 			if ($success === false) { |             //    Return null if requested entry doesn't exist in cache
 | ||||||
| 				//	Entry no longer exists in WinCache, so clear it from the cache array
 |             return null; | ||||||
| 				parent::deleteCacheData($pCoord); |         } | ||||||
| 				throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); | 
 | ||||||
| 			} |         //    Set current entry to the requested entry
 | ||||||
| 		} else { |         $this->_currentObjectID = $pCoord; | ||||||
| 			//	Return null if requested entry doesn't exist in cache
 |         $this->_currentObject = unserialize($obj); | ||||||
| 			return null; |         //    Re-attach this as the cell's parent
 | ||||||
| 		} |         $this->_currentObject->attach($this); | ||||||
| 
 | 
 | ||||||
| 		//	Set current entry to the requested entry
 |         //    Return requested entry
 | ||||||
| 		$this->_currentObjectID = $pCoord; |         return $this->_currentObject; | ||||||
| 		$this->_currentObject = unserialize($obj); |     } | ||||||
|         //    Re-attach this as the cell's parent
 | 
 | ||||||
|         $this->_currentObject->attach($this); | 
 | ||||||
| 
 |     /** | ||||||
| 		//	Return requested entry
 |      * Get a list of all cell addresses currently held in cache | ||||||
| 		return $this->_currentObject; |      * | ||||||
| 	}	//	function getCacheData()
 |      * @return  string[] | ||||||
| 
 |      */ | ||||||
| 
 |     public function getCellList() | ||||||
| 	/** |     { | ||||||
| 	 * Get a list of all cell addresses currently held in cache |         if ($this->_currentObjectID !== null) { | ||||||
| 	 * |             $this->_storeData(); | ||||||
| 	 * @return  string[] |         } | ||||||
| 	 */ | 
 | ||||||
| 	public function getCellList() { |         return parent::getCellList(); | ||||||
| 		if ($this->_currentObjectID !== null) { |     } | ||||||
| 			$this->_storeData(); | 
 | ||||||
| 		} |     /** | ||||||
| 
 |      * Delete a cell in cache identified by coordinate address | ||||||
| 		return parent::getCellList(); |      * | ||||||
| 	} |      * @param    string            $pCoord        Coordinate address of the cell to delete | ||||||
| 
 |      * @throws    PHPExcel_Exception | ||||||
| 
 |      */ | ||||||
| 	/** |     public function deleteCacheData($pCoord) | ||||||
| 	 * Delete a cell in cache identified by coordinate address |     { | ||||||
| 	 * |         //    Delete the entry from Wincache
 | ||||||
| 	 * @param	string			$pCoord		Coordinate address of the cell to delete |         wincache_ucache_delete($this->_cachePrefix.$pCoord.'.cache'); | ||||||
| 	 * @throws	PHPExcel_Exception | 
 | ||||||
| 	 */ |         //    Delete the entry from our cell address array
 | ||||||
| 	public function deleteCacheData($pCoord) { |         parent::deleteCacheData($pCoord); | ||||||
| 		//	Delete the entry from Wincache
 |     } | ||||||
| 		wincache_ucache_delete($this->_cachePrefix.$pCoord.'.cache'); | 
 | ||||||
| 
 |     /** | ||||||
| 		//	Delete the entry from our cell address array
 |      * Clone the cell collection | ||||||
| 		parent::deleteCacheData($pCoord); |      * | ||||||
| 	}	//	function deleteCacheData()
 |      * @param    PHPExcel_Worksheet    $parent        The new worksheet | ||||||
| 
 |      * @return    void | ||||||
| 
 |      */ | ||||||
| 	/** |     public function copyCellCollection(PHPExcel_Worksheet $parent) | ||||||
| 	 * Clone the cell collection |     { | ||||||
| 	 * |         parent::copyCellCollection($parent); | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The new worksheet |         //    Get a new id for the new file name
 | ||||||
| 	 * @return	void |         $baseUnique = $this->_getUniqueID(); | ||||||
| 	 */ |         $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.'; | ||||||
| 	public function copyCellCollection(PHPExcel_Worksheet $parent) { |         $cacheList = $this->getCellList(); | ||||||
| 		parent::copyCellCollection($parent); |         foreach ($cacheList as $cellID) { | ||||||
| 		//	Get a new id for the new file name
 |             if ($cellID != $this->_currentObjectID) { | ||||||
| 		$baseUnique = $this->_getUniqueID(); |                 $success = false; | ||||||
| 		$newCachePrefix = substr(md5($baseUnique),0,8).'.'; |                 $obj = wincache_ucache_get($this->_cachePrefix.$cellID.'.cache', $success); | ||||||
| 		$cacheList = $this->getCellList(); |                 if ($success === false) { | ||||||
| 		foreach($cacheList as $cellID) { |                     //    Entry no longer exists in WinCache, so clear it from the cache array
 | ||||||
| 			if ($cellID != $this->_currentObjectID) { |                     parent::deleteCacheData($cellID); | ||||||
| 				$success = false; |                     throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache'); | ||||||
| 				$obj = wincache_ucache_get($this->_cachePrefix.$cellID.'.cache', $success); |                 } | ||||||
| 				if ($success === false) { |                 if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->_cacheTime)) { | ||||||
| 					//	Entry no longer exists in WinCache, so clear it from the cache array
 |                     $this->__destruct(); | ||||||
| 					parent::deleteCacheData($cellID); |                     throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache'); | ||||||
| 					throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache'); |                 } | ||||||
| 				} |             } | ||||||
| 				if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->_cacheTime)) { |         } | ||||||
| 					$this->__destruct(); |         $this->_cachePrefix = $newCachePrefix; | ||||||
| 					throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache'); |     } | ||||||
| 				} | 
 | ||||||
| 			} | 
 | ||||||
| 		} |     /** | ||||||
| 		$this->_cachePrefix = $newCachePrefix; |      * Clear the cell collection and disconnect from our parent | ||||||
| 	}	//	function copyCellCollection()
 |      * | ||||||
| 
 |      * @return    void | ||||||
| 
 |      */ | ||||||
| 	/** |     public function unsetWorksheetCells() | ||||||
| 	 * Clear the cell collection and disconnect from our parent |     { | ||||||
| 	 * |         if (!is_null($this->_currentObject)) { | ||||||
| 	 * @return	void |             $this->_currentObject->detach(); | ||||||
| 	 */ |             $this->_currentObject = $this->_currentObjectID = null; | ||||||
| 	public function unsetWorksheetCells() { |         } | ||||||
| 		if(!is_null($this->_currentObject)) { | 
 | ||||||
| 			$this->_currentObject->detach(); |         //    Flush the WinCache cache
 | ||||||
| 			$this->_currentObject = $this->_currentObjectID = null; |         $this->__destruct(); | ||||||
| 		} | 
 | ||||||
| 
 |         $this->_cellCache = array(); | ||||||
| 		//	Flush the WinCache cache
 | 
 | ||||||
| 		$this->__destruct(); |         //    detach ourself from the worksheet, so that it can then delete this object successfully
 | ||||||
| 
 |         $this->_parent = null; | ||||||
| 		$this->_cellCache = array(); |     } | ||||||
| 
 | 
 | ||||||
| 		//	detach ourself from the worksheet, so that it can then delete this object successfully
 |     /** | ||||||
| 		$this->_parent = null; |      * Initialise this new cell collection | ||||||
| 	}	//	function unsetWorksheetCells()
 |      * | ||||||
| 
 |      * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection | ||||||
| 
 |      * @param    array of mixed        $arguments    Additional initialisation arguments | ||||||
| 	/** |      */ | ||||||
| 	 * Initialise this new cell collection |     public function __construct(PHPExcel_Worksheet $parent, $arguments) | ||||||
| 	 * |     { | ||||||
| 	 * @param	PHPExcel_Worksheet	$parent		The worksheet for this cell collection |         $cacheTime    = (isset($arguments['cacheTime']))    ? $arguments['cacheTime']    : 600; | ||||||
| 	 * @param	array of mixed		$arguments	Additional initialisation arguments | 
 | ||||||
| 	 */ |         if (is_null($this->_cachePrefix)) { | ||||||
| 	public function __construct(PHPExcel_Worksheet $parent, $arguments) { |             $baseUnique = $this->_getUniqueID(); | ||||||
| 		$cacheTime	= (isset($arguments['cacheTime']))	? $arguments['cacheTime']	: 600; |             $this->_cachePrefix = substr(md5($baseUnique), 0, 8).'.'; | ||||||
| 
 |             $this->_cacheTime = $cacheTime; | ||||||
| 		if (is_null($this->_cachePrefix)) { | 
 | ||||||
| 			$baseUnique = $this->_getUniqueID(); |             parent::__construct($parent); | ||||||
| 			$this->_cachePrefix = substr(md5($baseUnique),0,8).'.'; |         } | ||||||
| 			$this->_cacheTime = $cacheTime; |     } | ||||||
| 
 | 
 | ||||||
| 			parent::__construct($parent); |     /** | ||||||
| 		} |      * Destroy this cell collection | ||||||
| 	}	//	function __construct()
 |      */ | ||||||
| 
 |     public function __destruct() | ||||||
| 
 |     { | ||||||
| 	/** |         $cacheList = $this->getCellList(); | ||||||
| 	 * Destroy this cell collection |         foreach ($cacheList as $cellID) { | ||||||
| 	 */ |             wincache_ucache_delete($this->_cachePrefix.$cellID.'.cache'); | ||||||
| 	public function __destruct() { |         } | ||||||
| 		$cacheList = $this->getCellList(); |     } | ||||||
| 		foreach($cacheList as $cellID) { | 
 | ||||||
| 			wincache_ucache_delete($this->_cachePrefix.$cellID.'.cache'); |     /** | ||||||
| 		} |      * Identify whether the caching method is currently available | ||||||
| 	}	//	function __destruct()
 |      * Some methods are dependent on the availability of certain extensions being enabled in the PHP build | ||||||
| 
 |      * | ||||||
| 
 |      * @return    boolean | ||||||
| 	/** |      */ | ||||||
| 	 * Identify whether the caching method is currently available |     public static function cacheMethodIsAvailable() | ||||||
| 	 * Some methods are dependent on the availability of certain extensions being enabled in the PHP build |     { | ||||||
| 	 * |         if (!function_exists('wincache_ucache_add')) { | ||||||
| 	 * @return	boolean |             return false; | ||||||
| 	 */ |         } | ||||||
| 	public static function cacheMethodIsAvailable() { | 
 | ||||||
| 		if (!function_exists('wincache_ucache_add')) { |         return true; | ||||||
| 			return false; |     } | ||||||
| 		} | } | ||||||
| 
 |  | ||||||
| 		return true; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| <?php | <?php | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * PHPExcel |  * PHPExcel_CachedObjectStorageFactory | ||||||
|  * |  * | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * |  * | ||||||
| @ -25,15 +25,6 @@ | |||||||
|  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  * @version    ##VERSION##, ##DATE##
 |  * @version    ##VERSION##, ##DATE##
 | ||||||
|  */ |  */ | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| /** |  | ||||||
|  * PHPExcel_CachedObjectStorageFactory |  | ||||||
|  * |  | ||||||
|  * @category    PHPExcel |  | ||||||
|  * @package        PHPExcel_CachedObjectStorage |  | ||||||
|  * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  | ||||||
|  */ |  | ||||||
| class PHPExcel_CachedObjectStorageFactory | class PHPExcel_CachedObjectStorageFactory | ||||||
| { | { | ||||||
|     const cache_in_memory               = 'Memory'; |     const cache_in_memory               = 'Memory'; | ||||||
| @ -48,21 +39,19 @@ class PHPExcel_CachedObjectStorageFactory | |||||||
|     const cache_to_sqlite               = 'SQLite'; |     const cache_to_sqlite               = 'SQLite'; | ||||||
|     const cache_to_sqlite3              = 'SQLite3'; |     const cache_to_sqlite3              = 'SQLite3'; | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     /** |     /** | ||||||
|      * Name of the method used for cell cacheing |      * Name of the method used for cell cacheing | ||||||
|      * |      * | ||||||
|      * @var string |      * @var string | ||||||
|      */ |      */ | ||||||
|     private static $_cacheStorageMethod = NULL; |     private static $_cacheStorageMethod = null; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Name of the class used for cell cacheing |      * Name of the class used for cell cacheing | ||||||
|      * |      * | ||||||
|      * @var string |      * @var string | ||||||
|      */ |      */ | ||||||
|     private static $_cacheStorageClass = NULL; |     private static $_cacheStorageClass = null; | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * List of all possible cache storage methods |      * List of all possible cache storage methods | ||||||
| @ -83,7 +72,6 @@ class PHPExcel_CachedObjectStorageFactory | |||||||
|         self::cache_to_sqlite3, |         self::cache_to_sqlite3, | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     /** |     /** | ||||||
|      * Default arguments for each cache storage method |      * Default arguments for each cache storage method | ||||||
|      * |      * | ||||||
| @ -100,7 +88,7 @@ class PHPExcel_CachedObjectStorageFactory | |||||||
|                                                     ), |                                                     ), | ||||||
|         self::cache_to_phpTemp              => array( 'memoryCacheSize' => '1MB' |         self::cache_to_phpTemp              => array( 'memoryCacheSize' => '1MB' | ||||||
|                                                     ), |                                                     ), | ||||||
|         self::cache_to_discISAM             => array( 'dir'             => NULL |         self::cache_to_discISAM             => array( 'dir'             => null | ||||||
|                                                     ), |                                                     ), | ||||||
|         self::cache_to_apc                  => array( 'cacheTime'       => 600 |         self::cache_to_apc                  => array( 'cacheTime'       => 600 | ||||||
|                                                     ), |                                                     ), | ||||||
| @ -116,7 +104,6 @@ class PHPExcel_CachedObjectStorageFactory | |||||||
|                                                     ), |                                                     ), | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     /** |     /** | ||||||
|      * Arguments for the active cache storage method |      * Arguments for the active cache storage method | ||||||
|      * |      * | ||||||
| @ -124,28 +111,25 @@ class PHPExcel_CachedObjectStorageFactory | |||||||
|      */ |      */ | ||||||
|     private static $_storageMethodParameters = array(); |     private static $_storageMethodParameters = array(); | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     /** |     /** | ||||||
|      * Return the current cache storage method |      * Return the current cache storage method | ||||||
|      * |      * | ||||||
|      * @return string|NULL |      * @return string|null | ||||||
|      **/ |      **/ | ||||||
|     public static function getCacheStorageMethod() |     public static function getCacheStorageMethod() | ||||||
|     { |     { | ||||||
|         return self::$_cacheStorageMethod; |         return self::$_cacheStorageMethod; | ||||||
|     }   //    function getCacheStorageMethod()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Return the current cache storage class |      * Return the current cache storage class | ||||||
|      * |      * | ||||||
|      * @return PHPExcel_CachedObjectStorage_ICache|NULL |      * @return PHPExcel_CachedObjectStorage_ICache|null | ||||||
|      **/ |      **/ | ||||||
|     public static function getCacheStorageClass() |     public static function getCacheStorageClass() | ||||||
|     { |     { | ||||||
|         return self::$_cacheStorageClass; |         return self::$_cacheStorageClass; | ||||||
|     }   //    function getCacheStorageClass()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Return the list of all possible cache storage methods |      * Return the list of all possible cache storage methods | ||||||
| @ -155,8 +139,7 @@ class PHPExcel_CachedObjectStorageFactory | |||||||
|     public static function getAllCacheStorageMethods() |     public static function getAllCacheStorageMethods() | ||||||
|     { |     { | ||||||
|         return self::$_storageMethods; |         return self::$_storageMethods; | ||||||
|     }   //    function getCacheStorageMethods()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Return the list of all available cache storage methods |      * Return the list of all available cache storage methods | ||||||
| @ -166,15 +149,14 @@ class PHPExcel_CachedObjectStorageFactory | |||||||
|     public static function getCacheStorageMethods() |     public static function getCacheStorageMethods() | ||||||
|     { |     { | ||||||
|         $activeMethods = array(); |         $activeMethods = array(); | ||||||
|         foreach(self::$_storageMethods as $storageMethod) { |         foreach (self::$_storageMethods as $storageMethod) { | ||||||
|             $cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod; |             $cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod; | ||||||
|             if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) { |             if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) { | ||||||
|                 $activeMethods[] = $storageMethod; |                 $activeMethods[] = $storageMethod; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         return $activeMethods; |         return $activeMethods; | ||||||
|     }   //    function getCacheStorageMethods()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Identify the cache storage method to use |      * Identify the cache storage method to use | ||||||
| @ -186,30 +168,29 @@ class PHPExcel_CachedObjectStorageFactory | |||||||
|      **/ |      **/ | ||||||
|     public static function initialize($method = self::cache_in_memory, $arguments = array()) |     public static function initialize($method = self::cache_in_memory, $arguments = array()) | ||||||
|     { |     { | ||||||
|         if (!in_array($method,self::$_storageMethods)) { |         if (!in_array($method, self::$_storageMethods)) { | ||||||
|             return FALSE; |             return false; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         $cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method; |         $cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method; | ||||||
|         if (!call_user_func(array( $cacheStorageClass, |         if (!call_user_func(array( $cacheStorageClass, | ||||||
|                                    'cacheMethodIsAvailable'))) { |                                    'cacheMethodIsAvailable'))) { | ||||||
|             return FALSE; |             return false; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         self::$_storageMethodParameters[$method] = self::$_storageMethodDefaultParameters[$method]; |         self::$_storageMethodParameters[$method] = self::$_storageMethodDefaultParameters[$method]; | ||||||
|         foreach($arguments as $k => $v) { |         foreach ($arguments as $k => $v) { | ||||||
|             if (array_key_exists($k, self::$_storageMethodParameters[$method])) { |             if (array_key_exists($k, self::$_storageMethodParameters[$method])) { | ||||||
|                 self::$_storageMethodParameters[$method][$k] = $v; |                 self::$_storageMethodParameters[$method][$k] = $v; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (self::$_cacheStorageMethod === NULL) { |         if (self::$_cacheStorageMethod === null) { | ||||||
|             self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method; |             self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method; | ||||||
|             self::$_cacheStorageMethod = $method; |             self::$_cacheStorageMethod = $method; | ||||||
|         } |         } | ||||||
|         return TRUE; |         return true; | ||||||
|     }   //    function initialize()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Initialise the cache storage |      * Initialise the cache storage | ||||||
| @ -219,33 +200,32 @@ class PHPExcel_CachedObjectStorageFactory | |||||||
|      **/ |      **/ | ||||||
|     public static function getInstance(PHPExcel_Worksheet $parent) |     public static function getInstance(PHPExcel_Worksheet $parent) | ||||||
|     { |     { | ||||||
|         $cacheMethodIsAvailable = TRUE; |         $cacheMethodIsAvailable = true; | ||||||
|         if (self::$_cacheStorageMethod === NULL) { |         if (self::$_cacheStorageMethod === null) { | ||||||
|             $cacheMethodIsAvailable = self::initialize(); |             $cacheMethodIsAvailable = self::initialize(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if ($cacheMethodIsAvailable) { |         if ($cacheMethodIsAvailable) { | ||||||
|             $instance = new self::$_cacheStorageClass( $parent, |             $instance = new self::$_cacheStorageClass( | ||||||
|                                                        self::$_storageMethodParameters[self::$_cacheStorageMethod] |                 $parent, | ||||||
|                                                      ); |                 self::$_storageMethodParameters[self::$_cacheStorageMethod] | ||||||
|             if ($instance !== NULL) { |             ); | ||||||
|  |             if ($instance !== null) { | ||||||
|                 return $instance; |                 return $instance; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         return FALSE; |         return false; | ||||||
|     }   //    function getInstance()
 |     } | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Clear the cache storage |      * Clear the cache storage | ||||||
|      * |      * | ||||||
|      **/ |      **/ | ||||||
| 	public static function finalize() |     public static function finalize() | ||||||
| 	{ |     { | ||||||
| 		self::$_cacheStorageMethod = NULL; |         self::$_cacheStorageMethod = null; | ||||||
| 		self::$_cacheStorageClass = NULL; |         self::$_cacheStorageClass = null; | ||||||
| 		self::$_storageMethodParameters = array(); |         self::$_storageMethodParameters = array(); | ||||||
| 	} |     } | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| <?php | <?php | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * PHPExcel |  * PHPExcel_CalcEngine_CyclicReferenceStack | ||||||
|  * |  * | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * |  * | ||||||
| @ -21,78 +22,73 @@ | |||||||
|  * @category   PHPExcel |  * @category   PHPExcel | ||||||
|  * @package    PHPExcel_Calculation |  * @package    PHPExcel_Calculation | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @license	http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  * @version	##VERSION##, ##DATE##
 |  * @version    ##VERSION##, ##DATE##
 | ||||||
|  */ |  */ | ||||||
|  | class PHPExcel_CalcEngine_CyclicReferenceStack | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      *  The call stack for calculated cells | ||||||
|  |      * | ||||||
|  |      *  @var mixed[] | ||||||
|  |      */ | ||||||
|  |     private $_stack = array(); | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Return the number of entries on the stack | ||||||
|  |      * | ||||||
|  |      * @return  integer | ||||||
|  |      */ | ||||||
|  |     public function count() | ||||||
|  |     { | ||||||
|  |         return count($this->_stack); | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
| /** |     /** | ||||||
|  * PHPExcel_CalcEngine_CyclicReferenceStack |      * Push a new entry onto the stack | ||||||
|  * |      * | ||||||
|  * @category	PHPExcel_CalcEngine_CyclicReferenceStack |      * @param  mixed  $value | ||||||
|  * @package		PHPExcel_Calculation |      */ | ||||||
|  * @copyright	Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |     public function push($value) | ||||||
|  */ |     { | ||||||
| class PHPExcel_CalcEngine_CyclicReferenceStack { |         $this->_stack[$value] = $value; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 *  The call stack for calculated cells |      * Pop the last entry from the stack | ||||||
| 	 * |      * | ||||||
| 	 *  @var mixed[] |      * @return  mixed | ||||||
| 	 */ |      */ | ||||||
| 	private $_stack = array(); |     public function pop() | ||||||
|  |     { | ||||||
|  |         return array_pop($this->_stack); | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Test to see if a specified entry exists on the stack | ||||||
|  |      * | ||||||
|  |      * @param  mixed  $value  The value to test | ||||||
|  |      */ | ||||||
|  |     public function onStack($value) | ||||||
|  |     { | ||||||
|  |         return isset($this->_stack[$value]); | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Return the number of entries on the stack |      * Clear the stack | ||||||
| 	 * |      */ | ||||||
| 	 * @return  integer |     public function clear() | ||||||
| 	 */ |     { | ||||||
| 	public function count() { |         $this->_stack = array(); | ||||||
| 		return count($this->_stack); |     } | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/** |  | ||||||
| 	 * Push a new entry onto the stack |  | ||||||
| 	 * |  | ||||||
| 	 * @param  mixed  $value |  | ||||||
| 	 */ |  | ||||||
| 	public function push($value) { |  | ||||||
| 		$this->_stack[$value] = $value; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/** |  | ||||||
| 	 * Pop the last entry from the stack |  | ||||||
| 	 * |  | ||||||
| 	 * @return  mixed |  | ||||||
| 	 */ |  | ||||||
| 	public function pop() { |  | ||||||
| 		return array_pop($this->_stack); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/** |  | ||||||
| 	 * Test to see if a specified entry exists on the stack |  | ||||||
| 	 * |  | ||||||
| 	 * @param  mixed  $value  The value to test |  | ||||||
| 	 */ |  | ||||||
| 	public function onStack($value) { |  | ||||||
| 		return isset($this->_stack[$value]); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/** |  | ||||||
| 	 * Clear the stack |  | ||||||
| 	 */ |  | ||||||
| 	public function clear() { |  | ||||||
| 		$this->_stack = array(); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/** |  | ||||||
| 	 * Return an array of all entries on the stack |  | ||||||
| 	 * |  | ||||||
| 	 * @return  mixed[] |  | ||||||
| 	 */ |  | ||||||
| 	public function showStack() { |  | ||||||
| 		return $this->_stack; |  | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Return an array of all entries on the stack | ||||||
|  |      * | ||||||
|  |      * @return  mixed[] | ||||||
|  |      */ | ||||||
|  |     public function showStack() | ||||||
|  |     { | ||||||
|  |         return $this->_stack; | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| <?php | <?php | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * PHPExcel |  * PHPExcel_CalcEngine_Logger | ||||||
|  * |  * | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * |  * | ||||||
| @ -21,133 +22,130 @@ | |||||||
|  * @category   PHPExcel |  * @category   PHPExcel | ||||||
|  * @package    PHPExcel_Calculation |  * @package    PHPExcel_Calculation | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @license	http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  * @version	##VERSION##, ##DATE##
 |  * @version    ##VERSION##, ##DATE##
 | ||||||
|  */ |  */ | ||||||
|  | class PHPExcel_CalcEngine_Logger | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      * Flag to determine whether a debug log should be generated by the calculation engine | ||||||
|  |      *        If true, then a debug log will be generated | ||||||
|  |      *        If false, then a debug log will not be generated | ||||||
|  |      * | ||||||
|  |      * @var boolean | ||||||
|  |      */ | ||||||
|  |     private $_writeDebugLog = false; | ||||||
| 
 | 
 | ||||||
| /** |     /** | ||||||
|  * PHPExcel_CalcEngine_Logger |      * Flag to determine whether a debug log should be echoed by the calculation engine | ||||||
|  * |      *        If true, then a debug log will be echoed | ||||||
|  * @category	PHPExcel |      *        If false, then a debug log will not be echoed | ||||||
|  * @package		PHPExcel_Calculation |      * A debug log can only be echoed if it is generated | ||||||
|  * @copyright	Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |      * | ||||||
|  */ |      * @var boolean | ||||||
| class PHPExcel_CalcEngine_Logger { |      */ | ||||||
|  |     private $_echoDebugLog = false; | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Flag to determine whether a debug log should be generated by the calculation engine |      * The debug log generated by the calculation engine | ||||||
| 	 *		If true, then a debug log will be generated |      * | ||||||
| 	 *		If false, then a debug log will not be generated |      * @var string[] | ||||||
| 	 * |      */ | ||||||
| 	 * @var boolean |     private $_debugLog = array(); | ||||||
| 	 */ |  | ||||||
| 	private $_writeDebugLog = FALSE; |  | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Flag to determine whether a debug log should be echoed by the calculation engine |      * The calculation engine cell reference stack | ||||||
| 	 *		If true, then a debug log will be echoed |      * | ||||||
| 	 *		If false, then a debug log will not be echoed |      * @var PHPExcel_CalcEngine_CyclicReferenceStack | ||||||
| 	 * A debug log can only be echoed if it is generated |      */ | ||||||
| 	 * |     private $_cellStack; | ||||||
| 	 * @var boolean |  | ||||||
| 	 */ |  | ||||||
| 	private $_echoDebugLog = FALSE; |  | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * The debug log generated by the calculation engine |      * Instantiate a Calculation engine logger | ||||||
| 	 * |      * | ||||||
| 	 * @var string[] |      * @param  PHPExcel_CalcEngine_CyclicReferenceStack $stack | ||||||
| 	 */ |      */ | ||||||
| 	private $_debugLog = array(); |     public function __construct(PHPExcel_CalcEngine_CyclicReferenceStack $stack) | ||||||
|  |     { | ||||||
|  |         $this->_cellStack = $stack; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * The calculation engine cell reference stack |      * Enable/Disable Calculation engine logging | ||||||
| 	 * |      * | ||||||
| 	 * @var PHPExcel_CalcEngine_CyclicReferenceStack |      * @param  boolean $pValue | ||||||
| 	 */ |      */ | ||||||
| 	private $_cellStack; |     public function setWriteDebugLog($pValue = false) | ||||||
|  |     { | ||||||
|  |         $this->_writeDebugLog = $pValue; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
| 	 |     /** | ||||||
| 	/** |      * Return whether calculation engine logging is enabled or disabled | ||||||
| 	 * Instantiate a Calculation engine logger |      * | ||||||
| 	 * |      * @return  boolean | ||||||
| 	 * @param  PHPExcel_CalcEngine_CyclicReferenceStack $stack |      */ | ||||||
| 	 */ |     public function getWriteDebugLog() | ||||||
| 	public function __construct(PHPExcel_CalcEngine_CyclicReferenceStack $stack) { |     { | ||||||
| 		$this->_cellStack = $stack; |         return $this->_writeDebugLog; | ||||||
| 	} |     } | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Enable/Disable Calculation engine logging |      * Enable/Disable echoing of debug log information | ||||||
| 	 * |      * | ||||||
| 	 * @param  boolean $pValue |      * @param  boolean $pValue | ||||||
| 	 */ |      */ | ||||||
| 	public function setWriteDebugLog($pValue = FALSE) { |     public function setEchoDebugLog($pValue = false) | ||||||
| 		$this->_writeDebugLog = $pValue; |     { | ||||||
| 	} |         $this->_echoDebugLog = $pValue; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Return whether calculation engine logging is enabled or disabled |      * Return whether echoing of debug log information is enabled or disabled | ||||||
| 	 * |      * | ||||||
| 	 * @return  boolean |      * @return  boolean | ||||||
| 	 */ |      */ | ||||||
| 	public function getWriteDebugLog() { |     public function getEchoDebugLog() | ||||||
| 		return $this->_writeDebugLog; |     { | ||||||
| 	} |         return $this->_echoDebugLog; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Enable/Disable echoing of debug log information |      * Write an entry to the calculation engine debug log | ||||||
| 	 * |      */ | ||||||
| 	 * @param  boolean $pValue |     public function writeDebugLog() | ||||||
| 	 */ |     { | ||||||
| 	public function setEchoDebugLog($pValue = FALSE) { |         //    Only write the debug log if logging is enabled
 | ||||||
| 		$this->_echoDebugLog = $pValue; |         if ($this->_writeDebugLog) { | ||||||
| 	} |             $message = implode(func_get_args()); | ||||||
|  |             $cellReference = implode(' -> ', $this->_cellStack->showStack()); | ||||||
|  |             if ($this->_echoDebugLog) { | ||||||
|  |                 echo $cellReference, | ||||||
|  |                     ($this->_cellStack->count() > 0 ? ' => ' : ''), | ||||||
|  |                     $message, | ||||||
|  |                     PHP_EOL; | ||||||
|  |             } | ||||||
|  |             $this->_debugLog[] = $cellReference . | ||||||
|  |                 ($this->_cellStack->count() > 0 ? ' => ' : '') . | ||||||
|  |                 $message; | ||||||
|  |         } | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Return whether echoing of debug log information is enabled or disabled |      * Clear the calculation engine debug log | ||||||
| 	 * |      */ | ||||||
| 	 * @return  boolean |     public function clearLog() | ||||||
| 	 */ |     { | ||||||
| 	public function getEchoDebugLog() { |         $this->_debugLog = array(); | ||||||
| 		return $this->_echoDebugLog; |     } | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/** |  | ||||||
| 	 * Write an entry to the calculation engine debug log |  | ||||||
| 	 */ |  | ||||||
| 	public function writeDebugLog() { |  | ||||||
| 		//	Only write the debug log if logging is enabled
 |  | ||||||
| 		if ($this->_writeDebugLog) { |  | ||||||
| 			$message = implode(func_get_args()); |  | ||||||
| 			$cellReference = implode(' -> ', $this->_cellStack->showStack()); |  | ||||||
| 			if ($this->_echoDebugLog) { |  | ||||||
| 				echo $cellReference,  |  | ||||||
| 					($this->_cellStack->count() > 0 ? ' => ' : ''),  |  | ||||||
| 					$message,  |  | ||||||
| 					PHP_EOL; |  | ||||||
| 			} |  | ||||||
| 			$this->_debugLog[] = $cellReference .  |  | ||||||
| 				($this->_cellStack->count() > 0 ? ' => ' : '') .  |  | ||||||
| 				$message; |  | ||||||
| 		} |  | ||||||
| 	}	//	function _writeDebug()
 |  | ||||||
| 
 |  | ||||||
| 	/** |  | ||||||
| 	 * Clear the calculation engine debug log |  | ||||||
| 	 */ |  | ||||||
| 	public function clearLog() { |  | ||||||
| 		$this->_debugLog = array(); |  | ||||||
| 	}	//	function flushLogger()
 |  | ||||||
| 
 |  | ||||||
| 	/** |  | ||||||
| 	 * Return the calculation engine debug log |  | ||||||
| 	 * |  | ||||||
| 	 * @return  string[] |  | ||||||
| 	 */ |  | ||||||
| 	public function getLog() { |  | ||||||
| 		return $this->_debugLog; |  | ||||||
| 	}	//	function flushLogger()
 |  | ||||||
| 
 |  | ||||||
| }	//	class PHPExcel_CalcEngine_Logger
 |  | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Return the calculation engine debug log | ||||||
|  |      * | ||||||
|  |      * @return  string[] | ||||||
|  |      */ | ||||||
|  |     public function getLog() | ||||||
|  |     { | ||||||
|  |         return $this->_debugLog; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| <?php | <?php | ||||||
| /** | /** | ||||||
|  * PHPExcel |  * PHPExcel_Calculation_Token_Stack | ||||||
|  * |  * | ||||||
|  * Copyright (c) 2006 - 2015 PHPExcel |  * Copyright (c) 2006 - 2015 PHPExcel | ||||||
|  * |  * | ||||||
| @ -21,95 +21,90 @@ | |||||||
|  * @category   PHPExcel |  * @category   PHPExcel | ||||||
|  * @package    PHPExcel_Calculation |  * @package    PHPExcel_Calculation | ||||||
|  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||||||
|  * @license	http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | ||||||
|  * @version	##VERSION##, ##DATE##
 |  * @version    ##VERSION##, ##DATE##
 | ||||||
|  */ |  */ | ||||||
|  | class PHPExcel_Calculation_Token_Stack | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      *  The parser stack for formulae | ||||||
|  |      * | ||||||
|  |      *  @var mixed[] | ||||||
|  |      */ | ||||||
|  |     private $_stack = array(); | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      *  Count of entries in the parser stack | ||||||
|  |      * | ||||||
|  |      *  @var integer | ||||||
|  |      */ | ||||||
|  |     private $_count = 0; | ||||||
| 
 | 
 | ||||||
| /** |     /** | ||||||
|  * PHPExcel_Calculation_Token_Stack |      * Return the number of entries on the stack | ||||||
|  * |      * | ||||||
|  * @category	PHPExcel_Calculation_Token_Stack |      * @return  integer | ||||||
|  * @package		PHPExcel_Calculation |      */ | ||||||
|  * @copyright	Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |     public function count() | ||||||
|  */ |     { | ||||||
| class PHPExcel_Calculation_Token_Stack { |         return $this->_count; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 *  The parser stack for formulae |      * Push a new entry onto the stack | ||||||
| 	 * |      * | ||||||
| 	 *  @var mixed[] |      * @param  mixed  $type | ||||||
| 	 */ |      * @param  mixed  $value | ||||||
| 	private $_stack = array(); |      * @param  mixed  $reference | ||||||
|  |      */ | ||||||
|  |     public function push($type, $value, $reference = null) | ||||||
|  |     { | ||||||
|  |         $this->_stack[$this->_count++] = array( | ||||||
|  |             'type'        => $type, | ||||||
|  |             'value'        => $value, | ||||||
|  |             'reference'    => $reference | ||||||
|  |         ); | ||||||
|  |         if ($type == 'Function') { | ||||||
|  |             $localeFunction = PHPExcel_Calculation::_localeFunc($value); | ||||||
|  |             if ($localeFunction != $value) { | ||||||
|  |                 $this->_stack[($this->_count - 1)]['localeValue'] = $localeFunction; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 *  Count of entries in the parser stack |      * Pop the last entry from the stack | ||||||
| 	 * |      * | ||||||
| 	 *  @var integer |      * @return  mixed | ||||||
| 	 */ |      */ | ||||||
| 	private $_count = 0; |     public function pop() | ||||||
|  |     { | ||||||
|  |         if ($this->_count > 0) { | ||||||
|  |             return $this->_stack[--$this->_count]; | ||||||
|  |         } | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Return an entry from the stack without removing it | ||||||
|  |      * | ||||||
|  |      * @param   integer  $n  number indicating how far back in the stack we want to look | ||||||
|  |      * @return  mixed | ||||||
|  |      */ | ||||||
|  |     public function last($n = 1) | ||||||
|  |     { | ||||||
|  |         if ($this->_count - $n < 0) { | ||||||
|  |             return null; | ||||||
|  |         } | ||||||
|  |         return $this->_stack[$this->_count - $n]; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
| 	/** |     /** | ||||||
| 	 * Return the number of entries on the stack |      * Clear the stack | ||||||
| 	 * |      */ | ||||||
| 	 * @return  integer |     function clear() | ||||||
| 	 */ |     { | ||||||
| 	public function count() { |         $this->_stack = array(); | ||||||
| 		return $this->_count; |         $this->_count = 0; | ||||||
| 	}	//	function count()
 |     } | ||||||
| 
 | } | ||||||
| 	/** |  | ||||||
| 	 * Push a new entry onto the stack |  | ||||||
| 	 * |  | ||||||
| 	 * @param  mixed  $type |  | ||||||
| 	 * @param  mixed  $value |  | ||||||
| 	 * @param  mixed  $reference |  | ||||||
| 	 */ |  | ||||||
| 	public function push($type, $value, $reference = NULL) { |  | ||||||
| 		$this->_stack[$this->_count++] = array('type'		=> $type, |  | ||||||
| 											   'value'		=> $value, |  | ||||||
| 											   'reference'	=> $reference |  | ||||||
| 											  ); |  | ||||||
| 		if ($type == 'Function') { |  | ||||||
| 			$localeFunction = PHPExcel_Calculation::_localeFunc($value); |  | ||||||
| 			if ($localeFunction != $value) { |  | ||||||
| 				$this->_stack[($this->_count - 1)]['localeValue'] = $localeFunction; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 	}	//	function push()
 |  | ||||||
| 
 |  | ||||||
| 	/** |  | ||||||
| 	 * Pop the last entry from the stack |  | ||||||
| 	 * |  | ||||||
| 	 * @return  mixed |  | ||||||
| 	 */ |  | ||||||
| 	public function pop() { |  | ||||||
| 		if ($this->_count > 0) { |  | ||||||
| 			return $this->_stack[--$this->_count]; |  | ||||||
| 		} |  | ||||||
| 		return NULL; |  | ||||||
| 	}	//	function pop()
 |  | ||||||
| 
 |  | ||||||
| 	/** |  | ||||||
| 	 * Return an entry from the stack without removing it |  | ||||||
| 	 * |  | ||||||
| 	 * @param   integer  $n  number indicating how far back in the stack we want to look |  | ||||||
| 	 * @return  mixed |  | ||||||
| 	 */ |  | ||||||
| 	public function last($n = 1) { |  | ||||||
| 		if ($this->_count - $n < 0) { |  | ||||||
| 			return NULL; |  | ||||||
| 		} |  | ||||||
| 		return $this->_stack[$this->_count - $n]; |  | ||||||
| 	}	//	function last()
 |  | ||||||
| 
 |  | ||||||
| 	/** |  | ||||||
| 	 * Clear the stack |  | ||||||
| 	 */ |  | ||||||
| 	function clear() { |  | ||||||
| 		$this->_stack = array(); |  | ||||||
| 		$this->_count = 0; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| }	//	class PHPExcel_Calculation_Token_Stack
 |  | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 MarkBaker
						MarkBaker