예제 #1
0
 /**
  * @return Btf\Bootstrap\State\Magento
  */
 protected function _getState()
 {
     $state = new GenericState($this->_source('magento.state'));
     $state->setVar($this->_source('var'));
     $state->setMedia($this->_source('media'));
     $state->setDump($this->_source('dump'));
     return $state;
 }
 public function saveState($fileName)
 {
     $state = new MagentoState($fileName);
     $dumpFileName = tempnam(null, 'btd');
     $this->getDb()->createDump($dumpFileName);
     $state->setDump($dumpFileName);
     $params = $this->getParams();
     if (is_dir($params['options']['var_dir'])) {
         $state->setVar($params['options']['var_dir']);
     }
     if (is_dir($params['options']['media_dir'])) {
         $state->setMedia($params['options']['media_dir']);
     }
     $state->save();
     unlink($dumpFileName);
     return $state;
 }