Automatic update on visit

by ultimatebelkar, Sunday, June 23, 2013, 10:14 (4318 days ago)

Hi.

I added a couple of lines to my index.php to automatically update the feeds when I visit the page. Thought I share, as it might come in handy if you don't have the ability to call update on a cron.

"auto_update_interval" is a new INI-entry and denotes the min-time between two updates in seconds.

put this after the logger init:

// -----------------------------------
// Update
$test ="";
if (isset($_COOKIE["updated"]))
$test = $_COOKIE["updated"];
if ($test == "")
{
$loader = new \helpers\ContentLoader();
$loader->update();
setcookie("updated","true",time()+$f3->get('auto_update_interval'));
}
// -----------------------------------


Complete thread:

 RSS Feed of thread

powered by my little forum