Ensure manifest is cached between calls.

This commit is contained in:
Will Rossiter 2014-09-27 10:12:54 +12:00
parent d2aa75e72b
commit 9cf55c57d7

View File

@ -54,6 +54,11 @@ class DocumentationViewer extends Controller {
*/ */
protected $record; protected $record;
/**
* @var DocumentationManifest
*/
protected $manifest;
/** /**
* @config * @config
* *
@ -287,9 +292,13 @@ class DocumentationViewer extends Controller {
* @return DocumentationManifest * @return DocumentationManifest
*/ */
public function getManifest() { 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(); $record = $this->getPage();
$current = $this->getEntity(); $current = $this->getEntity();
foreach($entities as $entity) { foreach($entities as $entity) {
// only show entities with the same language // only show entities with the same language
@ -638,4 +645,8 @@ class DocumentationViewer extends Controller {
public function getDocumentationTitle() { public function getDocumentationTitle() {
return $this->config()->get('documentation_title'); return $this->config()->get('documentation_title');
} }
public function getDocumentationBaseHref() {
return Config::inst()->get('DocumentationViewer', 'link_base');
}
} }