Magento initialization and state recovery framework