You are here

public function PHPExcel_CachedObjectStorage_APC::copyCellCollection in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/APC.php \PHPExcel_CachedObjectStorage_APC::copyCellCollection()

Clone the cell collection

@access public

Parameters

PHPExcel_Worksheet $parent The new worksheet:

Return value

void

Throws

PHPExcel_Exception

Overrides PHPExcel_CachedObjectStorage_CacheBase::copyCellCollection

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/APC.php, line 203

Class

PHPExcel_CachedObjectStorage_APC
PHPExcel_CachedObjectStorage_APC

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) {
      $obj = apc_fetch($this->_cachePrefix . $cellID . '.cache');
      if ($obj === FALSE) {

        //    Entry no longer exists in APC, so clear it from the cache array
        parent::deleteCacheData($cellID);
        throw new PHPExcel_Exception('Cell entry ' . $cellID . ' no longer exists in APC');
      }
      if (!apc_store($newCachePrefix . $cellID . '.cache', $obj, $this->_cacheTime)) {
        $this
          ->__destruct();
        throw new PHPExcel_Exception('Failed to store cell ' . $cellID . ' in APC');
      }
    }
  }
  $this->_cachePrefix = $newCachePrefix;
}