From db7470ed2422419be42889f0559cd4a7fdf3f8b1 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 7 Jan 2016 16:15:17 -0500 Subject: [PATCH] Add season proxy --- Toolkit/Page.php | 19 ++++++++++++++++++- season.php | 28 ++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 season.php diff --git a/Toolkit/Page.php b/Toolkit/Page.php index b20f5fd..84a8659 100755 --- a/Toolkit/Page.php +++ b/Toolkit/Page.php @@ -1114,7 +1114,7 @@ class Toolkit_Page private function _seasons() { - $seasonMapper = new Toolkit_Seasons_Season(); + $seasonMapper = new Toolkit_Seasonator_Season(); $season = $seasonMapper->fetchById( Toolkit_Database::getInstance(), 1 @@ -1123,6 +1123,23 @@ class Toolkit_Page $season->getName() . '.css?_=' . strtotime($season->getLast_update()); } + public function getSeason() + { + $cache = new Cache_Lite($GLOBALS['cacheOptions']); + if ($season = $cache->get('seasonProxy', 'Season')) { + $output = unserialize($season); + } else { + $seasonMapper = new Toolkit_Seasonator_Season(); + $season = $seasonMapper->fetchById( + Toolkit_Database::getInstance(), + 1 + ); + $output = $season->getName() . '.css?_=' . strtotime($season->getLast_update()); + $cache->save(serialize($output), 'seasonProxy', 'Season'); + } + return $output; + } + /** * Sets the video url for the embed video if not found then set as empty * diff --git a/season.php b/season.php new file mode 100644 index 0000000..7021aa0 --- /dev/null +++ b/season.php @@ -0,0 +1,28 @@ +getSeason(); +echo $output; -- 2.17.1