Method: MadeleineServer.clean_storage

Defined in:
app/models/wiki_service.rb

.clean_storage(service) ⇒ Object

Clears all the command_log and snapshot files located in the storage directory, so the database is essentially dropped and recreated as blank



170
171
172
173
174
175
176
177
178
179
180
# File 'app/models/wiki_service.rb', line 170

def self.clean_storage(service)
  begin 
    Dir.foreach(service.storage_path) do |file|
      if file =~ /(command_log|snapshot)$/
        File.delete(File.join(service.storage_path, file))
      end
    end
  rescue
    Dir.mkdir(service.storage_path)
  end
end