diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2015-02-11 02:50:57 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2015-02-11 02:50:57 +0300 |
commit | 492e47ca6f55aa55381523e4f32abd08096bc0c3 (patch) | |
tree | a1a0d58a4f113e6223c7c93f76421f8afc11ecd4 /plugins/ImageGraph | |
parent | 67698a6b9dd289091dab8f38814255f015f32daf (diff) |
a few performance tweaks as everything in that for loop is executed over and over again
Noticed it while debugging something. Should not have a big effect.
Diffstat (limited to 'plugins/ImageGraph')
-rw-r--r-- | plugins/ImageGraph/ImageGraph.php | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/plugins/ImageGraph/ImageGraph.php b/plugins/ImageGraph/ImageGraph.php index 9dbbefbb00..8fcfc501ac 100644 --- a/plugins/ImageGraph/ImageGraph.php +++ b/plugins/ImageGraph/ImageGraph.php @@ -116,6 +116,15 @@ class ImageGraph extends \Piwik\Plugin $token_auth = Common::getRequestVar('token_auth', false); + $segment = Request::getRawSegmentFromRequest(); + + /** @var Scheduler $scheduler */ + $scheduler = StaticContainer::getContainer()->get('Piwik\Scheduler\Scheduler'); + $isRunningTask = $scheduler->isRunningTask(); + + // add the idSubtable if it exists + $idSubtable = Common::getRequestVar('idSubtable', false); + $urlPrefix = "index.php?"; foreach ($reports as &$report) { $reportModule = $report['module']; @@ -144,20 +153,14 @@ class ImageGraph extends \Piwik\Plugin $parameters['date'] = $dateForSinglePeriodGraph; } - // add the idSubtable if it exists - $idSubtable = Common::getRequestVar('idSubtable', false); if ($idSubtable !== false) { $parameters['idSubtable'] = $idSubtable; } - /** @var Scheduler $scheduler */ - $scheduler = StaticContainer::getContainer()->get('Piwik\Scheduler\Scheduler'); - - if (!empty($_GET['_restrictSitesToLogin']) && $scheduler->isRunningTask()) { + if (!empty($_GET['_restrictSitesToLogin']) && $isRunningTask) { $parameters['_restrictSitesToLogin'] = $_GET['_restrictSitesToLogin']; } - $segment = Request::getRawSegmentFromRequest(); if (!empty($segment)) { $parameters['segment'] = $segment; } |