diff --git a/admin.php b/admin.php index eac57a2d..b1e8896f 100644 --- a/admin.php +++ b/admin.php @@ -91,9 +91,6 @@ class AdminPlugin extends Plugin // Only activate admin if we're inside the admin path. if (substr($this->uri->route(), 0, strlen($this->base)) == $this->base) { - // Disable system caching. - $this->config->set('system.cache.enabled', false); - // Change login behavior. $this->config->set('plugins.login', $this->config->get('plugins.admin.login')); @@ -239,10 +236,6 @@ class AdminPlugin extends Plugin 'onTwigSiteVariables' => ['onTwigSiteVariables', 1000] ]); - - // Disable system caching. - $this->config->set('system.cache.enabled', false); - // Change login behavior. $this->config->set('plugins.login', $this->config->get('plugins.admin.login')); diff --git a/classes/admin.php b/classes/admin.php index 0f8e01d6..a73be70a 100644 --- a/classes/admin.php +++ b/classes/admin.php @@ -1,6 +1,7 @@ user->authenticated && isset($form['username']) && isset($form['password'])) { - $file = YamlFile::instance(ACCOUNTS_DIR . $form['username'] . YAML_EXT); + $file = CompiledYamlFile::instance(ACCOUNTS_DIR . $form['username'] . YAML_EXT); if ($file->exists()) { $user = new User($file->content()); $user->authenticated = true; @@ -226,7 +227,7 @@ class Admin $config = $this->grav['config']; $obj = new Data\Data($config->get('system'), $blueprints); $obj->merge($post); - $file = YamlFile::instance(USER_DIR . "config/{$type}.yaml"); + $file = CompiledYamlFile::instance(USER_DIR . "config/{$type}.yaml"); $obj->file($file); $data[$type] = $obj; break; @@ -238,7 +239,7 @@ class Admin $config = $this->grav['config']; $obj = new Data\Data($config->get('site'), $blueprints); $obj->merge($post); - $file = YamlFile::instance(USER_DIR . "config/{$type}.yaml"); + $file = CompiledYamlFile::instance(USER_DIR . "config/{$type}.yaml"); $obj->file($file); $data[$type] = $obj; break; @@ -248,11 +249,17 @@ class Admin break; default: + /** @var UniformResourceLocator $locator */ + $locator = $this->grav['locator']; + $filename = $locator->findResource("config://{$type}.yaml", true, true); + $file = CompiledYamlFile::instance($filename); + if (preg_match('|plugins/|', $type)) { /** @var Plugins $plugins */ $plugins = $this->grav['plugins']; $obj = $plugins->get(preg_replace('|plugins/|', '', $type)); $obj->merge($post); + $obj->file($file); $data[$type] = $obj; } elseif (preg_match('|themes/|', $type)) { @@ -260,6 +267,7 @@ class Admin $themes = $this->grav['themes']; $obj = $themes->get(preg_replace('|themes/|', '', $type)); $obj->merge($post); + $obj->file($file); $data[$type] = $obj; } else { diff --git a/classes/controller.php b/classes/controller.php index e25b078a..21c03429 100644 --- a/classes/controller.php +++ b/classes/controller.php @@ -305,6 +305,13 @@ class AdminController $this->admin->setMessage('Successfully saved'); } + if ($this->view != 'pages') { + // Force configuration reload. + /** @var Config $config */ + $config = $this->grav['config']; + $config->reload(); + } + // Redirect to new location. if ($obj instanceof Page\Page && $obj->route() != $this->admin->route()) { $this->setRedirect($this->view . '/' . $obj->route()); diff --git a/themes/grav/templates/plugins.html.twig b/themes/grav/templates/plugins.html.twig index 3725c71f..0df72079 100644 --- a/themes/grav/templates/plugins.html.twig +++ b/themes/grav/templates/plugins.html.twig @@ -13,7 +13,7 @@

Plugins

{% else %}
- +

Plugin: {{ plugin.name|e }}

{% endif %} diff --git a/themes/grav/templates/themes.html.twig b/themes/grav/templates/themes.html.twig index a24d814f..877d4d29 100644 --- a/themes/grav/templates/themes.html.twig +++ b/themes/grav/templates/themes.html.twig @@ -13,7 +13,7 @@

Themes

{% else %}
- +

Theme: {{ theme.name|e }}

{% endif %}