Public Member Functions | |
scheduledGenerateSitemaps ($schedule) | |
Public Attributes | |
const | XML_PATH_GENERATION_ENABLED = 'sitemap/generate/enabled' |
const | XML_PATH_CRON_EXPR = 'crontab/jobs/generate_sitemaps/schedule/cron_expr' |
const | XML_PATH_ERROR_TEMPLATE = 'sitemap/generate/error_email_template' |
const | XML_PATH_ERROR_IDENTITY = 'sitemap/generate/error_email_identity' |
const | XML_PATH_ERROR_RECIPIENT = 'sitemap/generate/error_email' |
Definition at line 35 of file Observer.php.
scheduledGenerateSitemaps | ( | $ | schedule | ) |
Generate sitemaps
Mage_Cron_Model_Schedule | $schedule |
Definition at line 68 of file Observer.php.
00069 { 00070 $errors = array(); 00071 00072 // check if scheduled generation enabled 00073 if (!Mage::getStoreConfigFlag(self::XML_PATH_GENERATION_ENABLED)) { 00074 return; 00075 } 00076 00077 $collection = Mage::getModel('sitemap/sitemap')->getCollection(); 00078 /* @var $collection Mage_Sitemap_Model_Mysql4_Sitemap_Collection */ 00079 foreach ($collection as $sitemap) { 00080 /* @var $sitemap Mage_Sitemap_Model_Sitemap */ 00081 00082 try { 00083 $sitemap->generateXml(); 00084 } 00085 catch (Exception $e) { 00086 $errors[] = $e->getMessage(); 00087 } 00088 } 00089 00090 if ($errors && Mage::getStoreConfig(self::XML_PATH_ERROR_RECIPIENT)) { 00091 $translate = Mage::getSingleton('core/translate'); 00092 /* @var $translate Mage_Core_Model_Translate */ 00093 $translate->setTranslateInline(false); 00094 00095 $emailTemplate = Mage::getModel('core/email_template'); 00096 /* @var $emailTemplate Mage_Core_Model_Email_Template */ 00097 $emailTemplate->setDesignConfig(array('area' => 'backend')) 00098 ->sendTransactional( 00099 Mage::getStoreConfig(self::XML_PATH_ERROR_TEMPLATE), 00100 Mage::getStoreConfig(self::XML_PATH_ERROR_IDENTITY), 00101 Mage::getStoreConfig(self::XML_PATH_ERROR_RECIPIENT), 00102 null, 00103 array('warnings' => join("\n", $errors)) 00104 ); 00105 00106 $translate->setTranslateInline(true); 00107 } 00108 }
const XML_PATH_CRON_EXPR = 'crontab/jobs/generate_sitemaps/schedule/cron_expr' |
Cronjob expression configuration
Definition at line 46 of file Observer.php.
const XML_PATH_ERROR_IDENTITY = 'sitemap/generate/error_email_identity' |
Error email identity configuration
Definition at line 56 of file Observer.php.
const XML_PATH_ERROR_RECIPIENT = 'sitemap/generate/error_email' |
'Send error emails to' configuration
Definition at line 61 of file Observer.php.
const XML_PATH_ERROR_TEMPLATE = 'sitemap/generate/error_email_template' |
Error email template configuration
Definition at line 51 of file Observer.php.
const XML_PATH_GENERATION_ENABLED = 'sitemap/generate/enabled' |
Enable/disable configuration
Definition at line 41 of file Observer.php.