From eca49bfc943f835ccb4ec9dd23aa7730b1967652 Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 27 Jun 2023 17:30:40 +0100 Subject: [PATCH] don't cache data that mostly won't be used --- ext/help_pages/main.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/ext/help_pages/main.php b/ext/help_pages/main.php index 6c35390a..770b0cb1 100644 --- a/ext/help_pages/main.php +++ b/ext/help_pages/main.php @@ -39,23 +39,13 @@ class HelpPages extends Extension /** @var HelpPagesTheme */ protected Themelet $theme; public const SEARCH = "search"; - private ?array $pages = null; - - private function get_pages(): array - { - if ($this->pages==null) { - $this->pages = send_event(new HelpPageListBuildingEvent())->pages; - } - return $this->pages; - } public function onPageRequest(PageRequestEvent $event) { global $page; - $pages = $this->get_pages(); - if ($event->page_matches("help")) { + $pages = send_event(new HelpPageListBuildingEvent())->pages; if ($event->count_args() == 0) { $name = array_key_first($pages); $page->set_mode(PageMode::REDIRECT); @@ -98,7 +88,7 @@ class HelpPages extends Extension public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { if ($event->parent=="help") { - $pages = $this->get_pages(); + $pages = send_event(new HelpPageListBuildingEvent())->pages; foreach ($pages as $key=>$value) { $event->add_nav_link("help_".$key, new Link('help/'.$key), $value); }