示例#1
0
 /**
  * Get file handler by process ID
  *
  * @param $processId
  * @return Mage_Index_Model_Process_File
  */
 public function getFile($processId)
 {
     if (!isset($this->_fileHandlers[$processId])) {
         $file = $this->_fileFactory->createFromArray();
         $varDirectory = $this->_configuration->getVarDir('locks');
         $file->setAllowCreateFolders(true);
         $file->open(array('path' => $varDirectory));
         $fileName = 'index_process_' . $processId . '.lock';
         $file->streamOpen($fileName);
         $file->streamWrite(date('r'));
         $this->_fileHandlers[$processId] = $file;
     }
     return $this->_fileHandlers[$processId];
 }