public function logVariables() { try { if (isset($_SERVER['QUERY_STRING'])) { \Piwik\Log::verbose("Test Environment Variables for (%s):\n%s", $_SERVER['QUERY_STRING'], print_r($this->behaviorOverrideProperties, true)); } } catch (Exception $ex) { // ignore } }
/** * Gets the IDs of the archives we're querying for and stores them in $this->archives. * This function will launch the archiving process for each period/site/plugin if * metrics/reports have not been calculated/archived already. * * @param array $archiveGroups @see getArchiveGroupOfReport * @param array $plugins List of plugin names to archive. */ private function cacheArchiveIdsAfterLaunching($archiveGroups, $plugins) { $today = Date::today(); foreach ($this->params->getPeriods() as $period) { $twoDaysBeforePeriod = $period->getDateStart()->subDay(2); $twoDaysAfterPeriod = $period->getDateEnd()->addDay(2); foreach ($this->params->getIdSites() as $idSite) { $site = new Site($idSite); // if the END of the period is BEFORE the website creation date // we already know there are no stats for this period // we add one day to make sure we don't miss the day of the website creation if ($twoDaysAfterPeriod->isEarlier($site->getCreationDate())) { Log::verbose("Archive site %s, %s (%s) skipped, archive is before the website was created.", $idSite, $period->getLabel(), $period->getPrettyString()); continue; } // if the starting date is in the future we know there is no visiidsite = ?t if ($twoDaysBeforePeriod->isLater($today)) { Log::verbose("Archive site %s, %s (%s) skipped, archive is after today.", $idSite, $period->getLabel(), $period->getPrettyString()); continue; } $this->prepareArchive($archiveGroups, $site, $period); } } }
/** * Install loaded plugins * * @throws * @return array Error messages of plugin install fails */ public function installLoadedPlugins() { Log::verbose("Loaded plugins: " . implode(", ", array_keys($this->getLoadedPlugins()))); $messages = array(); foreach ($this->getLoadedPlugins() as $plugin) { try { $this->installPluginIfNecessary($plugin); } catch (\Exception $e) { $messages[] = $e->getMessage(); } } return $messages; }
/** * Called at the end of the page generation */ public function __destruct() { try { if (class_exists('Piwik\\Profiler') && !SettingsServer::isTrackerApiRequest()) { // in tracker mode Piwik\Tracker\Db\Pdo\Mysql does currently not implement profiling Profiler::displayDbProfileReport(); Profiler::printQueryCount(); } } catch (Exception $e) { Log::verbose($e); } }
public function logStatusDebug($isTemporary) { $temporary = 'definitive archive'; if ($isTemporary) { $temporary = 'temporary archive'; } Log::verbose("%s archive, idSite = %d (%s), segment '%s', report = '%s', UTC datetime [%s -> %s]", $this->getPeriod()->getLabel(), $this->getSite()->getId(), $temporary, $this->getSegment()->getString(), $this->getRequestedPlugin(), $this->getDateStart()->getDateStartUTC(), $this->getDateEnd()->getDateEndUTC()); }
private static function logSql($functionName, $sql, $parameters = array()) { // NOTE: at the moment we dont log bind in order to avoid sensitive information leaks Log::verbose("Db::%s() executing SQL:\n%s", $functionName, $sql); }
/** * Renders the current view. Also sends the stored 'Content-Type' HTML header. * See {@link setContentType()}. * * @return string Generated template. */ public function render() { try { $this->currentModule = Piwik::getModule(); $this->currentAction = Piwik::getAction(); $this->url = Common::sanitizeInputValue(Url::getCurrentUrl()); $this->token_auth = Piwik::getCurrentUserTokenAuth(); $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess(); $this->userIsSuperUser = Piwik::hasUserSuperUserAccess(); $this->latest_version_available = UpdateCheck::isNewestVersionAvailable(); $this->disableLink = Common::getRequestVar('disableLink', 0, 'int'); $this->isWidget = Common::getRequestVar('widget', 0, 'int'); $this->cacheBuster = UIAssetCacheBuster::getInstance()->piwikVersionBasedCacheBuster(); $this->loginModule = Piwik::getLoginPluginName(); $user = APIUsersManager::getInstance()->getUser($this->userLogin); $this->userAlias = $user['alias']; } catch (Exception $e) { Log::verbose($e); // can fail, for example at installation (no plugin loaded yet) } try { $this->totalTimeGeneration = Registry::get('timer')->getTime(); $this->totalNumberOfQueries = Profiler::getQueryCount(); } catch (Exception $e) { $this->totalNumberOfQueries = 0; } ProxyHttp::overrideCacheControlHeaders('no-store'); Common::sendHeader('Content-Type: ' . $this->contentType); // always sending this header, sometimes empty, to ensure that Dashboard embed loads (which could call this header() multiple times, the last one will prevail) Common::sendHeader('X-Frame-Options: ' . (string) $this->xFrameOptions); return $this->renderTwigTemplate(); }