From 9cf55c57d7e9228de729cb3ed6b89d1e3c241643 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Sat, 27 Sep 2014 10:12:54 +1200 Subject: [PATCH] Ensure manifest is cached between calls. --- code/controllers/DocumentationViewer.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/code/controllers/DocumentationViewer.php b/code/controllers/DocumentationViewer.php index dffe655..34d5072 100755 --- a/code/controllers/DocumentationViewer.php +++ b/code/controllers/DocumentationViewer.php @@ -54,6 +54,11 @@ class DocumentationViewer extends Controller { */ protected $record; + /** + * @var DocumentationManifest + */ + protected $manifest; + /** * @config * @@ -287,9 +292,13 @@ class DocumentationViewer extends Controller { * @return DocumentationManifest */ public function getManifest() { - $flush = SapphireTest::is_running_test() || (isset($_GET['flush'])); + if(!$this->manifest) { + $flush = SapphireTest::is_running_test() || (isset($_GET['flush'])); - return new DocumentationManifest($flush); + $this->manifest = new DocumentationManifest($flush); + } + + return $this->manifest; } /** @@ -317,8 +326,6 @@ class DocumentationViewer extends Controller { $record = $this->getPage(); $current = $this->getEntity(); - - foreach($entities as $entity) { // only show entities with the same language @@ -638,4 +645,8 @@ class DocumentationViewer extends Controller { public function getDocumentationTitle() { return $this->config()->get('documentation_title'); } + + public function getDocumentationBaseHref() { + return Config::inst()->get('DocumentationViewer', 'link_base'); + } }