Method: WPScan::DB::Updater#update
- Defined in:
- lib/wpscan/db/updater.rb
#update ⇒ Array<String>
Returns The filenames updated.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/wpscan/db/updater.rb', line 144 def update updated = [] FILES.each do |filename| db_checksum = remote_file_checksum(filename) # Checking if the file needs to be updated next if File.exist?(local_file_path(filename)) && db_checksum == local_file_checksum(filename) create_backup(filename) dl_checksum = download(filename) raise Error::ChecksumsMismatch, filename unless dl_checksum == db_checksum updated << filename rescue StandardError => e restore_backup(filename) raise e ensure delete_backup(filename) if File.exist?(backup_file_path(filename)) end File.write(last_update_file, Time.now) updated end |