function execute($options = array()) { $sql = 'SELECT MAX(last_update) < DATE_SUB(NOW(), INTERVAL 24 HOUR) FROM calendar_feeds'; $update = isset($options['update']) && $options['update'] || $this->dbcon->GetOne($sql); if ($update) { require_once 'Modules/Calendar/Feeds/CalendarFeeds.php'; $feeds = new CalendarFeeds($this->dbcon); $feeds->update(); } return true; }
<?php require_once 'AMP/System/Page.inc.php'; require_once 'Modules/Calendar/Feeds/CalendarFeeds.php'; require_once 'Modules/Calendar/Feeds/ComponentMap.inc.php'; $map = new ComponentMap_CalendarFeeds(); $page = new AMPSystem_Page($dbcon, $map); if (isset($_GET['action']) && $_GET['action'] == "update") { $feeds = new CalendarFeeds($dbcon); if ($feeds->update()) { $page->setMessage('Updated feeds'); } else { $page->setMessage('Could not update feeds', $is_error = true); } $page->showList(true); } if (isset($_GET['action']) && $_GET['action'] == "list") { $page->showList(true); } $page->execute(); print $page->output();