You are here

public function PHPExcel_CachedObjectStorage_Wincache::copyCellCollection in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/Wincache.php \PHPExcel_CachedObjectStorage_Wincache::copyCellCollection()

* Clone the cell collection * *

Parameters

PHPExcel_Worksheet $parent The new worksheet: * @return void

Overrides PHPExcel_CachedObjectStorage_CacheBase::copyCellCollection

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/Wincache.php, line 204

Class

PHPExcel_CachedObjectStorage_Wincache
PHPExcel_CachedObjectStorage_Wincache

Code

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;
}