* @copyright 2007-2018 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ require_once('../../config/config.inc.php'); require_once('../../init.php'); require_once(dirname(__FILE__).'/classes/pssitemapDataClass.php'); require_once(dirname(__FILE__).'/pssitemap.php'); function canExecuteCronTask() { // Check if we used the cli if (php_sapi_name() === 'cli') { return true; } // Check if the token is good if (Tools::getValue('token') === configuration::get('PSM_CRON_TOKEN')) { return true; } return false; } if (!canExecuteCronTask()) { echo "INVALID TOKEN"; exit; } $id_lang = explode(",", configuration::get('LANGUAGE_CONF')); $id_shop = (int)Context::getContext()->shop->id; $category_frequency = configuration::get('CATEGORY_FREQUENCY'); $category_priority = configuration::get('CATEGORY_PRIORITY'); $product_frequency = configuration::get('PRODUCT_FREQUENCY'); $product_priority = configuration::get('PRODUCT_PRIORITY'); $other_frequency = configuration::get('OTHER_PAGE_FREQUENCY'); $other_priority = configuration::get('OTHER_PAGE_PRIORITY'); $cms_frequency = configuration::get('CMS_FREQUENCY'); $cms_priority = configuration::get('CMS_PRIORITY'); $sitemap = new PssitemapData(); $pssitemap = new Pssitemap(); /** GENERATE HTML SITEMAP **/ $id_cms = configuration::get('CMS_PAGE'); if (configuration::get('CMS_PAGE') == 0) { exit("Please select a cms page"); } elseif (configuration::get('CMS_PAGE') != 0) { $pssitemap->updateCMS($id_cms); } /** XML **/ foreach ($id_lang as $value) { if (configuration::get('SITEMAP_CATEGORY') != 0) { $sitemap->getActiveURLCategory($category_frequency, $category_priority, $id_shop, $value); } if (configuration::get('SITEMAP_PRODUCT') != 0) { $sitemap->getActiveURLProduct($product_frequency, $product_priority, $id_shop, $value); } if (configuration::get('SITEMAP_CMS') != 0) { $sitemap->getActiveURLCMS($cms_frequency, $cms_priority, $id_shop, $value); } if (configuration::get('SITEMAP_OTHER_PAGES') != 0) { $sitemap->getActiveURLOtherPage($other_frequency, $other_priority, $id_shop, $value); } } echo "CRON TASK EXECUTED";