Skip to content

Commit 2937cae

Browse files
authored
Merge pull request PrestaShop#35834 from Hlavtox/cron-redirect-fix
Stabilize search indexation and check referrer
2 parents 184b40a + 2ad46c2 commit 2937cae

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

controllers/admin/AdminSearchController.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,14 @@ public function displayAjaxSearchCron()
565565
// Considering the indexing task can be really long, we ask the PHP process to not stop before 2 hours.
566566
ini_set('max_execution_time', '7200');
567567
Search::indexation(Tools::getValue('full'));
568-
if (Tools::getValue('redirect')) {
568+
569+
/*
570+
* If redirect parameter was specified in the URL and we have the URL the user came from,
571+
* we will redirect him back. This is used in backoffice so the user lands back to the config form.
572+
*
573+
* In CRON or CLI (referer is missing), it will die here. Even if redirect is in the URL.
574+
*/
575+
if (Tools::getValue('redirect') && !empty($_SERVER['HTTP_REFERER'])) {
569576
Tools::redirectAdmin($_SERVER['HTTP_REFERER'] . '&conf=4');
570577
}
571578
}

0 commit comments

Comments
 (0)