From a95f03b2143febf36ee1701295ec21370ada968f Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Sun, 3 Aug 2025 21:46:22 +0200 Subject: [PATCH] solve the localhost/docker issue by falling back to 'http://localhost/' in docker environments which will always work for the cron run method --- application/controllers/Cron.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/application/controllers/Cron.php b/application/controllers/Cron.php index e911e91e6..d37e77619 100644 --- a/application/controllers/Cron.php +++ b/application/controllers/Cron.php @@ -92,7 +92,17 @@ class cron extends CI_Controller { echo "CRON: " . $cron->id . " -> is due: " . $isdue_result . "\n"; echo "CRON: " . $cron->id . " -> RUNNING...\n"; - $url = local_url() . $cron->function; + if (ENVIRONMENT == "docker") { + // In Docker, we use the localhost[:80] to call the cron directly inside the container + $url = 'http://localhost/' . $cron->function; + log_message('debug', 'Docker Environment detected. Using URL: ' . $url); + } else { + // In other environments, we use the local_url() function to get the default url + // Even this local_url() helper created in https://github.com/wavelog/wavelog/pull/795 is not really necessary anymore + // we keep it in case of users do fancy things with it. It doesn't hurt to have it here as it usually returns the base_url + // from the config.php file. + $url = local_url() . $cron->function; + } if (ENVIRONMENT == "development") { echo "CRON: " . $cron->id . " -> URL: " . $url . "\n"; }