camaleon_cms 2.4.3.8 → 2.4.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of camaleon_cms might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/apps/plugins/front_cache/admin_controller.rb +3 -2
- data/app/apps/plugins/front_cache/config/config.json +2 -2
- data/app/apps/plugins/front_cache/front_cache_helper.rb +10 -16
- data/app/apps/plugins/front_cache/views/admin/settings.html.erb +5 -0
- data/app/assets/images/camaleon_cms/language/ua.png +0 -0
- data/app/controllers/camaleon_cms/admin/posts_controller.rb +1 -1
- data/app/controllers/camaleon_cms/frontend_controller.rb +1 -1
- data/app/models/camaleon_cms/custom_field_group.rb +1 -2
- data/app/models/concerns/camaleon_cms/user_methods.rb +1 -1
- data/lib/camaleon_cms/version.rb +1 -1
- data/lib/plugin_routes.rb +1 -1
- data/spec/dummy/db/schema.rb +0 -11
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae2c10e79b6faabdbaf3235dc51b6854b3fd49dd
|
4
|
+
data.tar.gz: 56c221c85dcbceab2b16b5e528bd2abf881a526e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3c0731429a016c1c1ab6ce37ac2ee7b58051174fcfe0ec811806340c2d06c5fb821492c480bc905902a21e0ed447ed92aa7c7874a45c558f36b39ff0ccd8a19
|
7
|
+
data.tar.gz: 29e40477cad1ce684f3aaec989e3e0209500319140177788932eb371fd42759e2aa675a8c4a6ebe6d8084d8f4c79758674327b63476f2851c4ff38d5993a9188
|
@@ -11,7 +11,8 @@ class Plugins::FrontCache::AdminController < CamaleonCms::Apps::PluginsAdminCont
|
|
11
11
|
post_types: (params[:cache][:post_type]||[]),
|
12
12
|
skip_posts: (params[:cache][:skip_posts]||[]),
|
13
13
|
cache_login: params[:cache][:cache_login],
|
14
|
-
home: params[:cache][:home]
|
14
|
+
home: params[:cache][:home],
|
15
|
+
preserve_cache_on_restart: params[:cache][:preserve_cache_on_restart]
|
15
16
|
})
|
16
17
|
flash[:notice] = "#{t('plugin.front_cache.message.settings_saved')}"
|
17
18
|
redirect_to action: :settings
|
@@ -20,7 +21,7 @@ class Plugins::FrontCache::AdminController < CamaleonCms::Apps::PluginsAdminCont
|
|
20
21
|
def clean_cache
|
21
22
|
flash[:notice] = "#{t('plugin.front_cache.message.cache_destroyed')}"
|
22
23
|
front_cache_clean()
|
23
|
-
if Rails.version.
|
24
|
+
if Rails.version.to_i < 5
|
24
25
|
redirect_to :back
|
25
26
|
else
|
26
27
|
redirect_back(fallback_location: '/admin/plugins')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"title": "Front Cache",
|
3
3
|
"descr": "Please check documentation <a href='http://camaleon.tuzitio.com/store/plugins/3'>here.</a>",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.2",
|
5
5
|
"key": "front_cache",
|
6
6
|
"position": 1,
|
7
7
|
"helpers": [
|
@@ -18,4 +18,4 @@
|
|
18
18
|
"front_after_load": ["front_cache_front_after_load"]
|
19
19
|
//here you can add all your hooks (read documentation)
|
20
20
|
}
|
21
|
-
}
|
21
|
+
}
|
@@ -2,15 +2,15 @@ module Plugins::FrontCache::FrontCacheHelper
|
|
2
2
|
|
3
3
|
# save as cache all pages configured on settings of this plugin for public users
|
4
4
|
def front_cache_front_before_load
|
5
|
-
if current_site.get_option("refresh_cache") # clear cache every restart server
|
6
|
-
front_cache_clean
|
5
|
+
if current_site.get_option("refresh_cache") # clear cache every restart server unless option checked in settings
|
6
|
+
front_cache_clean unless current_site.get_meta("front_cache_elements")[:preserve_cache_on_restart]
|
7
7
|
current_site.set_option("refresh_cache", false)
|
8
8
|
end
|
9
9
|
|
10
10
|
return if signin? || Rails.env == "development" || Rails.env == "test" || !request.get? # avoid cache if current visitor is logged in or development environment
|
11
11
|
|
12
12
|
cache_key = request.fullpath.parameterize
|
13
|
-
if !flash.keys.present? && front_cache_exist?(cache_key) # recover cache
|
13
|
+
if !flash.keys.present? && front_cache_exist?(cache_key) # recover cache item
|
14
14
|
Rails.logger.info "Camaleon CMS - readed cache: #{front_cache_plugin_get_path(cache_key)}"
|
15
15
|
response.headers['PLUGIN_FRONT_CACHE'] = 'TRUE'
|
16
16
|
args = {data: front_cache_get(cache_key).gsub("{{form_authenticity_token}}", form_authenticity_token)}; hooks_run('front_cache_reading_cache', args)
|
@@ -87,38 +87,32 @@ module Plugins::FrontCache::FrontCacheHelper
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
# clear all frontend cache
|
90
|
+
# clear all frontend cache items
|
91
91
|
def front_cache_clean
|
92
|
-
|
92
|
+
Rails.cache.clear
|
93
93
|
end
|
94
94
|
|
95
95
|
private
|
96
96
|
|
97
97
|
def front_cache_exist?(key)
|
98
|
-
|
98
|
+
!(Rails.cache.read(key).nil?)
|
99
99
|
end
|
100
100
|
|
101
101
|
def front_cache_get(key)
|
102
|
-
|
103
|
-
end
|
104
|
-
|
105
|
-
def front_cache_destroy(key)
|
106
|
-
FileUtils.rm_f(front_cache_plugin_get_path(key)) # clear site pages cache
|
102
|
+
Rails.cache.read(key)
|
107
103
|
end
|
108
104
|
|
109
105
|
def front_cache_plugin_cache_create(key, content)
|
110
|
-
|
111
|
-
File.open(front_cache_plugin_get_path(key), 'wb'){ |fo| fo.write(content) }
|
112
|
-
content
|
106
|
+
Rails.cache.write(front_cache_plugin_get_path(key), content)
|
113
107
|
end
|
114
108
|
|
115
109
|
# return the physical path of cache directory
|
116
110
|
# key: (string, optional) the key of the cached page
|
117
111
|
def front_cache_plugin_get_path(key = nil)
|
118
112
|
unless key.nil?
|
119
|
-
|
113
|
+
"pages/#{current_site.id.to_s}/#{key}"
|
120
114
|
else
|
121
|
-
|
115
|
+
"pages/#{current_site.id.to_s}"
|
122
116
|
end
|
123
117
|
|
124
118
|
end
|
@@ -20,6 +20,11 @@
|
|
20
20
|
</div>
|
21
21
|
<div class="panel-body">
|
22
22
|
<div class="alert alert-info"><%= t('plugin.front_cache.message.please_checkpost_need_cache') %></div>
|
23
|
+
<div class="form-group">
|
24
|
+
<label>Preserve cache on restart</label><br>
|
25
|
+
<%= check_box_tag("cache[preserve_cache_on_restart]", 1, @caches[:preserve_cache_on_restart]) %>
|
26
|
+
</div>
|
27
|
+
|
23
28
|
<div class="form-group">
|
24
29
|
<label><%= t('plugin.front_cache.home_page') %></label><br>
|
25
30
|
<%= check_box_tag("cache[home]", 1, @caches[:home]) %>
|
Binary file
|
@@ -44,9 +44,9 @@ class CamaleonCms::Admin::PostsController < CamaleonCms::AdminController
|
|
44
44
|
end
|
45
45
|
|
46
46
|
@btns = {published: "#{t('camaleon_cms.admin.post_type.published')} (#{posts_all.published.size})", all: "#{t('camaleon_cms.admin.post_type.all')} (#{posts_all.no_trash.size})", pending: "#{t('camaleon_cms.admin.post_type.pending')} (#{posts_all.pending.size})", draft: "#{t('camaleon_cms.admin.post_type.draft')} (#{posts_all.drafts.size})", trash: "#{t('camaleon_cms.admin.post_type.trash')} (#{posts_all.trash.size})"}
|
47
|
+
per_page = 9999999 if @post_type.manage_hierarchy?
|
47
48
|
r = {posts: @posts, post_type: @post_type, btns: @btns, all_posts: posts_all, render: 'index', per_page: per_page }
|
48
49
|
hooks_run("list_post", r)
|
49
|
-
per_page = 9999999 if @post_type.manage_hierarchy?
|
50
50
|
@posts = r[:posts].paginate(:page => params[:page], :per_page => r[:per_page])
|
51
51
|
render r[:render]
|
52
52
|
end
|
@@ -42,7 +42,7 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
|
|
42
42
|
# render contents from post type
|
43
43
|
def post_type
|
44
44
|
begin
|
45
|
-
@post_type = current_site.post_types.
|
45
|
+
@post_type = current_site.post_types.find_by_slug(params[:post_type_slug]).decorate
|
46
46
|
rescue
|
47
47
|
return page_not_found
|
48
48
|
end
|
@@ -52,7 +52,7 @@ class CamaleonCms::CustomFieldGroup < CamaleonCms::CustomField
|
|
52
52
|
# only used by form on admin panel (protected)
|
53
53
|
# return array of failed_fields and full_fields [[failed fields], [all fields]]
|
54
54
|
def add_fields(items, item_options)
|
55
|
-
self.fields.where.not(id: items.map { |_k, obj| obj['id'] }.uniq).destroy_all
|
55
|
+
self.fields.where.not(id: items.to_h.map { |_k, obj| obj['id'] }.uniq).destroy_all
|
56
56
|
cache_fields = []
|
57
57
|
order_index = 0
|
58
58
|
errors_saved = []
|
@@ -120,7 +120,6 @@ class CamaleonCms::CustomFieldGroup < CamaleonCms::CustomField
|
|
120
120
|
|
121
121
|
# auto save the default field values
|
122
122
|
def auto_save_default_values(field, options)
|
123
|
-
options = options.with_indifferent_access
|
124
123
|
class_name = object_class.split("_").first
|
125
124
|
if %w(Post Category Plugin Theme).include?(class_name) && objectid && (options[:default_value].present? || options[:default_values].present?)
|
126
125
|
if class_name == 'Theme'
|
@@ -14,7 +14,7 @@ module CamaleonCms::UserMethods extend ActiveSupport::Concern
|
|
14
14
|
|
15
15
|
# relations
|
16
16
|
has_many :metas, ->{ where(object_class: 'User')}, :class_name => "CamaleonCms::Meta", foreign_key: :objectid, dependent: :destroy
|
17
|
-
has_many :all_posts, class_name: "CamaleonCms::Post"
|
17
|
+
has_many :all_posts, class_name: "CamaleonCms::Post", foreign_key: :user_id
|
18
18
|
has_many :all_comments, class_name: "CamaleonCms::PostComment"
|
19
19
|
|
20
20
|
#scopes
|
data/lib/camaleon_cms/version.rb
CHANGED
data/lib/plugin_routes.rb
CHANGED
@@ -210,7 +210,7 @@ class PluginRoutes
|
|
210
210
|
end
|
211
211
|
|
212
212
|
def self.cache_variable(var_name, value=nil)
|
213
|
-
@@_vars.push(var_name).uniq
|
213
|
+
@@_vars.push(var_name).uniq!
|
214
214
|
#if Rails.env != "development" # disable cache plugin routes for develoment mode
|
215
215
|
cache = class_variable_get("@@cache_#{var_name}") rescue nil
|
216
216
|
return cache if value.nil?
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -78,17 +78,6 @@ ActiveRecord::Schema.define(version: 20161215202255) do
|
|
78
78
|
add_index "metas", ["object_class"], name: "index_metas_on_object_class"
|
79
79
|
add_index "metas", ["objectid"], name: "index_metas_on_objectid"
|
80
80
|
|
81
|
-
create_table "plugins_attacks", force: :cascade do |t|
|
82
|
-
t.string "path"
|
83
|
-
t.string "browser_key"
|
84
|
-
t.integer "site_id"
|
85
|
-
t.datetime "created_at"
|
86
|
-
end
|
87
|
-
|
88
|
-
add_index "plugins_attacks", ["browser_key"], name: "index_plugins_attacks_on_browser_key"
|
89
|
-
add_index "plugins_attacks", ["path"], name: "index_plugins_attacks_on_path"
|
90
|
-
add_index "plugins_attacks", ["site_id"], name: "index_plugins_attacks_on_site_id"
|
91
|
-
|
92
81
|
create_table "plugins_contact_forms", force: :cascade do |t|
|
93
82
|
t.integer "site_id"
|
94
83
|
t.integer "count"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camaleon_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.3.
|
4
|
+
version: 2.4.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owen Peredo Diaz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bcrypt
|
@@ -510,6 +510,7 @@ files:
|
|
510
510
|
- app/assets/images/camaleon_cms/language/pt-BR.png
|
511
511
|
- app/assets/images/camaleon_cms/language/pt.png
|
512
512
|
- app/assets/images/camaleon_cms/language/ru.png
|
513
|
+
- app/assets/images/camaleon_cms/language/ua.png
|
513
514
|
- app/assets/images/camaleon_cms/language/zh-CN.png
|
514
515
|
- app/assets/images/camaleon_cms/loader.gif
|
515
516
|
- app/assets/images/camaleon_cms/users/no-image.jpg
|