/** * On load */ public function onLoad() { if (inNormalMode()) { redirect(l("RDR_Home"), 302); } if (get("disable-maintenance") == self::getValidHash()) { self::disableMaintenanceMode(); echo "Maintenance Mode manually disabled"; return; } echo "nReeda is in maintenance mode"; }
/** * Load the View */ public function onLoad() { if (!inNormalMode()) { return; } # set time limit to max 10 minutes # if this limit is reached than the script stops and continue at next cron set_time_limit(RDR_Cron::MAXTIME); $cronPidFile = self::getPIDFile(); # skip when cron is already running if (self::isRunning()) { RDR_Event::log(RDR_Event::TYPE_CRON_RUNNING); return; } # create a tmp file that show us the cron pid file_put_contents($cronPidFile, time()); $param = $this->getParam("param"); if ($param != self::getHash()) { die("Not allowed"); } RDR_Event::log(RDR_Event::TYPE_CRON_START); RDR_Import::updateAllFeeds(); RDR_Event::log(RDR_Event::TYPE_CRON_END); RDR_Cleanup::cleanupEvents(); RDR_Cleanup::cleanupEntries(); RDR_FileContents::cleanupTmpFiles(); RDR_Proxy::cleanupTmpFiles(); # optimizing tables $generator = CHOQ_DB_Generator::create(db()); if ($generator instanceof CHOQ_DB_Generator_Mysql) { $generator->addModule("RDR"); $generator->optimizeTables(); } # delete tmp file that show us the cron pid unlink(CHOQ_ACTIVE_MODULE_DIRECTORY . "/tmp/cron.pid"); }