/** * Update staging websites staging values (visibility, master_login and master_password) * * @param Enterprise_Staging_Model_Staging $staging * @param Enterprise_Staging_Model_Staging_Event $event * * @return Enterprise_Staging_Model_Staging_Adapter_Website */ public function updateRun(Enterprise_Staging_Model_Staging $staging, $event = null) { parent::updateRun($staging, $event); $websites = $staging->getMapperInstance()->getWebsites(); foreach ($websites as $website) { $masterWebsiteId = $website->getMasterWebsiteId(); $stagingWebsiteId = $website->getStagingWebsiteId(); if ($stagingWebsiteId) { $stagingWebsite = Mage::app()->getWebsite($stagingWebsiteId); } if (!$stagingWebsite->getId() || !$stagingWebsite->getIsStaging()) { continue; } $stagingWebsite->setData('visibility', $website->getVisibility()); $stagingWebsite->setData('master_login', $website->getMasterLogin()); $password = trim($website->getMasterPassword()); if ($password) { if (Mage::helper('core/string')->strlen($password) < 6) { throw new Enterprise_Staging_Exception(Mage::helper('enterprise_staging')->__('The password must have at least 6 characters. Leading or trailing spaces will be ignored.')); } $stagingWebsite->setData('master_password', Mage::helper('core')->encrypt($password)); } $stagingWebsite->save(); break; } return $this; }