March 10, 2016

Magento EE synchronize data and configurations between a staging and a main website


From "Scheduler Timeline" dashboard in Magento EE 1.x I saw a cron name "enterprise_staging_automates". This cron runs every minute.

Back to Magento EE features, Magento EE allows you to create staging sites, and merge them at a certain date/time

Look around Magento core I discover module Enterprise_Staging that handles Content Staging inside enterprise (effectively allowing you to duplicate the store and views and preview changes). The following code automate:

public function automates() { try { $currentDate = Mage::getModel('core/date')->gmtDate(); $collection = Mage::getResourceModel('enterprise_staging/staging_collection') ->addIsSheduledToFilter(); foreach ($collection as $staging) { $applyDate = $staging->getMergeSchedulingDate(); if ($currentDate >= $applyDate) { $mapData = $staging->getMergeSchedulingMap(); if (!empty($mapData)) { $mapper = $staging->getMapperInstance()->unserialize($mapData); if ($mapper->getIsBackup()) { $staging->backup(); } $staging->setIsMegreByCron(true); $staging->merge(); } } } } catch (Enterprise_Staging_Exception $e) {} }
To achieve this function we need to add a staging website in install_dir/staging folder of Magento directory. We can add a staging website in System > Content staging menu. After creating a staging website, this cron will sync the data form main website to staging website from time to time.

Did you try this?
 

There was an error in this gadget