/** * Send backup success delete email * * @param Mageplace_Backup_Model_Profile $profile * @param array|string $errors */ public function sendErrorDeleteEmail($profile, $errors) { try { if (!$profile instanceof Mageplace_Backup_Model_Profile) { throw Mage::exception('Mageplace_Backup', Mage::helper('mpbackup')->__('Profile object is wrong')); } if (empty($errors) || !is_array($errors) && !is_string($errors)) { throw Mage::exception('Mageplace_Backup', Mage::helper('mpbackup')->__('Errors list is empty')); } if (!$profile->getData(Mageplace_Backup_Model_Profile::CRON_ERROR_EMAIL)) { Mage::log('MPBackup send error email not selected'); } else { /* @var Mage_Core_Model_Translate $translate */ $translate = Mage::getSingleton('core/translate'); $translate->setTranslateInline(false); /* @var Mage_Core_Model_Email_Template $emailTemplate */ $emailTemplate = Mage::getModel('core/email_template'); $emailTemplate->setDesignConfig(array('area' => 'backend'))->sendTransactional($profile->getData(Mageplace_Backup_Model_Profile::CRON_ERROR_DELETE_EMAIL_TEMPLATE), $profile->getData(Mageplace_Backup_Model_Profile::CRON_ERROR_DELETE_EMAIL_IDENTITY), $profile->getData(Mageplace_Backup_Model_Profile::CRON_ERROR_DELETE_EMAIL), null, array('profile_id' => $profile->getId(), 'profile_name' => $profile->getProfileName(), 'warnings' => is_array($errors) ? join("\n", $errors) : $errors)); $translate->setTranslateInline(true); } } catch (Exception $e) { Mage::logException($e); Mage::log('MPBackup send error email has errors: ' . $e->getMessage()); } }