From 25573507821dc8b1410dc10a063d282fe921375c Mon Sep 17 00:00:00 2001 From: Hlavtox Date: Fri, 5 Jan 2024 13:15:34 +0100 Subject: [PATCH] Fix CS --- controllers/front/cron.php | 46 +++++++++++++++++++------------------- gsitemap-cron.php | 7 +++--- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/controllers/front/cron.php b/controllers/front/cron.php index 1f7a06c..c188f03 100644 --- a/controllers/front/cron.php +++ b/controllers/front/cron.php @@ -19,31 +19,31 @@ */ class GsitemapCronModuleFrontController extends ModuleFrontController { - public function postProcess() - { - // Check correct token when not in CLI context - if (!Tools::isPHPCLI() && Tools::substr(Tools::hash('gsitemap/cron'), 0, 10) != Tools::getValue('token')) { - exit('Bad token'); - } + public function postProcess() + { + // Check correct token when not in CLI context + if (!Tools::isPHPCLI() && Tools::substr(Tools::hash('gsitemap/cron'), 0, 10) != Tools::getValue('token')) { + exit('Bad token'); + } - // Check if the requested shop exists - $shops = Db::getInstance()->ExecuteS('SELECT id_shop FROM `' . _DB_PREFIX_ . 'shop`'); - $list_id_shop = []; - foreach ($shops as $shop) { - $list_id_shop[] = (int) $shop['id_shop']; - } + // Check if the requested shop exists + $shops = Db::getInstance()->ExecuteS('SELECT id_shop FROM `' . _DB_PREFIX_ . 'shop`'); + $list_id_shop = []; + foreach ($shops as $shop) { + $list_id_shop[] = (int) $shop['id_shop']; + } - $id_shop = (Tools::getIsset('id_shop') && in_array(Tools::getValue('id_shop'), $list_id_shop)) ? (int) Tools::getValue('id_shop') : (int) Configuration::get('PS_SHOP_DEFAULT'); - - // Mark a flag that we are in cron context - $this->module->cron = true; + $id_shop = (Tools::getIsset('id_shop') && in_array(Tools::getValue('id_shop'), $list_id_shop)) ? (int) Tools::getValue('id_shop') : (int) Configuration::get('PS_SHOP_DEFAULT'); + + // Mark a flag that we are in cron context + $this->module->cron = true; - // If this is the first request to generate, we delete all previous sitemaps - if (!Tools::getIsset('continue')) { - $this->module->emptySitemap((int) $id_shop); - } + // If this is the first request to generate, we delete all previous sitemaps + if (!Tools::getIsset('continue')) { + $this->module->emptySitemap((int) $id_shop); + } - // Run generation - $this->module->createSitemap((int) $id_shop); - } + // Run generation + $this->module->createSitemap((int) $id_shop); + } } diff --git a/gsitemap-cron.php b/gsitemap-cron.php index 97bfb3d..93aab72 100644 --- a/gsitemap-cron.php +++ b/gsitemap-cron.php @@ -24,11 +24,10 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) */ -/** +/* * This file can be called using a cron to generate Google sitemap files automatically. - * - * @deprecated This file should no longer be used and will be removed in 5.0.0 version of this module. - * Please update your cron tasks to use the new URL available in module settings. + * This file should no longer be used and will be removed in 5.0.0 version of this module. + * Please update your cron tasks to use the new URL available in module settings. */ trigger_error('This file should no longer be used and will be removed in 5.0.0 version of this module. Please update your cron tasks to use the new URL available in module settings.', E_USER_NOTICE);