コード例 #1
0
 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
     }
 }
コード例 #2
0
ファイル: Archive.php プロジェクト: carriercomm/piwik
 /**
  * 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);
         }
     }
 }
コード例 #3
0
ファイル: Manager.php プロジェクト: TensorWrenchOSS/piwik
 /**
  * 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;
 }
コード例 #4
0
 /**
  * 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);
     }
 }
コード例 #5
0
ファイル: Parameters.php プロジェクト: carriercomm/piwik
 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());
 }
コード例 #6
0
ファイル: Db.php プロジェクト: TensorWrenchOSS/piwik
 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);
 }
コード例 #7
0
ファイル: View.php プロジェクト: TensorWrenchOSS/piwik
 /**
  * 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();
 }