Commit 37bf82e6 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'memorycancel-master-patch-90143' into 'master'

Add method backup_file?

See merge request gitlab-org/gitlab!73941
parents 246f44a5 75068d86
...@@ -99,9 +99,10 @@ module Backup ...@@ -99,9 +99,10 @@ module Backup
# - 1495527122_gitlab_backup.tar # - 1495527122_gitlab_backup.tar
# - 1495527068_2017_05_23_gitlab_backup.tar # - 1495527068_2017_05_23_gitlab_backup.tar
# - 1495527097_2017_05_23_9.3.0-pre_gitlab_backup.tar # - 1495527097_2017_05_23_9.3.0-pre_gitlab_backup.tar
next unless file =~ /^(\d{10})(?:_\d{4}_\d{2}_\d{2}(_\d+\.\d+\.\d+((-|\.)(pre|rc\d))?(-ee)?)?)?_gitlab_backup\.tar$/ matched = backup_file?(file)
next unless matched
timestamp = Regexp.last_match(1).to_i timestamp = matched[1].to_i
if Time.at(timestamp) < (Time.now - keep_time) if Time.at(timestamp) < (Time.now - keep_time)
begin begin
...@@ -192,6 +193,10 @@ module Backup ...@@ -192,6 +193,10 @@ module Backup
private private
def backup_file?(file)
file.match(/^(\d{10})(?:_\d{4}_\d{2}_\d{2}(_\d+\.\d+\.\d+((-|\.)(pre|rc\d))?(-ee)?)?)?_gitlab_backup\.tar$/)
end
def non_tarred_backup? def non_tarred_backup?
File.exist?(File.join(backup_path, 'backup_information.yml')) File.exist?(File.join(backup_path, 'backup_information.yml'))
end end
...@@ -314,3 +319,5 @@ module Backup ...@@ -314,3 +319,5 @@ module Backup
end end
end end
end end
Backup::Manager.prepend_mod
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment