Class: Decidim::Cdtb::Storage::SetLocalOnBlobs
- Inherits:
-
Task
- Object
- Task
- Decidim::Cdtb::Storage::SetLocalOnBlobs
show all
- Defined in:
- lib/decidim/cdtb/storage/set_local_on_blobs.rb
Overview
Updates all ActiveStorage::Blob rows in the DB to use the :local service.
Instance Attribute Summary
Attributes inherited from Task
#num_applied, #title
Instance Method Summary
collapse
Methods inherited from Task
#execute!, #finish, #init
Methods included from TasksUtils
#do_log_error, #do_log_info, #log_task_end, #log_task_failure, #log_task_info, #log_task_step, #log_task_title, #logger
Constructor Details
Returns a new instance of SetLocalOnBlobs.
8
9
10
|
# File 'lib/decidim/cdtb/storage/set_local_on_blobs.rb', line 8
def initialize
super("S3 to local: FORCE LOCAL SERVICE")
end
|
Instance Method Details
#do_execution(_context) ⇒ Object
21
22
23
|
# File 'lib/decidim/cdtb/storage/set_local_on_blobs.rb', line 21
def do_execution(_context)
ActiveStorage::Blob.update(service_name: "local")
end
|
#end_execution(_ctx) ⇒ Object
25
26
27
|
# File 'lib/decidim/cdtb/storage/set_local_on_blobs.rb', line 25
def end_execution(_ctx)
log_task_info("Blobs updated")
end
|
#prepare_execution(_ctx) ⇒ Object
12
13
14
15
|
# File 'lib/decidim/cdtb/storage/set_local_on_blobs.rb', line 12
def prepare_execution(_ctx)
@num_blobs= ActiveStorage::Blob.count
log_task_info("Updating #{@num_blobs} blobs...")
end
|
#total_items ⇒ Object
17
18
19
|
# File 'lib/decidim/cdtb/storage/set_local_on_blobs.rb', line 17
def total_items
@num_blobs
end
|