effective_storage 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d31c97986b5166e4bd1fa34d329ea5a6b8f7c355a9ab952f010100ba8ed33f63
|
4
|
+
data.tar.gz: e88cce63f52489de5fed02e3c5119f4ff17cb5ca07fba05472b15d5cfcfdd814
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 405aa9bb4a51b937c3c551af74327774078418ed01e96b13340806c0dca6dc6fc1bd9824147d3472f65aec8bdc8db49d9dfe5903215e87ee17f3958aefa3f518
|
7
|
+
data.tar.gz: d6058d78e87602fdfbb7639e0e66628c691edd6c22c1823c6697343a8ede5359d09da98c3daa729f146c2e608cc1bf66045cad9785c228d01e1b69ce4b60d55f
|
@@ -47,8 +47,55 @@ module ActiveStorageBlobExtension
|
|
47
47
|
save!
|
48
48
|
end
|
49
49
|
|
50
|
+
# The purge! command is not part of the regular ActiveStorage::Blob class
|
51
|
+
# This is the command called by the admin/storage datatable
|
52
|
+
# When config.never_delete_active_storage is enabled, this is the only way to delete a Blob
|
53
|
+
# And they will not be deleted in the background.
|
50
54
|
def purge!
|
51
|
-
|
55
|
+
before = EffectiveStorage.never_delete
|
56
|
+
|
57
|
+
begin
|
58
|
+
EffectiveStorage.never_delete = false
|
59
|
+
purge
|
60
|
+
ensure
|
61
|
+
EffectiveStorage.never_delete = before
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def delete
|
66
|
+
if EffectiveStorage.never_delete?
|
67
|
+
Rails.logger.info "[effective_storage] Skipping ActiveStorage::Blob delete"
|
68
|
+
return
|
69
|
+
end
|
70
|
+
|
71
|
+
super
|
72
|
+
end
|
73
|
+
|
74
|
+
def destroy
|
75
|
+
if EffectiveStorage.never_delete?
|
76
|
+
Rails.logger.info "[effective_storage] Skipping ActiveStorage::Blob destroy"
|
77
|
+
return
|
78
|
+
end
|
79
|
+
|
80
|
+
super
|
81
|
+
end
|
82
|
+
|
83
|
+
def purge
|
84
|
+
if EffectiveStorage.never_delete?
|
85
|
+
Rails.logger.info "[effective_storage] Skipping ActiveStorage::Blob purge"
|
86
|
+
return
|
87
|
+
end
|
88
|
+
|
89
|
+
super
|
90
|
+
end
|
91
|
+
|
92
|
+
def purge_later
|
93
|
+
if EffectiveStorage.never_delete?
|
94
|
+
Rails.logger.info "[effective_storage] Skipping ActiveStorage::Blob purge_later"
|
95
|
+
return
|
96
|
+
end
|
97
|
+
|
98
|
+
super
|
52
99
|
end
|
53
100
|
|
54
101
|
end
|
data/config/effective_storage.rb
CHANGED
data/lib/effective_storage.rb
CHANGED
@@ -6,7 +6,7 @@ require 'effective_storage/version'
|
|
6
6
|
module EffectiveStorage
|
7
7
|
|
8
8
|
def self.config_keys
|
9
|
-
[:layout, :authorize_active_storage]
|
9
|
+
[:layout, :authorize_active_storage, :never_delete]
|
10
10
|
end
|
11
11
|
|
12
12
|
include EffectiveGem
|
@@ -15,4 +15,8 @@ module EffectiveStorage
|
|
15
15
|
authorize_active_storage == true
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.never_delete?
|
19
|
+
never_delete == true
|
20
|
+
end
|
21
|
+
|
18
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|