mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-06 00:06:54 +02:00
Set cache key uniquely for admin to not colide with site.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
* The default Grav theme has been tweaked and in many places completely rewritten to ensure that it's as flexible as possible. The primary reason for this was to ensure theming and customization compatibility for the upcoming Admin Pro plugin, but a key benefit includes greatly improved mobile compatibility.
|
||||
* Lists can now accept a custom button label with the 'btnLabel' property
|
||||
* After login to Admin, redirect to the original URL called
|
||||
* Admin now has an unique cache key compared to the 'site' so pages can be cached independently
|
||||
1. [](#bugfix)
|
||||
* Clear cache after adding a new folder
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class AdminPlugin extends Plugin
|
||||
{
|
||||
if (!Grav::instance()['config']->get('plugins.admin-pro.enabled')) {
|
||||
return [
|
||||
'onPluginsInitialized' => [['setup', 100000], ['onPluginsInitialized', 1000]],
|
||||
'onPluginsInitialized' => [['setup', 100000], ['onPluginsInitialized', 1001]],
|
||||
'onShutdown' => ['onShutdown', 1000],
|
||||
'onFormProcessed' => ['onFormProcessed', 0],
|
||||
'onAdminDashboard' => ['onAdminDashboard', 0],
|
||||
@@ -243,6 +243,13 @@ class AdminPlugin extends Plugin
|
||||
// Only activate admin if we're inside the admin path.
|
||||
if ($this->active) {
|
||||
|
||||
// Have a unique Admin-only Cache key
|
||||
if (method_exists($this->grav['cache'], 'setKey')){
|
||||
$cache = $this->grav['cache'];
|
||||
$cache_key = $cache->getKey();
|
||||
$cache->setKey($cache_key . '$');
|
||||
}
|
||||
|
||||
// Turn on Twig autoescaping
|
||||
if (method_exists($this->grav['twig'], 'setAutoescape')) {
|
||||
$this->grav['twig']->setAutoescape(true);
|
||||
|
||||
Reference in New Issue
Block a user