From 09f4d2b7918cc823a11f6271bd3faccd90a203f7 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Wed, 21 Jun 2017 15:50:31 +0200 Subject: [PATCH] Fix #1141 referencing DI element when not initialized --- admin.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/admin.php b/admin.php index 44677801b..6102c43f8 100644 --- a/admin.php +++ b/admin.php @@ -523,18 +523,17 @@ public function onTwigSiteVariables() */ public function onShutdown() { - // Just so we know that we're in this debug mode - if ($this->config->get('plugins.admin.popularity.enabled')) { - - // Only track non-admin - if (!$this->active) { + if ($this->active) { + //only activate when Admin is active + if ($this->shouldLoadAdditionalFilesInBackground()) { + $this->loadAdditionalFilesInBackground(); + } + } else { + //if popularity is enabled, track non-admin hits + if ($this->config->get('plugins.admin.popularity.enabled')) { $this->popularity->trackHit(); } } - - if ($this->grav['admin']->shouldLoadAdditionalFilesInBackground()) { - $this->grav['admin']->loadAdditionalFilesInBackground(); - } } /**