original_string: protected static function get_backups_to_delete($backupfiles, $now) {
          $config = get_config('backup');
          $maxkept = (int)$config->backup_auto_max_kept;
          $deletedays = (int)$config->backup_auto_delete_days;
          $minkept = (int)$config->backup_auto_min_kept;
  
          // Sort by keys descending (newer to older filemodified).
          krsort($backupfiles);
          $tokeep = $maxkept;
          if ($deletedays > 0) {
              $deletedayssecs = $deletedays * DAYSECS;
              $tokeep = 0;
              $backupfileskeys = array_keys($backupfiles);
              foreach ($backupfileskeys as $timemodified) {
                  $mustdeletebackup = $timemodified < ($now - $deletedayssecs);
                  if ($mustdeletebackup || $tokeep >= $maxkept) {
                      break;
                  }
                  $tokeep++;
              }
  
              if ($tokeep < $minkept) {
                  $tokeep = $minkept;
              }
          }
  
          if (count($backupfiles) <= $tokeep) {
              // There are less or equal matching files than the desired number to keep, there is nothing to clean up.
              return false;
          } else {
              $backupstodelete = array_splice($backupfiles, $tokeep);
              return $backupstodelete;
          }
      }
code: protected static function get_backups_to_delete($backupfiles, $now) {
          $config = get_config('backup');
          $maxkept = (int)$config->backup_auto_max_kept;
          $deletedays = (int)$config->backup_auto_delete_days;
          $minkept = (int)$config->backup_auto_min_kept;
  
          // Sort by keys descending (newer to older filemodified).
          krsort($backupfiles);
          $tokeep = $maxkept;
          if ($deletedays > 0) {
              $deletedayssecs = $deletedays * DAYSECS;
              $tokeep = 0;
              $backupfileskeys = array_keys($backupfiles);
              foreach ($backupfileskeys as $timemodified) {
                  $mustdeletebackup = $timemodified < ($now - $deletedayssecs);
                  if ($mustdeletebackup || $tokeep >= $maxkept) {
                      break;
                  }
                  $tokeep++;
              }
  
              if ($tokeep < $minkept) {
                  $tokeep = $minkept;
              }
          }
  
          if (count($backupfiles) <= $tokeep) {
              // There are less or equal matching files than the desired number to keep, there is nothing to clean up.
              return false;
          } else {
              $backupstodelete = array_splice($backupfiles, $tokeep);
              return $backupstodelete;
          }
      }
code_tokens: protected static function get_backups_to_delete ( $ backupfiles , $ now ) { $ config = get_config ( 'backup' ) ; $ maxkept = ( int ) $ config -> backup_auto_max_kept ; $ deletedays = ( int ) $ config -> backup_auto_delete_days ; $ minkept = ( int ) $ config -> backup_auto_min_kept ; // Sort by keys descending (newer to older filemodified). krsort ( $ backupfiles ) ; $ tokeep = $ maxkept ; if ( $ deletedays > 0 ) { $ deletedayssecs = $ deletedays * DAYSECS ; $ tokeep = 0 ; $ backupfileskeys = array_keys ( $ backupfiles ) ; foreach ( $ backupfileskeys as $ timemodified ) { $ mustdeletebackup = $ timemodified < ( $ now - $ deletedayssecs ) ; if ( $ mustdeletebackup || $ tokeep >= $ maxkept ) { break ; } $ tokeep ++ ; } if ( $ tokeep < $ minkept ) { $ tokeep = $ minkept ; } } if ( count ( $ backupfiles ) <= $ tokeep ) { // There are less or equal matching files than the desired number to keep, there is nothing to clean up. return false ; } else { $ backupstodelete = array_splice ( $ backupfiles , $ tokeep ) ; return $ backupstodelete ; } }
docstring: Get the list of backup files to delete depending on the automated backup settings.
  
  @param array $backupfiles Existing backup files
  @param int $now Starting time of the process
  @return array Backup files to delete
docstring_tokens: Get the list of backup files to delete depending on the automated backup settings .