/** * Clone the cell collection * * @param \PHPExcel\Worksheet $parent The new worksheet that we're copying to * @throws \PHPExcel\Exception */ public function copyCellCollection(\PHPExcel\Worksheet $parent) { parent::copyCellCollection($parent); // Get a new id for the new file name $baseUnique = $this->getUniqueID(); $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.'; $cacheList = $this->getCellList(); foreach ($cacheList as $cellID) { if ($cellID != $this->currentObjectID) { $success = false; $obj = wincache_ucache_get($this->cachePrefix . $cellID . '.cache', $success); if ($success === false) { // Entry no longer exists in WinCache, so clear it from the cache array parent::deleteCacheData($cellID); throw new \PHPExcel\Exception('Cell entry ' . $cellID . ' no longer exists in Wincache'); } if (!wincache_ucache_add($newCachePrefix . $cellID . '.cache', $obj, $this->cacheTime)) { $this->__destruct(); throw new \PHPExcel\Exception('Failed to store cell ' . $cellID . ' in Wincache'); } } } $this->cachePrefix = $newCachePrefix; }
/** * Clone the cell collection * * @param \PHPExcel\Worksheet $parent The new worksheet that we're copying to * @throws \PHPExcel\Exception */ public function copyCellCollection(\PHPExcel\Worksheet $parent) { parent::copyCellCollection($parent); // Get a new id for the new file name $baseUnique = $this->getUniqueID(); $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.'; $cacheList = $this->getCellList(); foreach ($cacheList as $cellID) { if ($cellID != $this->currentObjectID) { $obj = $this->memcache->get($this->cachePrefix . $cellID . '.cache'); if ($obj === false) { // Entry no longer exists in Memcache, so clear it from the cache array parent::deleteCacheData($cellID); throw new \PHPExcel\Exception("Cell entry {$cellID} no longer exists in MemCache"); } if (!$this->memcache->add($newCachePrefix . $cellID . '.cache', $obj, null, $this->cacheTime)) { $this->__destruct(); throw new \PHPExcel\Exception("Failed to store cell {$cellID} in MemCache"); } } } $this->cachePrefix = $newCachePrefix; }