PSR-2 variable naming for caching classes, remove leading underscores
This commit is contained in:
parent
e885ef9196
commit
3c3154c4a3
|
@ -33,7 +33,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
||||||
* @access private
|
* @access private
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_cachePrefix = null;
|
private $cachePrefix = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache timeout
|
* Cache timeout
|
||||||
|
@ -41,7 +41,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
||||||
* @access private
|
* @access private
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
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",
|
||||||
|
@ -51,22 +51,22 @@ 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(
|
if (!apc_store(
|
||||||
$this->_cachePrefix . $this->_currentObjectID . '.cache',
|
$this->cachePrefix . $this->currentObjectID . '.cache',
|
||||||
serialize($this->_currentObject),
|
serialize($this->currentObject),
|
||||||
$this->_cacheTime
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,14 +80,14 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
||||||
*/
|
*/
|
||||||
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();
|
||||||
}
|
}
|
||||||
$this->_cellCache[$pCoord] = true;
|
$this->cellCache[$pCoord] = true;
|
||||||
|
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = $cell;
|
$this->currentObject = $cell;
|
||||||
$this->_currentCellIsDirty = true;
|
$this->currentCellIsDirty = true;
|
||||||
|
|
||||||
return $cell;
|
return $cell;
|
||||||
}
|
}
|
||||||
|
@ -104,11 +104,11 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
||||||
{
|
{
|
||||||
// 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) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 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);
|
||||||
|
@ -129,14 +129,14 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
|
|
||||||
// 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);
|
||||||
|
@ -148,13 +148,13 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = unserialize($obj);
|
$this->currentObject = unserialize($obj);
|
||||||
// Re-attach this as the cell's parent
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this);
|
$this->currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -164,8 +164,8 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
||||||
*/
|
*/
|
||||||
public function getCellList()
|
public function getCellList()
|
||||||
{
|
{
|
||||||
if ($this->_currentObjectID !== null) {
|
if ($this->currentObjectID !== null) {
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::getCellList();
|
return parent::getCellList();
|
||||||
|
@ -181,7 +181,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
||||||
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);
|
||||||
|
@ -199,24 +199,24 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -226,18 +226,18 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush the APC cache
|
// Flush the APC cache
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
|
|
||||||
$this->_cellCache = array();
|
$this->cellCache = array();
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -250,10 +250,10 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
||||||
{
|
{
|
||||||
$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);
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
||||||
{
|
{
|
||||||
$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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,28 +32,28 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Worksheet
|
* @var PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
protected $_parent;
|
protected $parent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The currently active Cell
|
* The currently active Cell
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Cell
|
* @var PHPExcel_Cell
|
||||||
*/
|
*/
|
||||||
protected $_currentObject = null;
|
protected $currentObject = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Coordinate address of the currently active Cell
|
* Coordinate address of the currently active Cell
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $_currentObjectID = null;
|
protected $currentObjectID = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag indicating whether the currently active Cell requires saving
|
* Flag indicating whether the currently active Cell requires saving
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
protected $_currentCellIsDirty = true;
|
protected $currentCellIsDirty = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of cells or cell pointers for the worksheet cells held in this cache,
|
* An array of cells or cell pointers for the worksheet cells held in this cache,
|
||||||
|
@ -61,7 +61,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase
|
||||||
*
|
*
|
||||||
* @var array of mixed
|
* @var array of mixed
|
||||||
*/
|
*/
|
||||||
protected $_cellCache = array();
|
protected $cellCache = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise this new cell collection
|
* Initialise this new cell collection
|
||||||
|
@ -73,7 +73,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase
|
||||||
// Set our parent worksheet.
|
// Set our parent worksheet.
|
||||||
// This is maintained within the cache controller to facilitate re-attaching it to PHPExcel_Cell objects when
|
// This is maintained within the cache controller to facilitate re-attaching it to PHPExcel_Cell objects when
|
||||||
// they are woken from a serialized state
|
// they are woken from a serialized state
|
||||||
$this->_parent = $parent;
|
$this->parent = $parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,7 +83,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase
|
||||||
*/
|
*/
|
||||||
public function getParent()
|
public function getParent()
|
||||||
{
|
{
|
||||||
return $this->_parent;
|
return $this->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,11 +94,11 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase
|
||||||
*/
|
*/
|
||||||
public function isDataSet($pCoord)
|
public function isDataSet($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Check if the requested entry exists in the cache
|
// Check if the requested entry exists in the cache
|
||||||
return isset($this->_cellCache[$pCoord]);
|
return isset($this->cellCache[$pCoord]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,13 +110,13 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase
|
||||||
*/
|
*/
|
||||||
public function moveCell($fromAddress, $toAddress)
|
public function moveCell($fromAddress, $toAddress)
|
||||||
{
|
{
|
||||||
if ($fromAddress === $this->_currentObjectID) {
|
if ($fromAddress === $this->currentObjectID) {
|
||||||
$this->_currentObjectID = $toAddress;
|
$this->currentObjectID = $toAddress;
|
||||||
}
|
}
|
||||||
$this->_currentCellIsDirty = true;
|
$this->currentCellIsDirty = true;
|
||||||
if (isset($this->_cellCache[$fromAddress])) {
|
if (isset($this->cellCache[$fromAddress])) {
|
||||||
$this->_cellCache[$toAddress] = &$this->_cellCache[$fromAddress];
|
$this->cellCache[$toAddress] = &$this->cellCache[$fromAddress];
|
||||||
unset($this->_cellCache[$fromAddress]);
|
unset($this->cellCache[$fromAddress]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -142,16 +142,16 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord)
|
public function deleteCacheData($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID && !is_null($this->_currentObject)) {
|
if ($pCoord === $this->currentObjectID && !is_null($this->currentObject)) {
|
||||||
$this->_currentObject->detach();
|
$this->currentObject->detach();
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->currentObjectID = $this->currentObject = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_object($this->_cellCache[$pCoord])) {
|
if (is_object($this->cellCache[$pCoord])) {
|
||||||
$this->_cellCache[$pCoord]->detach();
|
$this->cellCache[$pCoord]->detach();
|
||||||
unset($this->_cellCache[$pCoord]);
|
unset($this->cellCache[$pCoord]);
|
||||||
}
|
}
|
||||||
$this->_currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,7 +161,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase
|
||||||
*/
|
*/
|
||||||
public function getCellList()
|
public function getCellList()
|
||||||
{
|
{
|
||||||
return array_keys($this->_cellCache);
|
return array_keys($this->cellCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -215,7 +215,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase
|
||||||
*/
|
*/
|
||||||
public function getCurrentAddress()
|
public function getCurrentAddress()
|
||||||
{
|
{
|
||||||
return $this->_currentObjectID;
|
return $this->currentObjectID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -225,7 +225,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase
|
||||||
*/
|
*/
|
||||||
public function getCurrentColumn()
|
public function getCurrentColumn()
|
||||||
{
|
{
|
||||||
sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row);
|
sscanf($this->currentObjectID, '%[A-Z]%d', $column, $row);
|
||||||
return $column;
|
return $column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase
|
||||||
*/
|
*/
|
||||||
public function getCurrentRow()
|
public function getCurrentRow()
|
||||||
{
|
{
|
||||||
sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row);
|
sscanf($this->currentObjectID, '%[A-Z]%d', $column, $row);
|
||||||
return (integer) $row;
|
return (integer) $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase
|
||||||
*
|
*
|
||||||
* @return string Unique Reference
|
* @return string Unique Reference
|
||||||
*/
|
*/
|
||||||
protected function _getUniqueID()
|
protected function getUniqueID()
|
||||||
{
|
{
|
||||||
if (function_exists('posix_getpid')) {
|
if (function_exists('posix_getpid')) {
|
||||||
$baseUnique = posix_getpid();
|
$baseUnique = posix_getpid();
|
||||||
|
@ -314,12 +314,12 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
||||||
{
|
{
|
||||||
$this->_currentCellIsDirty;
|
$this->currentCellIsDirty;
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
|
|
||||||
$this->_parent = $parent;
|
$this->parent = $parent;
|
||||||
if (($this->_currentObject !== null) && (is_object($this->_currentObject))) {
|
if (($this->currentObject !== null) && (is_object($this->currentObject))) {
|
||||||
$this->_currentObject->attach($this);
|
$this->currentObject->attach($this);
|
||||||
}
|
}
|
||||||
} // function copyCellCollection()
|
} // function copyCellCollection()
|
||||||
|
|
||||||
|
|
|
@ -32,21 +32,21 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_fileName = null;
|
private $fileName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File handle for this cache file
|
* File handle for this cache file
|
||||||
*
|
*
|
||||||
* @var resource
|
* @var resource
|
||||||
*/
|
*/
|
||||||
private $_fileHandle = null;
|
private $fileHandle = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directory/Folder where the cache file is located
|
* Directory/Folder where the cache file is located
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_cacheDirectory = null;
|
private $cacheDirectory = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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",
|
||||||
|
@ -55,20 +55,20 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
||||||
* @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();
|
||||||
|
|
||||||
fseek($this->_fileHandle, 0, SEEK_END);
|
fseek($this->fileHandle, 0, SEEK_END);
|
||||||
|
|
||||||
$this->_cellCache[$this->_currentObjectID] = array(
|
$this->cellCache[$this->currentObjectID] = array(
|
||||||
'ptr' => ftell($this->_fileHandle),
|
'ptr' => ftell($this->fileHandle),
|
||||||
'sz' => fwrite($this->_fileHandle, serialize($this->_currentObject))
|
'sz' => fwrite($this->fileHandle, serialize($this->currentObject))
|
||||||
);
|
);
|
||||||
$this->_currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->currentObjectID = $this->currentObject = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,13 +81,13 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = $cell;
|
$this->currentObject = $cell;
|
||||||
$this->_currentCellIsDirty = true;
|
$this->currentCellIsDirty = true;
|
||||||
|
|
||||||
return $cell;
|
return $cell;
|
||||||
}
|
}
|
||||||
|
@ -101,26 +101,26 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
|
|
||||||
// Check if the entry that has been requested actually exists
|
// Check if the entry that has been requested actually exists
|
||||||
if (!isset($this->_cellCache[$pCoord])) {
|
if (!isset($this->cellCache[$pCoord])) {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
fseek($this->_fileHandle, $this->_cellCache[$pCoord]['ptr']);
|
fseek($this->fileHandle, $this->cellCache[$pCoord]['ptr']);
|
||||||
$this->_currentObject = unserialize(fread($this->_fileHandle, $this->_cellCache[$pCoord]['sz']));
|
$this->currentObject = unserialize(fread($this->fileHandle, $this->cellCache[$pCoord]['sz']));
|
||||||
// Re-attach this as the cell's parent
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this);
|
$this->currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -130,8 +130,8 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
public function getCellList()
|
public function getCellList()
|
||||||
{
|
{
|
||||||
if ($this->_currentObjectID !== null) {
|
if ($this->currentObjectID !== null) {
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::getCellList();
|
return parent::getCellList();
|
||||||
|
@ -146,13 +146,13 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
||||||
{
|
{
|
||||||
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();
|
||||||
$newFileName = $this->_cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
|
$newFileName = $this->cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
|
||||||
// Copy the existing cell cache file
|
// Copy the existing cell cache file
|
||||||
copy($this->_fileName, $newFileName);
|
copy($this->fileName, $newFileName);
|
||||||
$this->_fileName = $newFileName;
|
$this->fileName = $newFileName;
|
||||||
// Open the copied cell cache file
|
// Open the copied cell cache file
|
||||||
$this->_fileHandle = fopen($this->_fileName, 'a+');
|
$this->fileHandle = fopen($this->fileName, 'a+');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,14 +161,14 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
$this->_cellCache = array();
|
$this->cellCache = array();
|
||||||
|
|
||||||
// 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();
|
||||||
|
@ -182,15 +182,15 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel_Worksheet $parent, $arguments)
|
public function __construct(PHPExcel_Worksheet $parent, $arguments)
|
||||||
{
|
{
|
||||||
$this->_cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== null))
|
$this->cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== null))
|
||||||
? $arguments['dir']
|
? $arguments['dir']
|
||||||
: PHPExcel_Shared_File::sys_get_temp_dir();
|
: PHPExcel_Shared_File::sys_get_temp_dir();
|
||||||
|
|
||||||
parent::__construct($parent);
|
parent::__construct($parent);
|
||||||
if (is_null($this->_fileHandle)) {
|
if (is_null($this->fileHandle)) {
|
||||||
$baseUnique = $this->_getUniqueID();
|
$baseUnique = $this->getUniqueID();
|
||||||
$this->_fileName = $this->_cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
|
$this->fileName = $this->cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
|
||||||
$this->_fileHandle = fopen($this->_fileName, 'a+');
|
$this->fileHandle = fopen($this->fileName, 'a+');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,10 +199,10 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
public function __destruct()
|
public function __destruct()
|
||||||
{
|
{
|
||||||
if (!is_null($this->_fileHandle)) {
|
if (!is_null($this->fileHandle)) {
|
||||||
fclose($this->_fileHandle);
|
fclose($this->fileHandle);
|
||||||
unlink($this->_fileName);
|
unlink($this->fileName);
|
||||||
}
|
}
|
||||||
$this->_fileHandle = null;
|
$this->fileHandle = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,15 +34,15 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage
|
||||||
* @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();
|
||||||
|
|
||||||
$this->_cellCache[$this->_currentObjectID] = igbinary_serialize($this->_currentObject);
|
$this->cellCache[$this->currentObjectID] = igbinary_serialize($this->currentObject);
|
||||||
$this->_currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->currentObjectID = $this->currentObject = null;
|
||||||
} // function _storeData()
|
} // function _storeData()
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,13 +56,13 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = $cell;
|
$this->currentObject = $cell;
|
||||||
$this->_currentCellIsDirty = true;
|
$this->currentCellIsDirty = true;
|
||||||
|
|
||||||
return $cell;
|
return $cell;
|
||||||
} // function addCacheData()
|
} // function addCacheData()
|
||||||
|
@ -77,25 +77,25 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
|
|
||||||
// Check if the entry that has been requested actually exists
|
// Check if the entry that has been requested actually exists
|
||||||
if (!isset($this->_cellCache[$pCoord])) {
|
if (!isset($this->cellCache[$pCoord])) {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = igbinary_unserialize($this->_cellCache[$pCoord]);
|
$this->currentObject = igbinary_unserialize($this->cellCache[$pCoord]);
|
||||||
// Re-attach this as the cell's parent
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this);
|
$this->currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
} // function getCacheData()
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,8 +106,8 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
public function getCellList()
|
public function getCellList()
|
||||||
{
|
{
|
||||||
if ($this->_currentObjectID !== null) {
|
if ($this->currentObjectID !== null) {
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::getCellList();
|
return parent::getCellList();
|
||||||
|
@ -121,14 +121,14 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
$this->_cellCache = array();
|
$this->cellCache = array();
|
||||||
|
|
||||||
// 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()
|
} // function unsetWorksheetCells()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,21 +32,21 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_cachePrefix = null;
|
private $cachePrefix = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache timeout
|
* Cache timeout
|
||||||
*
|
*
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
private $_cacheTime = 600;
|
private $cacheTime = 600;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Memcache interface
|
* Memcache interface
|
||||||
*
|
*
|
||||||
* @var resource
|
* @var resource
|
||||||
*/
|
*/
|
||||||
private $_memcache = null;
|
private $memcache = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,21 +56,21 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
||||||
* @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();
|
||||||
|
|
||||||
$obj = serialize($this->_currentObject);
|
$obj = serialize($this->currentObject);
|
||||||
if (!$this->_memcache->replace($this->_cachePrefix . $this->_currentObjectID . '.cache', $obj, null, $this->_cacheTime)) {
|
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)) {
|
if (!$this->memcache->add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new PHPExcel_Exception("Failed to store cell {$this->_currentObjectID} in MemCache");
|
throw new PHPExcel_Exception("Failed to store cell {$this->currentObjectID} in MemCache");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->currentObjectID = $this->currentObject = null;
|
||||||
} // function _storeData()
|
} // function _storeData()
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,14 +84,14 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
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();
|
||||||
}
|
}
|
||||||
$this->_cellCache[$pCoord] = true;
|
$this->cellCache[$pCoord] = true;
|
||||||
|
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = $cell;
|
$this->currentObject = $cell;
|
||||||
$this->_currentCellIsDirty = true;
|
$this->currentCellIsDirty = true;
|
||||||
|
|
||||||
return $cell;
|
return $cell;
|
||||||
} // function addCacheData()
|
} // function addCacheData()
|
||||||
|
@ -108,11 +108,11 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
||||||
{
|
{
|
||||||
// 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) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Check if the requested entry still exists in Memcache
|
// Check if the requested entry still exists in Memcache
|
||||||
$success = $this->_memcache->get($this->_cachePrefix.$pCoord.'.cache');
|
$success = $this->memcache->get($this->cachePrefix.$pCoord.'.cache');
|
||||||
if ($success === false) {
|
if ($success === false) {
|
||||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
|
@ -133,14 +133,14 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
|
|
||||||
// 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 = $this->_memcache->get($this->_cachePrefix . $pCoord . '.cache');
|
$obj = $this->memcache->get($this->cachePrefix . $pCoord . '.cache');
|
||||||
if ($obj === false) {
|
if ($obj === false) {
|
||||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
|
@ -152,13 +152,13 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = unserialize($obj);
|
$this->currentObject = unserialize($obj);
|
||||||
// Re-attach this as the cell's parent
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this);
|
$this->currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -168,8 +168,8 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
public function getCellList()
|
public function getCellList()
|
||||||
{
|
{
|
||||||
if ($this->_currentObjectID !== null) {
|
if ($this->currentObjectID !== null) {
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::getCellList();
|
return parent::getCellList();
|
||||||
|
@ -184,7 +184,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
||||||
public function deleteCacheData($pCoord)
|
public function deleteCacheData($pCoord)
|
||||||
{
|
{
|
||||||
// Delete the entry from Memcache
|
// Delete the entry from Memcache
|
||||||
$this->_memcache->delete($this->_cachePrefix . $pCoord . '.cache');
|
$this->memcache->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);
|
||||||
|
@ -200,24 +200,24 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
||||||
{
|
{
|
||||||
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 = $this->_memcache->get($this->_cachePrefix.$cellID.'.cache');
|
$obj = $this->memcache->get($this->cachePrefix.$cellID.'.cache');
|
||||||
if ($obj === false) {
|
if ($obj === false) {
|
||||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||||
parent::deleteCacheData($cellID);
|
parent::deleteCacheData($cellID);
|
||||||
throw new PHPExcel_Exception("Cell entry {$cellID} no longer exists in MemCache");
|
throw new PHPExcel_Exception("Cell entry {$cellID} no longer exists in MemCache");
|
||||||
}
|
}
|
||||||
if (!$this->_memcache->add($newCachePrefix . $cellID . '.cache', $obj, null, $this->_cacheTime)) {
|
if (!$this->memcache->add($newCachePrefix . $cellID . '.cache', $obj, null, $this->cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new PHPExcel_Exception("Failed to store cell {$cellID} in MemCache");
|
throw new PHPExcel_Exception("Failed to store cell {$cellID} in MemCache");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_cachePrefix = $newCachePrefix;
|
$this->cachePrefix = $newCachePrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -227,18 +227,18 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush the Memcache cache
|
// Flush the Memcache cache
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
|
|
||||||
$this->_cellCache = array();
|
$this->cellCache = array();
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -253,16 +253,16 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
||||||
$memcachePort = (isset($arguments['memcachePort'])) ? $arguments['memcachePort'] : 11211;
|
$memcachePort = (isset($arguments['memcachePort'])) ? $arguments['memcachePort'] : 11211;
|
||||||
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
||||||
|
|
||||||
if (is_null($this->_cachePrefix)) {
|
if (is_null($this->cachePrefix)) {
|
||||||
$baseUnique = $this->_getUniqueID();
|
$baseUnique = $this->getUniqueID();
|
||||||
$this->_cachePrefix = substr(md5($baseUnique), 0, 8) . '.';
|
$this->cachePrefix = substr(md5($baseUnique), 0, 8) . '.';
|
||||||
|
|
||||||
// Set a new Memcache object and connect to the Memcache server
|
// Set a new Memcache object and connect to the Memcache server
|
||||||
$this->_memcache = new Memcache();
|
$this->memcache = new Memcache();
|
||||||
if (!$this->_memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) {
|
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}");
|
throw new PHPExcel_Exception("Could not connect to MemCache server at {$memcacheServer}:{$memcachePort}");
|
||||||
}
|
}
|
||||||
$this->_cacheTime = $cacheTime;
|
$this->cacheTime = $cacheTime;
|
||||||
|
|
||||||
parent::__construct($parent);
|
parent::__construct($parent);
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
||||||
{
|
{
|
||||||
$cacheList = $this->getCellList();
|
$cacheList = $this->getCellList();
|
||||||
foreach ($cacheList as $cellID) {
|
foreach ($cacheList as $cellID) {
|
||||||
$this->_memcache->delete($this->_cachePrefix.$cellID . '.cache');
|
$this->memcache->delete($this->cachePrefix.$cellID . '.cache');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function _storeData()
|
protected function storeData()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,10 +46,10 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, PHPExcel_Cell $cell)
|
public function addCacheData($pCoord, PHPExcel_Cell $cell)
|
||||||
{
|
{
|
||||||
$this->_cellCache[$pCoord] = $cell;
|
$this->cellCache[$pCoord] = $cell;
|
||||||
|
|
||||||
// Set current entry to the new/updated entry
|
// Set current entry to the new/updated entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
|
|
||||||
return $cell;
|
return $cell;
|
||||||
}
|
}
|
||||||
|
@ -65,17 +65,17 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
// Check if the entry that has been requested actually exists
|
// Check if the entry that has been requested actually exists
|
||||||
if (!isset($this->_cellCache[$pCoord])) {
|
if (!isset($this->cellCache[$pCoord])) {
|
||||||
$this->_currentObjectID = null;
|
$this->currentObjectID = null;
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_cellCache[$pCoord];
|
return $this->cellCache[$pCoord];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,12 +89,12 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C
|
||||||
parent::copyCellCollection($parent);
|
parent::copyCellCollection($parent);
|
||||||
|
|
||||||
$newCollection = array();
|
$newCollection = array();
|
||||||
foreach ($this->_cellCache as $k => &$cell) {
|
foreach ($this->cellCache as $k => &$cell) {
|
||||||
$newCollection[$k] = clone $cell;
|
$newCollection[$k] = clone $cell;
|
||||||
$newCollection[$k]->attach($this);
|
$newCollection[$k]->attach($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_cellCache = $newCollection;
|
$this->cellCache = $newCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,15 +104,15 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C
|
||||||
public function unsetWorksheetCells()
|
public function unsetWorksheetCells()
|
||||||
{
|
{
|
||||||
// Because cells are all stored as intact objects in memory, we need to detach each one from the parent
|
// 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) {
|
foreach ($this->cellCache as $k => &$cell) {
|
||||||
$cell->detach();
|
$cell->detach();
|
||||||
$this->_cellCache[$k] = null;
|
$this->cellCache[$k] = null;
|
||||||
}
|
}
|
||||||
unset($cell);
|
unset($cell);
|
||||||
|
|
||||||
$this->_cellCache = array();
|
$this->cellCache = array();
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,15 +34,15 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora
|
||||||
* @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();
|
||||||
|
|
||||||
$this->_cellCache[$this->_currentObjectID] = gzdeflate(serialize($this->_currentObject));
|
$this->cellCache[$this->currentObjectID] = gzdeflate(serialize($this->currentObject));
|
||||||
$this->_currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->currentObjectID = $this->currentObject = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,13 +56,13 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora
|
||||||
*/
|
*/
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = $cell;
|
$this->currentObject = $cell;
|
||||||
$this->_currentCellIsDirty = true;
|
$this->currentCellIsDirty = true;
|
||||||
|
|
||||||
return $cell;
|
return $cell;
|
||||||
}
|
}
|
||||||
|
@ -77,25 +77,25 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
|
|
||||||
// Check if the entry that has been requested actually exists
|
// Check if the entry that has been requested actually exists
|
||||||
if (!isset($this->_cellCache[$pCoord])) {
|
if (!isset($this->cellCache[$pCoord])) {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = unserialize(gzinflate($this->_cellCache[$pCoord]));
|
$this->currentObject = unserialize(gzinflate($this->cellCache[$pCoord]));
|
||||||
// Re-attach this as the cell's parent
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this);
|
$this->currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,8 +106,8 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora
|
||||||
*/
|
*/
|
||||||
public function getCellList()
|
public function getCellList()
|
||||||
{
|
{
|
||||||
if ($this->_currentObjectID !== null) {
|
if ($this->currentObjectID !== null) {
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::getCellList();
|
return parent::getCellList();
|
||||||
|
@ -121,13 +121,13 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
$this->_cellCache = array();
|
$this->cellCache = array();
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,15 +34,15 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec
|
||||||
* @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();
|
||||||
|
|
||||||
$this->_cellCache[$this->_currentObjectID] = serialize($this->_currentObject);
|
$this->cellCache[$this->currentObjectID] = serialize($this->currentObject);
|
||||||
$this->_currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->currentObjectID = $this->currentObject = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,13 +55,13 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec
|
||||||
*/
|
*/
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = $cell;
|
$this->currentObject = $cell;
|
||||||
$this->_currentCellIsDirty = true;
|
$this->currentCellIsDirty = true;
|
||||||
|
|
||||||
return $cell;
|
return $cell;
|
||||||
}
|
}
|
||||||
|
@ -75,25 +75,25 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
|
|
||||||
// Check if the entry that has been requested actually exists
|
// Check if the entry that has been requested actually exists
|
||||||
if (!isset($this->_cellCache[$pCoord])) {
|
if (!isset($this->cellCache[$pCoord])) {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = unserialize($this->_cellCache[$pCoord]);
|
$this->currentObject = unserialize($this->cellCache[$pCoord]);
|
||||||
// Re-attach this as the cell's parent
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this);
|
$this->currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,8 +103,8 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec
|
||||||
*/
|
*/
|
||||||
public function getCellList()
|
public function getCellList()
|
||||||
{
|
{
|
||||||
if ($this->_currentObjectID !== null) {
|
if ($this->currentObjectID !== null) {
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::getCellList();
|
return parent::getCellList();
|
||||||
|
@ -117,13 +117,13 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
$this->_cellCache = array();
|
$this->cellCache = array();
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,14 +32,14 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_fileHandle = null;
|
private $fileHandle = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Memory limit to use before reverting to file cache
|
* Memory limit to use before reverting to file cache
|
||||||
*
|
*
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
private $_memoryCacheSize = null;
|
private $memoryCacheSize = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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",
|
||||||
|
@ -48,20 +48,20 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
||||||
* @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();
|
||||||
|
|
||||||
fseek($this->_fileHandle, 0, SEEK_END);
|
fseek($this->fileHandle, 0, SEEK_END);
|
||||||
|
|
||||||
$this->_cellCache[$this->_currentObjectID] = array(
|
$this->cellCache[$this->currentObjectID] = array(
|
||||||
'ptr' => ftell($this->_fileHandle),
|
'ptr' => ftell($this->fileHandle),
|
||||||
'sz' => fwrite($this->_fileHandle, serialize($this->_currentObject))
|
'sz' => fwrite($this->fileHandle, serialize($this->currentObject))
|
||||||
);
|
);
|
||||||
$this->_currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->currentObjectID = $this->currentObject = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,13 +75,13 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = $cell;
|
$this->currentObject = $cell;
|
||||||
$this->_currentCellIsDirty = true;
|
$this->currentCellIsDirty = true;
|
||||||
|
|
||||||
return $cell;
|
return $cell;
|
||||||
}
|
}
|
||||||
|
@ -96,26 +96,26 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
|
|
||||||
// Check if the entry that has been requested actually exists
|
// Check if the entry that has been requested actually exists
|
||||||
if (!isset($this->_cellCache[$pCoord])) {
|
if (!isset($this->cellCache[$pCoord])) {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
fseek($this->_fileHandle, $this->_cellCache[$pCoord]['ptr']);
|
fseek($this->fileHandle, $this->cellCache[$pCoord]['ptr']);
|
||||||
$this->_currentObject = unserialize(fread($this->_fileHandle, $this->_cellCache[$pCoord]['sz']));
|
$this->currentObject = unserialize(fread($this->fileHandle, $this->cellCache[$pCoord]['sz']));
|
||||||
// Re-attach this as the cell's parent
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this);
|
$this->currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -125,8 +125,8 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
public function getCellList()
|
public function getCellList()
|
||||||
{
|
{
|
||||||
if ($this->_currentObjectID !== null) {
|
if ($this->currentObjectID !== null) {
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::getCellList();
|
return parent::getCellList();
|
||||||
|
@ -142,13 +142,13 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
||||||
{
|
{
|
||||||
parent::copyCellCollection($parent);
|
parent::copyCellCollection($parent);
|
||||||
// Open a new stream for the cell cache data
|
// Open a new stream for the cell cache data
|
||||||
$newFileHandle = fopen('php://temp/maxmemory:' . $this->_memoryCacheSize, 'a+');
|
$newFileHandle = fopen('php://temp/maxmemory:' . $this->memoryCacheSize, 'a+');
|
||||||
// Copy the existing cell cache data to the new stream
|
// Copy the existing cell cache data to the new stream
|
||||||
fseek($this->_fileHandle, 0);
|
fseek($this->fileHandle, 0);
|
||||||
while (!feof($this->_fileHandle)) {
|
while (!feof($this->fileHandle)) {
|
||||||
fwrite($newFileHandle, fread($this->_fileHandle, 1024));
|
fwrite($newFileHandle, fread($this->fileHandle, 1024));
|
||||||
}
|
}
|
||||||
$this->_fileHandle = $newFileHandle;
|
$this->fileHandle = $newFileHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,14 +158,14 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
$this->_cellCache = array();
|
$this->cellCache = array();
|
||||||
|
|
||||||
// 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 php://temp file
|
// Close down the php://temp file
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
|
@ -179,11 +179,11 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel_Worksheet $parent, $arguments)
|
public function __construct(PHPExcel_Worksheet $parent, $arguments)
|
||||||
{
|
{
|
||||||
$this->_memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB';
|
$this->memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB';
|
||||||
|
|
||||||
parent::__construct($parent);
|
parent::__construct($parent);
|
||||||
if (is_null($this->_fileHandle)) {
|
if (is_null($this->fileHandle)) {
|
||||||
$this->_fileHandle = fopen('php://temp/maxmemory:' . $this->_memoryCacheSize, 'a+');
|
$this->fileHandle = fopen('php://temp/maxmemory:' . $this->memoryCacheSize, 'a+');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,9 +192,9 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
public function __destruct()
|
public function __destruct()
|
||||||
{
|
{
|
||||||
if (!is_null($this->_fileHandle)) {
|
if (!is_null($this->fileHandle)) {
|
||||||
fclose($this->_fileHandle);
|
fclose($this->fileHandle);
|
||||||
}
|
}
|
||||||
$this->_fileHandle = null;
|
$this->fileHandle = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,14 +32,14 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_TableName = null;
|
private $TableName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database handle
|
* Database handle
|
||||||
*
|
*
|
||||||
* @var resource
|
* @var resource
|
||||||
*/
|
*/
|
||||||
private $_DBHandle = null;
|
private $DBHandle = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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",
|
||||||
|
@ -48,17 +48,17 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
||||||
* @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 (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')")) {
|
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()));
|
throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||||
}
|
}
|
||||||
$this->_currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->currentObjectID = $this->currentObject = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,13 +71,13 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
||||||
*/
|
*/
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = $cell;
|
$this->currentObject = $cell;
|
||||||
$this->_currentCellIsDirty = true;
|
$this->currentCellIsDirty = true;
|
||||||
|
|
||||||
return $cell;
|
return $cell;
|
||||||
}
|
}
|
||||||
|
@ -91,30 +91,30 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
|
|
||||||
$query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
$query = "SELECT value FROM kvp_".$this->TableName." WHERE id='".$pCoord."'";
|
||||||
$cellResultSet = $this->_DBHandle->query($query, SQLITE_ASSOC);
|
$cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC);
|
||||||
if ($cellResultSet === false) {
|
if ($cellResultSet === false) {
|
||||||
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||||
} elseif ($cellResultSet->numRows() == 0) {
|
} elseif ($cellResultSet->numRows() == 0) {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
|
|
||||||
$cellResult = $cellResultSet->fetchSingle();
|
$cellResult = $cellResultSet->fetchSingle();
|
||||||
$this->_currentObject = unserialize($cellResult);
|
$this->currentObject = unserialize($cellResult);
|
||||||
// Re-attach this as the cell's parent
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this);
|
$this->currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -125,15 +125,15 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
||||||
*/
|
*/
|
||||||
public function isDataSet($pCoord)
|
public function isDataSet($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the requested entry exists in the cache
|
// Check if the requested entry exists in the cache
|
||||||
$query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
$query = "SELECT id FROM kvp_".$this->TableName." WHERE id='".$pCoord."'";
|
||||||
$cellResultSet = $this->_DBHandle->query($query, SQLITE_ASSOC);
|
$cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC);
|
||||||
if ($cellResultSet === false) {
|
if ($cellResultSet === false) {
|
||||||
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||||
} elseif ($cellResultSet->numRows() == 0) {
|
} elseif ($cellResultSet->numRows() == 0) {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
return false;
|
return false;
|
||||||
|
@ -149,18 +149,18 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord)
|
public function deleteCacheData($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
$this->_currentObject->detach();
|
$this->currentObject->detach();
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->currentObjectID = $this->currentObject = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the requested entry exists in the cache
|
// Check if the requested entry exists in the cache
|
||||||
$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
$query = "DELETE FROM kvp_".$this->TableName." WHERE id='".$pCoord."'";
|
||||||
if (!$this->_DBHandle->queryExec($query)) {
|
if (!$this->DBHandle->queryExec($query)) {
|
||||||
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -172,20 +172,20 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
||||||
*/
|
*/
|
||||||
public function moveCell($fromAddress, $toAddress)
|
public function moveCell($fromAddress, $toAddress)
|
||||||
{
|
{
|
||||||
if ($fromAddress === $this->_currentObjectID) {
|
if ($fromAddress === $this->currentObjectID) {
|
||||||
$this->_currentObjectID = $toAddress;
|
$this->currentObjectID = $toAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$toAddress."'";
|
$query = "DELETE FROM kvp_".$this->TableName." WHERE id='".$toAddress."'";
|
||||||
$result = $this->_DBHandle->exec($query);
|
$result = $this->DBHandle->exec($query);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = "UPDATE kvp_".$this->_TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'";
|
$query = "UPDATE kvp_".$this->TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'";
|
||||||
$result = $this->_DBHandle->exec($query);
|
$result = $this->DBHandle->exec($query);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -198,14 +198,14 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
||||||
*/
|
*/
|
||||||
public function getCellList()
|
public function getCellList()
|
||||||
{
|
{
|
||||||
if ($this->_currentObjectID !== null) {
|
if ($this->currentObjectID !== null) {
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = "SELECT id FROM kvp_".$this->_TableName;
|
$query = "SELECT id FROM kvp_".$this->TableName;
|
||||||
$cellIdsResult = $this->_DBHandle->unbufferedQuery($query, SQLITE_ASSOC);
|
$cellIdsResult = $this->DBHandle->unbufferedQuery($query, SQLITE_ASSOC);
|
||||||
if ($cellIdsResult === false) {
|
if ($cellIdsResult === false) {
|
||||||
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$cellKeys = array();
|
$cellKeys = array();
|
||||||
|
@ -224,19 +224,19 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
||||||
{
|
{
|
||||||
$this->_currentCellIsDirty;
|
$this->currentCellIsDirty;
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
|
|
||||||
// Get a new id for the new table name
|
// Get a new id for the new table name
|
||||||
$tableName = str_replace('.', '_', $this->_getUniqueID());
|
$tableName = str_replace('.', '_', $this->getUniqueID());
|
||||||
if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
if (!$this->DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
||||||
AS SELECT * FROM kvp_'.$this->_TableName)
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -246,12 +246,12 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
||||||
*/
|
*/
|
||||||
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();
|
||||||
|
@ -265,16 +265,16 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
||||||
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)')) {
|
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()));
|
throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,10 +284,10 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
||||||
*/
|
*/
|
||||||
public function __destruct()
|
public function __destruct()
|
||||||
{
|
{
|
||||||
if (!is_null($this->_DBHandle)) {
|
if (!is_null($this->DBHandle)) {
|
||||||
$this->_DBHandle->queryExec('DROP TABLE kvp_'.$this->_TableName);
|
$this->DBHandle->queryExec('DROP TABLE kvp_'.$this->TableName);
|
||||||
}
|
}
|
||||||
$this->_DBHandle = null;
|
$this->DBHandle = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,42 +32,42 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_TableName = null;
|
private $TableName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database handle
|
* Database handle
|
||||||
*
|
*
|
||||||
* @var resource
|
* @var resource
|
||||||
*/
|
*/
|
||||||
private $_DBHandle = null;
|
private $DBHandle = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepared statement for a SQLite3 select query
|
* Prepared statement for a SQLite3 select query
|
||||||
*
|
*
|
||||||
* @var SQLite3Stmt
|
* @var SQLite3Stmt
|
||||||
*/
|
*/
|
||||||
private $_selectQuery;
|
private $selectQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepared statement for a SQLite3 insert query
|
* Prepared statement for a SQLite3 insert query
|
||||||
*
|
*
|
||||||
* @var SQLite3Stmt
|
* @var SQLite3Stmt
|
||||||
*/
|
*/
|
||||||
private $_insertQuery;
|
private $insertQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepared statement for a SQLite3 update query
|
* Prepared statement for a SQLite3 update query
|
||||||
*
|
*
|
||||||
* @var SQLite3Stmt
|
* @var SQLite3Stmt
|
||||||
*/
|
*/
|
||||||
private $_updateQuery;
|
private $updateQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepared statement for a SQLite3 delete query
|
* Prepared statement for a SQLite3 delete query
|
||||||
*
|
*
|
||||||
* @var SQLite3Stmt
|
* @var SQLite3Stmt
|
||||||
*/
|
*/
|
||||||
private $_deleteQuery;
|
private $deleteQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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",
|
||||||
|
@ -76,20 +76,20 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
||||||
* @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();
|
||||||
|
|
||||||
$this->_insertQuery->bindValue('id', $this->_currentObjectID, SQLITE3_TEXT);
|
$this->insertQuery->bindValue('id', $this->currentObjectID, SQLITE3_TEXT);
|
||||||
$this->_insertQuery->bindValue('data', serialize($this->_currentObject), SQLITE3_BLOB);
|
$this->insertQuery->bindValue('data', serialize($this->currentObject), SQLITE3_BLOB);
|
||||||
$result = $this->_insertQuery->execute();
|
$result = $this->insertQuery->execute();
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
$this->_currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->currentObjectID = $this->currentObject = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,13 +102,13 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = $cell;
|
$this->currentObject = $cell;
|
||||||
$this->_currentCellIsDirty = true;
|
$this->currentCellIsDirty = true;
|
||||||
|
|
||||||
return $cell;
|
return $cell;
|
||||||
}
|
}
|
||||||
|
@ -122,15 +122,15 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
|
|
||||||
$this->_selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
$this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
||||||
$cellResult = $this->_selectQuery->execute();
|
$cellResult = $this->selectQuery->execute();
|
||||||
if ($cellResult === false) {
|
if ($cellResult === false) {
|
||||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
||||||
if ($cellData === false) {
|
if ($cellData === false) {
|
||||||
|
@ -139,14 +139,14 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
|
|
||||||
$this->_currentObject = unserialize($cellData['value']);
|
$this->currentObject = unserialize($cellData['value']);
|
||||||
// Re-attach this as the cell's parent
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this);
|
$this->currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,15 +157,15 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
public function isDataSet($pCoord)
|
public function isDataSet($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the requested entry exists in the cache
|
// Check if the requested entry exists in the cache
|
||||||
$this->_selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
$this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
||||||
$cellResult = $this->_selectQuery->execute();
|
$cellResult = $this->selectQuery->execute();
|
||||||
if ($cellResult === false) {
|
if ($cellResult === false) {
|
||||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
||||||
|
|
||||||
|
@ -180,19 +180,19 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord)
|
public function deleteCacheData($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
$this->_currentObject->detach();
|
$this->currentObject->detach();
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->currentObjectID = $this->currentObject = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the requested entry exists in the cache
|
// Check if the requested entry exists in the cache
|
||||||
$this->_deleteQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
$this->deleteQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
||||||
$result = $this->_deleteQuery->execute();
|
$result = $this->deleteQuery->execute();
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -204,21 +204,21 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
public function moveCell($fromAddress, $toAddress)
|
public function moveCell($fromAddress, $toAddress)
|
||||||
{
|
{
|
||||||
if ($fromAddress === $this->_currentObjectID) {
|
if ($fromAddress === $this->currentObjectID) {
|
||||||
$this->_currentObjectID = $toAddress;
|
$this->currentObjectID = $toAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_deleteQuery->bindValue('id', $toAddress, SQLITE3_TEXT);
|
$this->deleteQuery->bindValue('id', $toAddress, SQLITE3_TEXT);
|
||||||
$result = $this->_deleteQuery->execute();
|
$result = $this->deleteQuery->execute();
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_updateQuery->bindValue('toid', $toAddress, SQLITE3_TEXT);
|
$this->updateQuery->bindValue('toid', $toAddress, SQLITE3_TEXT);
|
||||||
$this->_updateQuery->bindValue('fromid', $fromAddress, SQLITE3_TEXT);
|
$this->updateQuery->bindValue('fromid', $fromAddress, SQLITE3_TEXT);
|
||||||
$result = $this->_updateQuery->execute();
|
$result = $this->updateQuery->execute();
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -231,14 +231,14 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
public function getCellList()
|
public function getCellList()
|
||||||
{
|
{
|
||||||
if ($this->_currentObjectID !== null) {
|
if ($this->currentObjectID !== null) {
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = "SELECT id FROM kvp_".$this->_TableName;
|
$query = "SELECT id FROM kvp_".$this->TableName;
|
||||||
$cellIdsResult = $this->_DBHandle->query($query);
|
$cellIdsResult = $this->DBHandle->query($query);
|
||||||
if ($cellIdsResult === false) {
|
if ($cellIdsResult === false) {
|
||||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
$cellKeys = array();
|
$cellKeys = array();
|
||||||
|
@ -257,19 +257,19 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
||||||
{
|
{
|
||||||
$this->_currentCellIsDirty;
|
$this->currentCellIsDirty;
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
|
|
||||||
// Get a new id for the new table name
|
// Get a new id for the new table name
|
||||||
$tableName = str_replace('.', '_', $this->_getUniqueID());
|
$tableName = str_replace('.', '_', $this->getUniqueID());
|
||||||
if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
if (!$this->DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
||||||
AS SELECT * FROM kvp_'.$this->_TableName)
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -279,12 +279,12 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
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();
|
||||||
|
@ -298,23 +298,23 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
||||||
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)')) {
|
if (!$this->DBHandle->exec('CREATE TABLE kvp_'.$this->TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
|
||||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_selectQuery = $this->_DBHandle->prepare("SELECT value FROM kvp_".$this->_TableName." WHERE id = :id");
|
$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->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->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");
|
$this->deleteQuery = $this->DBHandle->prepare("DELETE FROM kvp_".$this->TableName." WHERE id = :id");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -322,11 +322,11 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
||||||
*/
|
*/
|
||||||
public function __destruct()
|
public function __destruct()
|
||||||
{
|
{
|
||||||
if (!is_null($this->_DBHandle)) {
|
if (!is_null($this->DBHandle)) {
|
||||||
$this->_DBHandle->exec('DROP TABLE kvp_'.$this->_TableName);
|
$this->DBHandle->exec('DROP TABLE kvp_'.$this->TableName);
|
||||||
$this->_DBHandle->close();
|
$this->DBHandle->close();
|
||||||
}
|
}
|
||||||
$this->_DBHandle = null;
|
$this->DBHandle = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,14 +32,14 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_cachePrefix = null;
|
private $cachePrefix = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache timeout
|
* Cache timeout
|
||||||
*
|
*
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
private $_cacheTime = 600;
|
private $cacheTime = 600;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,27 +49,27 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
||||||
* @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();
|
||||||
|
|
||||||
$obj = serialize($this->_currentObject);
|
$obj = serialize($this->currentObject);
|
||||||
if (wincache_ucache_exists($this->_cachePrefix.$this->_currentObjectID.'.cache')) {
|
if (wincache_ucache_exists($this->cachePrefix.$this->currentObjectID.'.cache')) {
|
||||||
if (!wincache_ucache_set($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
|
if (!wincache_ucache_set($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
|
throw new PHPExcel_Exception('Failed to store cell '.$this->currentObjectID.' in WinCache');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!wincache_ucache_add($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
|
if (!wincache_ucache_add($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
|
throw new PHPExcel_Exception('Failed to store cell '.$this->currentObjectID.' in WinCache');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->currentObjectID = $this->currentObject = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,14 +82,14 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
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();
|
||||||
}
|
}
|
||||||
$this->_cellCache[$pCoord] = true;
|
$this->cellCache[$pCoord] = true;
|
||||||
|
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = $cell;
|
$this->currentObject = $cell;
|
||||||
$this->_currentCellIsDirty = true;
|
$this->currentCellIsDirty = true;
|
||||||
|
|
||||||
return $cell;
|
return $cell;
|
||||||
}
|
}
|
||||||
|
@ -104,11 +104,11 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
||||||
{
|
{
|
||||||
// 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) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Check if the requested entry still exists in cache
|
// Check if the requested entry still exists in cache
|
||||||
$success = wincache_ucache_exists($this->_cachePrefix.$pCoord.'.cache');
|
$success = wincache_ucache_exists($this->cachePrefix.$pCoord.'.cache');
|
||||||
if ($success === false) {
|
if ($success === false) {
|
||||||
// Entry no longer exists in Wincache, so clear it from the cache array
|
// Entry no longer exists in Wincache, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
|
@ -129,16 +129,16 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->currentObjectID) {
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
|
|
||||||
// Check if the entry that has been requested actually exists
|
// Check if the entry that has been requested actually exists
|
||||||
$obj = null;
|
$obj = null;
|
||||||
if (parent::isDataSet($pCoord)) {
|
if (parent::isDataSet($pCoord)) {
|
||||||
$success = false;
|
$success = false;
|
||||||
$obj = wincache_ucache_get($this->_cachePrefix.$pCoord.'.cache', $success);
|
$obj = wincache_ucache_get($this->cachePrefix.$pCoord.'.cache', $success);
|
||||||
if ($success === false) {
|
if ($success === false) {
|
||||||
// Entry no longer exists in WinCache, so clear it from the cache array
|
// Entry no longer exists in WinCache, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
|
@ -150,13 +150,13 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->currentObjectID = $pCoord;
|
||||||
$this->_currentObject = unserialize($obj);
|
$this->currentObject = unserialize($obj);
|
||||||
// Re-attach this as the cell's parent
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this);
|
$this->currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->currentObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,8 +167,8 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
public function getCellList()
|
public function getCellList()
|
||||||
{
|
{
|
||||||
if ($this->_currentObjectID !== null) {
|
if ($this->currentObjectID !== null) {
|
||||||
$this->_storeData();
|
$this->storeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::getCellList();
|
return parent::getCellList();
|
||||||
|
@ -183,7 +183,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
||||||
public function deleteCacheData($pCoord)
|
public function deleteCacheData($pCoord)
|
||||||
{
|
{
|
||||||
// Delete the entry from Wincache
|
// Delete the entry from Wincache
|
||||||
wincache_ucache_delete($this->_cachePrefix.$pCoord.'.cache');
|
wincache_ucache_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);
|
||||||
|
@ -199,25 +199,25 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
||||||
{
|
{
|
||||||
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) {
|
||||||
$success = false;
|
$success = false;
|
||||||
$obj = wincache_ucache_get($this->_cachePrefix.$cellID.'.cache', $success);
|
$obj = wincache_ucache_get($this->cachePrefix.$cellID.'.cache', $success);
|
||||||
if ($success === false) {
|
if ($success === false) {
|
||||||
// Entry no longer exists in WinCache, so clear it from the cache array
|
// Entry no longer exists in WinCache, so clear it from the cache array
|
||||||
parent::deleteCacheData($cellID);
|
parent::deleteCacheData($cellID);
|
||||||
throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache');
|
throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache');
|
||||||
}
|
}
|
||||||
if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->_cacheTime)) {
|
if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache');
|
throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_cachePrefix = $newCachePrefix;
|
$this->cachePrefix = $newCachePrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -228,18 +228,18 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush the WinCache cache
|
// Flush the WinCache cache
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
|
|
||||||
$this->_cellCache = array();
|
$this->cellCache = array();
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -252,10 +252,10 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
||||||
{
|
{
|
||||||
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
||||||
|
|
||||||
if (is_null($this->_cachePrefix)) {
|
if (is_null($this->cachePrefix)) {
|
||||||
$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);
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
||||||
{
|
{
|
||||||
$cacheList = $this->getCellList();
|
$cacheList = $this->getCellList();
|
||||||
foreach ($cacheList as $cellID) {
|
foreach ($cacheList as $cellID) {
|
||||||
wincache_ucache_delete($this->_cachePrefix.$cellID.'.cache');
|
wincache_ucache_delete($this->cachePrefix.$cellID.'.cache');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,21 +44,21 @@ class PHPExcel_CachedObjectStorageFactory
|
||||||
*
|
*
|
||||||
* @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
|
||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
private static $_storageMethods = array(
|
private static $storageMethods = array(
|
||||||
self::cache_in_memory,
|
self::cache_in_memory,
|
||||||
self::cache_in_memory_gzip,
|
self::cache_in_memory_gzip,
|
||||||
self::cache_in_memory_serialized,
|
self::cache_in_memory_serialized,
|
||||||
|
@ -77,7 +77,7 @@ class PHPExcel_CachedObjectStorageFactory
|
||||||
*
|
*
|
||||||
* @var array of mixed array
|
* @var array of mixed array
|
||||||
*/
|
*/
|
||||||
private static $_storageMethodDefaultParameters = array(
|
private static $storageMethodDefaultParameters = array(
|
||||||
self::cache_in_memory => array(
|
self::cache_in_memory => array(
|
||||||
),
|
),
|
||||||
self::cache_in_memory_gzip => array(
|
self::cache_in_memory_gzip => array(
|
||||||
|
@ -109,7 +109,7 @@ class PHPExcel_CachedObjectStorageFactory
|
||||||
*
|
*
|
||||||
* @var array of mixed array
|
* @var array of mixed array
|
||||||
*/
|
*/
|
||||||
private static $_storageMethodParameters = array();
|
private static $storageMethodParameters = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the current cache storage method
|
* Return the current cache storage method
|
||||||
|
@ -118,7 +118,7 @@ class PHPExcel_CachedObjectStorageFactory
|
||||||
**/
|
**/
|
||||||
public static function getCacheStorageMethod()
|
public static function getCacheStorageMethod()
|
||||||
{
|
{
|
||||||
return self::$_cacheStorageMethod;
|
return self::$cacheStorageMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -128,7 +128,7 @@ class PHPExcel_CachedObjectStorageFactory
|
||||||
**/
|
**/
|
||||||
public static function getCacheStorageClass()
|
public static function getCacheStorageClass()
|
||||||
{
|
{
|
||||||
return self::$_cacheStorageClass;
|
return self::$cacheStorageClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,7 +138,7 @@ class PHPExcel_CachedObjectStorageFactory
|
||||||
**/
|
**/
|
||||||
public static function getAllCacheStorageMethods()
|
public static function getAllCacheStorageMethods()
|
||||||
{
|
{
|
||||||
return self::$_storageMethods;
|
return self::$storageMethods;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -149,7 +149,7 @@ 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;
|
||||||
|
@ -168,7 +168,7 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,16 +178,16 @@ class PHPExcel_CachedObjectStorageFactory
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -201,14 +201,14 @@ 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(
|
$instance = new self::$cacheStorageClass(
|
||||||
$parent,
|
$parent,
|
||||||
self::$_storageMethodParameters[self::$_cacheStorageMethod]
|
self::$storageMethodParameters[self::$cacheStorageMethod]
|
||||||
);
|
);
|
||||||
if ($instance !== null) {
|
if ($instance !== null) {
|
||||||
return $instance;
|
return $instance;
|
||||||
|
@ -224,8 +224,8 @@ class PHPExcel_CachedObjectStorageFactory
|
||||||
**/
|
**/
|
||||||
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ class PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
*
|
*
|
||||||
* @var mixed[]
|
* @var mixed[]
|
||||||
*/
|
*/
|
||||||
private $_stack = array();
|
private $stack = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of entries on the stack
|
* Return the number of entries on the stack
|
||||||
|
@ -41,7 +41,7 @@ class PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
*/
|
*/
|
||||||
public function count()
|
public function count()
|
||||||
{
|
{
|
||||||
return count($this->_stack);
|
return count($this->stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +51,7 @@ class PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
*/
|
*/
|
||||||
public function push($value)
|
public function push($value)
|
||||||
{
|
{
|
||||||
$this->_stack[$value] = $value;
|
$this->stack[$value] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +61,7 @@ class PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
*/
|
*/
|
||||||
public function pop()
|
public function pop()
|
||||||
{
|
{
|
||||||
return array_pop($this->_stack);
|
return array_pop($this->stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,7 +71,7 @@ class PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
*/
|
*/
|
||||||
public function onStack($value)
|
public function onStack($value)
|
||||||
{
|
{
|
||||||
return isset($this->_stack[$value]);
|
return isset($this->stack[$value]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,7 +79,7 @@ class PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
*/
|
*/
|
||||||
public function clear()
|
public function clear()
|
||||||
{
|
{
|
||||||
$this->_stack = array();
|
$this->stack = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,6 +89,6 @@ class PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
*/
|
*/
|
||||||
public function showStack()
|
public function showStack()
|
||||||
{
|
{
|
||||||
return $this->_stack;
|
return $this->stack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ class PHPExcel_CalcEngine_Logger
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_writeDebugLog = false;
|
private $writeDebugLog = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to determine whether a debug log should be echoed by the calculation engine
|
* Flag to determine whether a debug log should be echoed by the calculation engine
|
||||||
|
@ -44,21 +44,21 @@ class PHPExcel_CalcEngine_Logger
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_echoDebugLog = false;
|
private $echoDebugLog = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The debug log generated by the calculation engine
|
* The debug log generated by the calculation engine
|
||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
private $_debugLog = array();
|
private $debugLog = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The calculation engine cell reference stack
|
* The calculation engine cell reference stack
|
||||||
*
|
*
|
||||||
* @var PHPExcel_CalcEngine_CyclicReferenceStack
|
* @var PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
*/
|
*/
|
||||||
private $_cellStack;
|
private $cellStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiate a Calculation engine logger
|
* Instantiate a Calculation engine logger
|
||||||
|
@ -67,7 +67,7 @@ class PHPExcel_CalcEngine_Logger
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel_CalcEngine_CyclicReferenceStack $stack)
|
public function __construct(PHPExcel_CalcEngine_CyclicReferenceStack $stack)
|
||||||
{
|
{
|
||||||
$this->_cellStack = $stack;
|
$this->cellStack = $stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,7 +77,7 @@ class PHPExcel_CalcEngine_Logger
|
||||||
*/
|
*/
|
||||||
public function setWriteDebugLog($pValue = false)
|
public function setWriteDebugLog($pValue = false)
|
||||||
{
|
{
|
||||||
$this->_writeDebugLog = $pValue;
|
$this->writeDebugLog = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,7 +87,7 @@ class PHPExcel_CalcEngine_Logger
|
||||||
*/
|
*/
|
||||||
public function getWriteDebugLog()
|
public function getWriteDebugLog()
|
||||||
{
|
{
|
||||||
return $this->_writeDebugLog;
|
return $this->writeDebugLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,7 +97,7 @@ class PHPExcel_CalcEngine_Logger
|
||||||
*/
|
*/
|
||||||
public function setEchoDebugLog($pValue = false)
|
public function setEchoDebugLog($pValue = false)
|
||||||
{
|
{
|
||||||
$this->_echoDebugLog = $pValue;
|
$this->echoDebugLog = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,7 +107,7 @@ class PHPExcel_CalcEngine_Logger
|
||||||
*/
|
*/
|
||||||
public function getEchoDebugLog()
|
public function getEchoDebugLog()
|
||||||
{
|
{
|
||||||
return $this->_echoDebugLog;
|
return $this->echoDebugLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,17 +116,17 @@ class PHPExcel_CalcEngine_Logger
|
||||||
public function writeDebugLog()
|
public function writeDebugLog()
|
||||||
{
|
{
|
||||||
// Only write the debug log if logging is enabled
|
// Only write the debug log if logging is enabled
|
||||||
if ($this->_writeDebugLog) {
|
if ($this->writeDebugLog) {
|
||||||
$message = implode(func_get_args());
|
$message = implode(func_get_args());
|
||||||
$cellReference = implode(' -> ', $this->_cellStack->showStack());
|
$cellReference = implode(' -> ', $this->cellStack->showStack());
|
||||||
if ($this->_echoDebugLog) {
|
if ($this->echoDebugLog) {
|
||||||
echo $cellReference,
|
echo $cellReference,
|
||||||
($this->_cellStack->count() > 0 ? ' => ' : ''),
|
($this->cellStack->count() > 0 ? ' => ' : ''),
|
||||||
$message,
|
$message,
|
||||||
PHP_EOL;
|
PHP_EOL;
|
||||||
}
|
}
|
||||||
$this->_debugLog[] = $cellReference .
|
$this->debugLog[] = $cellReference .
|
||||||
($this->_cellStack->count() > 0 ? ' => ' : '') .
|
($this->cellStack->count() > 0 ? ' => ' : '') .
|
||||||
$message;
|
$message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ class PHPExcel_CalcEngine_Logger
|
||||||
*/
|
*/
|
||||||
public function clearLog()
|
public function clearLog()
|
||||||
{
|
{
|
||||||
$this->_debugLog = array();
|
$this->debugLog = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,6 +146,6 @@ class PHPExcel_CalcEngine_Logger
|
||||||
*/
|
*/
|
||||||
public function getLog()
|
public function getLog()
|
||||||
{
|
{
|
||||||
return $this->_debugLog;
|
return $this->debugLog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
|
|
||||||
Planned for 1.8.2
|
Planned for 1.8.2
|
||||||
|
- Bugfix: (MBaker) - Fix to getCell() method when cell reference includes a worksheet reference
|
||||||
|
|
||||||
|
|
||||||
2015-04-30 (v1.8.1):
|
2015-04-30 (v1.8.1):
|
||||||
|
|
Loading…
Reference in New Issue