/** * Remove anything that is older than 15 minutes, we only want to keep 15 * minutes worth of history */ public function cleanup() { $config = Config::get('cron'); $minutes = isset($config['save_time']) ? $config['save_time'] : 15; $startDate = new \DateTime(); $startDate->modify("-{$minutes} minutes"); $sql = "DELETE FROM `virge_cron_job` WHERE `finished_on` <= ?"; Database::query($sql, $startDate); }
/** * Log that the migration happened * TODO: use the virge ORM * @param string $file */ public function logMigration($file) { $user = get_current_user(); $sql = "INSERT INTO `virge_migration` (`filename`, `executed_by`, `executed_on`, `summary`) VALUES (?, ?, ?, ?)"; Database::query($sql, array($file, $user, new \DateTime(), Schema::$last_response)); }