diff --git a/application/controllers/Cron.php b/application/controllers/Cron.php index 875a23e25..a34bfa80f 100644 --- a/application/controllers/Cron.php +++ b/application/controllers/Cron.php @@ -89,6 +89,7 @@ class cron extends CI_Controller { echo "CRON: " . $cron->id . " -> RUNNING...\n"; $url = local_url() . $cron->function; + echo "CRON: " . $cron->id . " -> URL: " . $url . "\n"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); diff --git a/system/core/Config.php b/system/core/Config.php index e6eb0ad95..245f44bb2 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -322,6 +322,36 @@ class CI_Config { return $base_url.$this->_uri_string($uri); } + /** + * Local URL + * + * Returns local_url [. uri_string] + * + * @uses CI_Config::_uri_string() + * + * @param string|string[] $uri URI string or an array of segments + * @param string $protocol + * @return string + */ + public function local_url($uri = '', $protocol = NULL) + { + $local_url = $this->slash_item('local_url'); + if (isset($protocol)) + { + // For protocol-relative links + if ($protocol === '') + { + $local_url = substr($local_url, strpos($local_url, '//')); + } + else + { + $local_url = $protocol.substr($local_url, strpos($local_url, '://')); + } + } + + return $local_url.$this->_uri_string($uri); + } + // ------------------------------------------------------------- /**