diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-11-18 03:03:08 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-11-18 03:03:08 +0400 |
commit | a8a2f9bc7ea3482c86fc5be9ca0e27ae96e94f6e (patch) | |
tree | 277630d42a8eb5acf97a1a91efd196eacc2938b1 | |
parent | 18a7ecabaff1882e77c48c37b01b3583f5f4350a (diff) |
Refs #4310
-rw-r--r-- | core/ArchiveProcessor/Parameters.php | 2 | ||||
-rw-r--r-- | core/FrontController.php | 12 | ||||
-rw-r--r-- | core/Profiler.php | 6 | ||||
-rw-r--r-- | misc/cron/archive.php | 2 |
4 files changed, 14 insertions, 8 deletions
diff --git a/core/ArchiveProcessor/Parameters.php b/core/ArchiveProcessor/Parameters.php index 70bb06e0ec..49729a4da7 100644 --- a/core/ArchiveProcessor/Parameters.php +++ b/core/ArchiveProcessor/Parameters.php @@ -170,7 +170,7 @@ class Parameters $temporary = 'temporary archive'; } Log::verbose( - "'%s, idSite = %d (%s), segment '%s', report = '%s', UTC datetime [%s -> %s]", + "%s archive, idSite = %d (%s), segment '%s', report = '%s', UTC datetime [%s -> %s]", $this->getPeriod()->getLabel(), $this->getSite()->getId(), $temporary, diff --git a/core/FrontController.php b/core/FrontController.php index e86aceff78..bd010eb936 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -275,9 +275,6 @@ class FrontController extends Singleton Filechecks::dieIfDirectoriesNotWritable($directoriesToCheck); self::assignCliParametersToRequest(); - if(!empty($_GET['xhprof'])) { - Profiler::setupProfilerXHProf($mainRun = false); - } Translate::loadEnglishTranslation(); @@ -289,6 +286,7 @@ class FrontController extends Singleton $this->handleMaintenanceMode(); $this->handleSSLRedirection(); + $this->handleProfiler(); $pluginsManager = \Piwik\Plugin\Manager::getInstance(); $pluginsToLoad = Config::getInstance()->Plugins['Plugins']; @@ -492,6 +490,14 @@ class FrontController extends Singleton } } } + + private function handleProfiler() + { + if (!empty($_GET['xhprof'])) { + $mainRun = $_GET['xhprof'] == 1; // archive.php sets xhprof=2 + Profiler::setupProfilerXHProf($mainRun); + } + } } /** diff --git a/core/Profiler.php b/core/Profiler.php index 7a0f2b0d39..ec48788471 100644 --- a/core/Profiler.php +++ b/core/Profiler.php @@ -227,7 +227,7 @@ class Profiler if($mainRun) { $runIds = implode(',', $runs); $out = "\n\nHere is the profiler URL aggregating all runs triggered from this process: "; - $baseUrl = "http://" . $_SERVER['HTTP_HOST'] . "/" . $_SERVER['REQUEST_URI']; + $baseUrl = "http://" . @$_SERVER['HTTP_HOST'] . "/" . @$_SERVER['REQUEST_URI']; $baseUrlStored = SettingsPiwik::getPiwikUrl(); if(strlen($baseUrlStored) > strlen($baseUrl)) { $baseUrl = $baseUrlStored; @@ -237,7 +237,7 @@ class Profiler $out .= $baseUrl . "$runIds\n\n"; $out .= "Main run profile:"; $out .= $baseUrl . "$runId\n\n"; - Log::info($out); + echo ($out); } else { self::setProfilingRunIds($runs); } @@ -247,7 +247,7 @@ class Profiler private static function setProfilingRunIds($ids) { file_put_contents( self::getPathToXHProfRunIds(), json_encode($ids) ); - chmod(self::getPathToXHProfRunIds(), 0777); + @chmod(self::getPathToXHProfRunIds(), 0777); } private static function getProfilingRunIds() diff --git a/misc/cron/archive.php b/misc/cron/archive.php index dbc947eb4b..8dc70bd0ee 100644 --- a/misc/cron/archive.php +++ b/misc/cron/archive.php @@ -632,7 +632,7 @@ class CronArchive $url = $this->piwikUrl . $url . self::APPEND_TO_API_REQUEST; if($this->shouldStartProfiler) { - $url .= "&xhprof=1"; + $url .= "&xhprof=2"; } //$this->log($url); |