Added support for purge in cache dropdown

This commit is contained in:
Andy Miller
2018-09-20 11:25:04 -06:00
parent 1a50e35bd7
commit b6c2dc6186
7 changed files with 33 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
name: Admin Panel
version: 1.9.0
version: 1.9.0-dev
description: Adds an advanced administration panel to manage your site
icon: empire
author:

View File

@@ -1273,19 +1273,29 @@ class AdminController extends AdminBaseController
$clear = 'standard';
}
$results = Cache::clearCache($clear);
if (count($results) > 0) {
if ($clear === 'purge') {
$msg = Cache::purgeJob();
$this->admin->json_response = [
'status' => 'success',
'message' => $this->admin->translate('PLUGIN_ADMIN.CACHE_CLEARED') . ' <br />' . $this->admin->translate('PLUGIN_ADMIN.METHOD') . ': ' . $clear . ''
'message' => $msg,
];
} else {
$this->admin->json_response = [
'status' => 'error',
'message' => $this->admin->translate('PLUGIN_ADMIN.ERROR_CLEARING_CACHE')
];
$results = Cache::clearCache($clear);
if (count($results) > 0) {
$this->admin->json_response = [
'status' => 'success',
'message' => $this->admin->translate('PLUGIN_ADMIN.CACHE_CLEARED') . ' <br />' . $this->admin->translate('PLUGIN_ADMIN.METHOD') . ': ' . $clear . ''
];
} else {
$this->admin->json_response = [
'status' => 'error',
'message' => $this->admin->translate('PLUGIN_ADMIN.ERROR_CLEARING_CACHE')
];
}
}
return true;
}

View File

@@ -372,6 +372,9 @@ PLUGIN_ADMIN:
CACHE_PREFIX: "Cache prefix"
CACHE_PREFIX_HELP: "An identifier for part of the Grav key. Don't change unless you know what your doing."
CACHE_PREFIX_PLACEHOLDER: "Derived from base URL (override by entering random string)"
CACHE_PURGE_JOB: "Run Scheduled Purge Job"
CACHE_PURGE_JOB_HELP: "With the scheduler you can periodically clear out old Doctrine file cache folders with this job"
CACHE_PURGE: "Purge Old Cache"
LIFETIME: "Lifetime"
LIFETIME_HELP: "Sets the cache lifetime in seconds. 0 = infinite"
GZIP_COMPRESSION: "Gzip compression"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -523,10 +523,17 @@ body.sidebar-quickopen #admin-main {
margin-left: $sidebar-width-large;
}
.hint:after, [data-hint]:after {
max-width: 300px;
.form-label label {
.hint:after, [data-hint]:after {
max-width: 300px;
min-width: 150px;
display: inline-table;
white-space: initial;
line-height: 1.2;
}
}
h1 {
margin: 0;
font-size: 1.3rem;

View File

@@ -18,6 +18,7 @@
<li><a data-clear-cache-type="images-only" data-clear-cache="{{ uri.addNonce(clear_cache_url ~'/cleartype' ~ config.system.param_sep ~ 'images-only', 'admin-form', 'admin-nonce') }}" href="#">{{ "PLUGIN_ADMIN.CLEAR_CACHE_IMAGES_ONLY"|tu }}</a></li>
<li><a data-clear-cache-type="cache-only" data-clear-cache="{{ uri.addNonce(clear_cache_url ~'/cleartype' ~ config.system.param_sep ~ 'cache-only', 'admin-form', 'admin-nonce') }}" href="#">{{ "PLUGIN_ADMIN.CLEAR_CACHE_CACHE_ONLY"|tu }}</a></li>
<li><a data-clear-cache-type="tmp-only" data-clear-cache="{{ uri.addNonce(clear_cache_url ~'/cleartype' ~ config.system.param_sep ~ 'tmp-only', 'admin-form', 'admin-nonce') }}" href="#">{{ "PLUGIN_ADMIN.CLEAR_CACHE_TMP_ONLY"|tu }}</a></li>
<li><a data-clear-cache-type="purge" data-clear-cache="{{ uri.addNonce(clear_cache_url ~'/cleartype' ~ config.system.param_sep ~ 'purge', 'admin-form', 'admin-nonce') }}" href="#">{{ "PLUGIN_ADMIN.CACHE_PURGE"|tu }}</a></li>
</ul>
</div>
{% endif %}