mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 01:21:23 +08:00
DEV: Fix methods removed in Ruby 3.2 (#15459)
* File.exists? is deprecated and removed in Ruby 3.2 in favor of File.exist? * Dir.exists? is deprecated and removed in Ruby 3.2 in favor of Dir.exist?
This commit is contained in:
@ -7,7 +7,7 @@ module BackupRestore
|
||||
root_directory ||= File.join(Rails.root, "public", "backups")
|
||||
|
||||
base_directory = File.join(root_directory, current_db)
|
||||
FileUtils.mkdir_p(base_directory) unless Dir.exists?(base_directory)
|
||||
FileUtils.mkdir_p(base_directory) unless Dir.exist?(base_directory)
|
||||
base_directory
|
||||
end
|
||||
|
||||
@ -25,13 +25,13 @@ module BackupRestore
|
||||
|
||||
def file(filename, include_download_source: false)
|
||||
path = path_from_filename(filename)
|
||||
create_file_from_path(path, include_download_source) if File.exists?(path)
|
||||
create_file_from_path(path, include_download_source) if File.exist?(path)
|
||||
end
|
||||
|
||||
def delete_file(filename)
|
||||
path = path_from_filename(filename)
|
||||
|
||||
if File.exists?(path)
|
||||
if File.exist?(path)
|
||||
File.delete(path)
|
||||
reset_cache
|
||||
end
|
||||
|
Reference in New Issue
Block a user