/** * Returns the directory based on subdomain. * * @return mixed */ function cronDir() { return APP_PATH . 'views/cron/' . subdomain_as_directory() . '/'; }
$result->balanceDue = '0'; $result->where('stuID = ?', $r['stuID'])->_and_()->where('termCode = ?', $r['termCode'])->update(); } elseif ($r['Balance'] < 0) { $result = $app->db->stu_acct_bill(); $result->balanceDue = '1'; $result->where('stuID = ?', $r['stuID'])->_and_()->where('termCode = ?', $r['termCode'])->update(); } } }); $app->get('/runDBBackup/', function () { $dbhost = DB_HOST; $dbuser = DB_USER; $dbpass = DB_PASS; $dbname = DB_NAME; _mkdir('/tmp/' . subdomain_as_directory() . '/backups/'); $backupDir = '/tmp/' . subdomain_as_directory() . '/backups/'; $backupFile = $backupDir . $dbname . '-' . date("Y-m-d-H-i-s") . '.gz'; if (!file_exists($backupFile)) { $command = "mysqldump --opt -h {$dbhost} -u {$dbuser} -p{$dbpass} {$dbname} | gzip > {$backupFile}"; system($command); } $files = glob($backupDir . "*.gz"); if (is_array($files)) { foreach ($files as $file) { if (is_file($file) && time() - filemtime($file) >= 20 * 24 * 3600) { // 20 days unlink($file); } } } });