From ddf166e1444d5e6e7a93c7b23ceee71001d76dad Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 19 Sep 2011 21:55:11 -0400 Subject: [PATCH] setting to turn off expensive queries --- CONFIGURE | 7 +++++++ actions/all.php | 7 ++++--- actions/attachment.php | 6 ++++-- actions/public.php | 2 +- actions/showstream.php | 6 ++++-- lib/router.php | 14 +++++++++----- 6 files changed, 29 insertions(+), 13 deletions(-) diff --git a/CONFIGURE b/CONFIGURE index 3f0ae668ab..285ccd11b3 100644 --- a/CONFIGURE +++ b/CONFIGURE @@ -852,3 +852,10 @@ path: Path to the plugin files. defaults to site/path + '/plugins/'. Expects tha each plugin will have a subdirectory at plugins/NameOfPlugin. Change this if you're using a CDN. sslpath: Path to use on the SSL server. Same as plugins/path. + +performance +----------- + +high: if you need high performance, or if you're seeing bad + performance, set this to true. It will turn off some high-intensity code from + the site. diff --git a/actions/all.php b/actions/all.php index cbd2805ca3..2b83127f72 100644 --- a/actions/all.php +++ b/actions/all.php @@ -211,12 +211,13 @@ class AllAction extends ProfileAction $ibs->show(); } // XXX: make this a little more convenient - if (common_config('site', 'private')) { + + if (!common_config('performance', 'high')) { $pop = new PopularNoticeSection($this); $pop->show(); + $pop = new InboxTagCloudSection($this, $this->user); + $pop->show(); } - // $pop = new InboxTagCloudSection($this, $this->user); - // $pop->show(); } } diff --git a/actions/attachment.php b/actions/attachment.php index 22018ab043..f149ca19d9 100644 --- a/actions/attachment.php +++ b/actions/attachment.php @@ -173,7 +173,9 @@ class AttachmentAction extends Action function showSections() { $ns = new AttachmentNoticeSection($this); $ns->show(); - $atcs = new AttachmentTagCloudSection($this); - $atcs->show(); + if (!common_config('performance', 'high')) { + $atcs = new AttachmentTagCloudSection($this); + $atcs->show(); + } } } diff --git a/actions/public.php b/actions/public.php index 0e403f5af5..4743ff24c3 100644 --- a/actions/public.php +++ b/actions/public.php @@ -245,7 +245,7 @@ class PublicAction extends Action $pop = new PopularNoticeSection($this); $pop->show(); - if (common_config('site', 'private')) { + if (common_config('performance', 'high')) { $cloud = new PublicTagCloudSection($this); $cloud->show(); } diff --git a/actions/showstream.php b/actions/showstream.php index ccd976a0e3..6e5ba84511 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -285,8 +285,10 @@ class ShowstreamAction extends ProfileAction function showSections() { parent::showSections(); - $cloud = new PersonalTagCloudSection($this, $this->user); - $cloud->show(); + if (!common_config('performance', 'high')) { + $cloud = new PersonalTagCloudSection($this, $this->user); + $cloud->show(); + } } function noticeFormOptions() diff --git a/lib/router.php b/lib/router.php index 4020ba0e39..1fb5165621 100644 --- a/lib/router.php +++ b/lib/router.php @@ -274,10 +274,12 @@ class Router array('action' => 'userbyid'), array('id' => '[0-9]+')); - $m->connect('tags/', array('action' => 'publictagcloud')); - $m->connect('tag/', array('action' => 'publictagcloud')); - $m->connect('tags', array('action' => 'publictagcloud')); - $m->connect('tag', array('action' => 'publictagcloud')); + if (!common_config('performance', 'high')) { + $m->connect('tags/', array('action' => 'publictagcloud')); + $m->connect('tag/', array('action' => 'publictagcloud')); + $m->connect('tags', array('action' => 'publictagcloud')); + $m->connect('tag', array('action' => 'publictagcloud')); + } $m->connect('tag/:tag/rss', array('action' => 'tagrss'), array('tag' => self::REGEX_TAG)); @@ -898,7 +900,9 @@ class Router // people tags - $m->connect('peopletags', array('action' => 'publicpeopletagcloud')); + if (!common_config('performance', 'high')) { + $m->connect('peopletags', array('action' => 'publicpeopletagcloud')); + } $m->connect('peopletag/:tag', array('action' => 'peopletag', 'tag' => self::REGEX_TAG)); -- 2.39.5