diff --git a/app/controllers/dmsf_folder_permissions_controller.rb b/app/controllers/dmsf_folder_permissions_controller.rb
index c77d90b6..8d58d61f 100644
--- a/app/controllers/dmsf_folder_permissions_controller.rb
+++ b/app/controllers/dmsf_folder_permissions_controller.rb
@@ -36,7 +36,7 @@ class DmsfFolderPermissionsController < ApplicationController
def append
@principals = Principal.where(id: params[:user_ids]).to_a
- head :success if @principals.blank?
+ head :ok if @principals.blank?
end
def autocomplete_for_user
diff --git a/app/views/dmsf_public_urls/_new.html.erb b/app/views/dmsf_public_urls/_new.html.erb
index b1bf0724..9485b632 100644
--- a/app/views/dmsf_public_urls/_new.html.erb
+++ b/app/views/dmsf_public_urls/_new.html.erb
@@ -23,6 +23,6 @@
<%= check_box_tag('email[public_urls]', 1, false) %> <%= l(:label_public_urls) %>
- <%= date_field_tag('email[expired_at]', '', :value => (DateTime.now + 3.days).to_date, :size => 10,
+ <%= date_field_tag('email[expired_at]', '', :value => (DateTime.current + 3.days).to_date, :size => 10,
:readonly => true) + calendar_for('email_expired_at') %>
diff --git a/app/views/my/blocks/_locked_documents.html.erb b/app/views/my/blocks/_locked_documents.html.erb
index 845132ed..6bf1ec1c 100644
--- a/app/views/my/blocks/_locked_documents.html.erb
+++ b/app/views/my/blocks/_locked_documents.html.erb
@@ -25,11 +25,11 @@
<% folders = DmsfFolder.visible.joins(
'JOIN dmsf_locks ON dmsf_folders.id = dmsf_locks.entity_id').where(
['dmsf_locks.entity_type = ? AND dmsf_locks.user_id = ? AND (dmsf_locks.expires_at IS NULL OR dmsf_locks.expires_at > ?)',
- 1, @user.id, Time.now]).all if @user %>
+ 1, @user.id, Time.current]).all if @user %>
<% files = DmsfFile.visible.joins(
'JOIN dmsf_locks ON dmsf_files.id = dmsf_locks.entity_id').where(
['dmsf_locks.entity_type = ? AND dmsf_locks.user_id = ? AND (dmsf_locks.expires_at IS NULL OR dmsf_locks.expires_at > ?)',
- 0, @user.id, Time.now]).all if @user %>
+ 0, @user.id, Time.current]).all if @user %>
<% unless defined?(EasyExtensions) %>
<%= l(:locked_documents)%> (<%= folders.count %>/<%= files.count %>)
<% end %>
diff --git a/db/migrate/20170118142001_dmsf_file_container.rb b/db/migrate/20170118142001_dmsf_file_container.rb
index 1dbda708..f740b4b8 100644
--- a/db/migrate/20170118142001_dmsf_file_container.rb
+++ b/db/migrate/20170118142001_dmsf_file_container.rb
@@ -33,7 +33,7 @@ class DmsfFileContainer < ActiveRecord::Migration
remove_index :dmsf_files, [:container_id, :container_type]
remove_column :dmsf_files, :container_type
rename_column :dmsf_files, :container_id, :project_id
- add_index :dmsf_files, :project_id, name: :index_dmsf_files_on_project_id
+ remove_index :dmsf_files, :project_id, name: :index_dmsf_files_on_project_id
end
end
\ No newline at end of file
diff --git a/lib/dav4rack/file_resource_lock.rb b/lib/dav4rack/file_resource_lock.rb
index 0421089a..4cf65475 100644
--- a/lib/dav4rack/file_resource_lock.rb
+++ b/lib/dav4rack/file_resource_lock.rb
@@ -106,7 +106,7 @@ module DAV4Rack
end
def remaining_timeout
- t = timeout.to_i - (Time.now.to_i - created_at.to_i)
+ t = timeout.to_i - (Time.current.to_i - created_at.to_i)
t < 0 ? 0 : t
end
@@ -116,7 +116,7 @@ module DAV4Rack
:token => token,
:timeout => timeout,
:depth => depth,
- :created_at => Time.now,
+ :created_at => Time.current,
:owner => owner
}
@store.transaction do
diff --git a/lib/dav4rack/handler.rb b/lib/dav4rack/handler.rb
index ce67589a..d741bf50 100644
--- a/lib/dav4rack/handler.rb
+++ b/lib/dav4rack/handler.rb
@@ -24,11 +24,11 @@ module DAV4Rack
end
def call(env)
- start = Time.now
+ start = Time.current
request = setup_request env
response = Rack::Response.new
- Logger.info "Processing WebDAV request: #{request.path} (for #{request.ip} at #{Time.now}) [#{request.request_method}]"
+ Logger.info "Processing WebDAV request: #{request.path} (for #{request.ip} at #{Time.current}) [#{request.request_method}]"
controller = setup_controller request, response
controller.process
@@ -41,7 +41,7 @@ module DAV4Rack
if Logger.debug? and response.body.is_a?(String)
Logger.debug "Response String:\n#{response.body}"
end
- Logger.info "Completed in: #{((Time.now.to_f - start.to_f) * 1000).to_i} ms | #{response.status} [#{request.url}]"
+ Logger.info "Completed in: #{((Time.current.to_f - start.to_f) * 1000).to_i} ms | #{response.status} [#{request.url}]"
response.finish
diff --git a/lib/dav4rack/interceptor_resource.rb b/lib/dav4rack/interceptor_resource.rb
index 00e502d3..a23b8e0b 100644
--- a/lib/dav4rack/interceptor_resource.rb
+++ b/lib/dav4rack/interceptor_resource.rb
@@ -25,15 +25,15 @@ module DAV4Rack
end
def creation_date
- Time.now
+ Time.current
end
def last_modified
- Time.now
+ Time.current
end
def last_modified=(time)
- Time.now
+ Time.current
end
def etag
diff --git a/lib/dav4rack/lock.rb b/lib/dav4rack/lock.rb
index e37c0d06..58f2619f 100644
--- a/lib/dav4rack/lock.rb
+++ b/lib/dav4rack/lock.rb
@@ -4,8 +4,8 @@ module DAV4Rack
def initialize(args={})
@args = args
@store = nil
- @args[:created_at] = Time.now
- @args[:updated_at] = Time.now
+ @args[:created_at] = Time.current
+ @args[:updated_at] = Time.current
end
def store
@@ -24,7 +24,7 @@ module DAV4Rack
end
def remaining_timeout
- @args[:timeout].to_i - (Time.now.to_i - @args[:created_at].to_i)
+ @args[:timeout].to_i - (Time.current.to_i - @args[:created_at].to_i)
end
def method_missing(*args)
diff --git a/lib/dav4rack/remote_file.rb b/lib/dav4rack/remote_file.rb
index 8bcbde7f..d412c1ae 100644
--- a/lib/dav4rack/remote_file.rb
+++ b/lib/dav4rack/remote_file.rb
@@ -107,7 +107,7 @@ module DAV4Rack
# Last modified type based on provided, remote headers or current time
def last_modified
- @heads['last-modified'] || @modified || Time.now.httpdate
+ @heads['last-modified'] || @modified || Time.current.httpdate
end
# Builds the path for the cached file
diff --git a/lib/dav4rack/resources/file_resource.rb b/lib/dav4rack/resources/file_resource.rb
index 093e7703..e20cb8d6 100644
--- a/lib/dav4rack/resources/file_resource.rb
+++ b/lib/dav4rack/resources/file_resource.rb
@@ -42,7 +42,7 @@ module DAV4Rack
# Set the time of last modification.
def last_modified=(time)
- ::File.utime(Time.now, time, file_path)
+ ::File.utime(Time.current, time, file_path)
end
# Return an Etag, an unique hash value for this resource.
diff --git a/test/fixtures/dmsf_links.yml b/test/fixtures/dmsf_links.yml
index 654ef198..ab1128ce 100644
--- a/test/fixtures/dmsf_links.yml
+++ b/test/fixtures/dmsf_links.yml
@@ -6,11 +6,11 @@ folder_link:
target_type: DmsfFolder
name: folder1_link
project_id: 1
- dmsf_folder_id: NULL
+ dmsf_folder_id: nil
deleted: 0
- deleted_by_user_id: NULL
- created_at: <%= DateTime.now() %>
- updated_at: <%= DateTime.now() %>
+ deleted_by_user_id: nil
+ created_at: <%= DateTime.current %>
+ updated_at: <%= DateTime.current %>
file_link:
id: 2
@@ -21,9 +21,9 @@ file_link:
project_id: 1
dmsf_folder_id: 1
deleted: 0
- deleted_by_user_id: NULL
- created_at: <%= DateTime.now() %>
- updated_at: <%= DateTime.now() %>
+ deleted_by_user_id: nil
+ created_at: <%= DateTime.current %>
+ updated_at: <%= DateTime.current %>
folder_link2:
id: 3
@@ -32,11 +32,11 @@ folder_link2:
target_type: DmsfFolder
name: folder4_link
project_id: 2
- dmsf_folder_id: NULL
+ dmsf_folder_id: nil
deleted: 0
- deleted_by_user_id: NULL
- created_at: <%= DateTime.now() %>
- updated_at: <%= DateTime.now() %>
+ deleted_by_user_id: nil
+ created_at: <%= DateTime.current %>
+ updated_at: <%= DateTime.current %>
file_link2:
id: 4
@@ -45,11 +45,11 @@ file_link2:
target_type: DmsfFile
name: test_link
project_id: 1
- dmsf_folder_id: NULL
+ dmsf_folder_id: nil
deleted: 0
- deleted_by_user_id: NULL
- created_at: <%= DateTime.now() %>
- updated_at: <%= DateTime.now() %>
+ deleted_by_user_id: nil
+ created_at: <%= DateTime.current %>
+ updated_at: <%= DateTime.current %>
url_link:
id: 5
@@ -60,6 +60,6 @@ url_link:
project_id: 1
external_url: 'https://www.kontron.com'
deleted: 0
- deleted_by_user_id: NULL
- created_at: <%= DateTime.now() %>
- updated_at: <%= DateTime.now() %>
\ No newline at end of file
+ deleted_by_user_id: nil
+ created_at: <%= DateTime.current %>
+ updated_at: <%= DateTime.current %>
\ No newline at end of file
diff --git a/test/fixtures/dmsf_public_urls.yml b/test/fixtures/dmsf_public_urls.yml
index 4d0a70a2..e1f97ba4 100644
--- a/test/fixtures/dmsf_public_urls.yml
+++ b/test/fixtures/dmsf_public_urls.yml
@@ -4,15 +4,15 @@ public_url_1:
dmsf_file_id: 1
user_id: 1
token: 'd8d33e21914a433b280fdc94450ee212'
- expire_at: <%= (Time.now + 1.day).to_date %>
- created_at: <%= DateTime.now() %>
- updated_at: <%= DateTime.now() %>
+ expire_at: <%= (Time.current + 1.day).to_date %>
+ created_at: <%= DateTime.current %>
+ updated_at: <%= DateTime.current %>
public_url_2:
id: 2
dmsf_file_id: 1
user_id: 1
token: 'e8d33e21914a433b280fdc94450ee212'
- expire_at: <%= (Time.now - 1.day).to_date %>
- created_at: <%= DateTime.now() %>
- updated_at: <%= DateTime.now() %>
+ expire_at: <%= (Time.current - 1.day).to_date %>
+ created_at: <%= DateTime.current %>
+ updated_at: <%= DateTime.current %>