Hi folks,
I'm trying to run a function every so often instead of every time a page is called (it's parsing an xml feed that can't take very many hits per hour), but can't get one part of it working.
I've got a value of LastUpdated, am testing against that to the current time -3 hours, running the XML parser function, then saving the current time as the LastUpdated value.
Problem is it doesn't save the LastUpdated value and I'm at a loss to know what's going on! The LastUpdated value is a SSDatetime if that makes any difference?
// in the class
public static $db = array (
'LastUpdated' => 'SSDatetime'
);
// in the controller
public function getEntries() {
// call $this->updateEntries() if this holder has not been updated in the last 3 hours
if(strtotime($this->LastUpdated) < strtotime('-3 hours')) {
$this->updateEntries();
$this->LastUpdated = date("Y-m-d H:i:s",time());
$this->write();
}
}