/** * Save backup from backup staging process * * @param object Enterprise_Staging_Model_Staging $staging * @param object Enterprise_Staging_Model_Staging_Log $log * * @return Enterprise_Staging_Model_Staging_Backup */ public function saveOnBackupRun(Enterprise_Staging_Model_Staging $staging, Enterprise_Staging_Model_Staging_Log $log) { if ($staging->getId()) { $name = $staging->getMasterWebsite()->getName(); $tablePrefix = Mage::getSingleton('enterprise_staging/staging_config')->getTablePrefix($staging) . Mage::getSingleton('enterprise_staging/staging_config')->getStagingBackupTablePrefix() . $log->getId() . "_"; $this->setStagingId($staging->getId())->setType('backup')->setEventCode($log->getAction())->setName($name)->setStatus(Enterprise_Staging_Model_Staging_Config::STATUS_COMPLETED)->setCreatedAt(Mage::registry($log->getAction() . "_event_start_time"))->setStagingTablePrefix($tablePrefix)->setMap($staging->getMapperInstance()->serialize())->setMageVersion(Mage::getVersion())->setMageModulesVersion(serialize(Mage::getSingleton('enterprise_staging/staging_config')->getCoreResourcesVersion())); $this->save(); } return $this; }
/** * Update specific attribute value (set new value back in given model) * * @param Enterprise_Staging_Model_Staging $staging * @param string $attribute * @param mixed $value * @return Enterprise_Staging_Model_Resource_Staging */ public function updateAttribute($staging, $attribute, $value) { if ($stagingId = (int) $staging->getId()) { $whereSql = array('staging_id = ?' => $stagingId); $this->_getWriteAdapter()->update($this->getMainTable(), array($attribute => $value), $whereSql); $staging->setData($attribute, $value); } return $this; }