Example #1
0
 /**
  * Cleans backups when there are too many backup files (backuplimit exceed)
  */
 private static function clean()
 {
     $limit = App::backupLimit();
     if ($limit !== false) {
         $backups = App::backups()->files();
         sort($backups);
         $to_remove = count($backups) - $limit;
         if ($to_remove > 0) {
             $i = 0;
             while ($i < $to_remove) {
                 $backups[$i]->remove();
                 ++$i;
             }
         }
     }
 }