function run_cron() { $cron = Cron::findByIdFrom('Cron', '1'); $now = time(); $last = $cron->getLastRunTime(); if ($now - $last > POORMANSCRON_INTERVAL) { echo $cron->generateWebBug(); } }
$size = ob_get_length(); header("Content-Length: {$size}"); ob_end_flush(); flush(); // Both need to be called! // Setup system define('CMS_ROOT', dirname(__FILE__) . '/../..'); define('CORE_FOLDER', 'core'); define('CORE_ROOT', CMS_ROOT . '/' . CORE_FOLDER); define('PLUGINS_ROOT', CORE_ROOT . '/plugins'); define('APP_PATH', CORE_ROOT . '/app'); require_once CORE_ROOT . '/utils.php'; require_once CMS_ROOT . '/config.php'; define('BASE_URL', URL_PUBLIC . (endsWith(URL_PUBLIC, '/') ? '' : '/') . (USE_MOD_REWRITE ? '' : '?')); require CORE_ROOT . '/Framework.php'; // Database connection ----------------------------------------------------- $__CMS_CONN__ = new PDO(DB_DSN, DB_USER, DB_PASS); if ($__CMS_CONN__->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { $__CMS_CONN__->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); } Record::connection($__CMS_CONN__); Record::getConnection()->exec("set names 'utf8'"); // Initialize -------------------------------------------------------------- use_helper('I18n'); Setting::init(); Plugin::init(); // Update cron run time $cron = Cron::findByIdFrom('Cron', '1'); $cron->save(); // Run cron items Observer::notify('cron_run');