Example #1
0
 /**
  * Checks whether the application's backup interval has been exceeded
  *
  * @return boolean
  */
 private static function needs()
 {
     $interval = App::backupInterval();
     if ($interval !== false) {
         $interval = strtotime($interval);
         $backups = App::backups()->files();
         sort($backups);
         if (count($backups) > 0) {
             $last_backup = $backups[count($backups) - 1];
             $last_backup_name = substr($last_backup, 0, strrpos($last_backup, '.'));
             $last_backup_time = doubleval(substr($last_backup_name, 0, strpos($last_backup_name, '-')));
             if ($last_backup_time + $interval <= time()) {
                 return true;
             }
         } else {
             return true;
         }
         //no back up was made yet
     }
     return false;
 }