Skip to content

Commit

Permalink
Merge pull request PrestaShop#35834 from Hlavtox/cron-redirect-fix
Browse files Browse the repository at this point in the history
Stabilize search indexation and check referrer
  • Loading branch information
Hlavtox authored Apr 16, 2024
2 parents 184b40a + 2ad46c2 commit 2937cae
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion controllers/admin/AdminSearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,14 @@ public function displayAjaxSearchCron()
// Considering the indexing task can be really long, we ask the PHP process to not stop before 2 hours.
ini_set('max_execution_time', '7200');
Search::indexation(Tools::getValue('full'));
if (Tools::getValue('redirect')) {

/*
* If redirect parameter was specified in the URL and we have the URL the user came from,
* we will redirect him back. This is used in backoffice so the user lands back to the config form.
*
* In CRON or CLI (referer is missing), it will die here. Even if redirect is in the URL.
*/
if (Tools::getValue('redirect') && !empty($_SERVER['HTTP_REFERER'])) {
Tools::redirectAdmin($_SERVER['HTTP_REFERER'] . '&conf=4');
}
}
Expand Down

0 comments on commit 2937cae

Please sign in to comment.