当前位置: 首页>>代码示例>>PHP>>正文


PHP Log::warning方法代码示例

本文整理汇总了PHP中Piwik\Log::warning方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::warning方法的具体用法?PHP Log::warning怎么用?PHP Log::warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\Log的用法示例。


在下文中一共展示了Log::warning方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: purgeData

 /**
  * Purges old data from the following tables:
  * - log_visit
  * - log_link_visit_action
  * - log_conversion
  * - log_conversion_item
  * - log_action
  */
 public function purgeData()
 {
     $maxIdVisit = $this->getDeleteIdVisitOffset();
     // break if no ID was found (nothing to delete for given period)
     if (empty($maxIdVisit)) {
         return;
     }
     $logTables = self::getDeleteTableLogTables();
     // delete data from log tables
     $where = "WHERE idvisit <= ?";
     foreach ($logTables as $logTable) {
         // deleting from log_action must be handled differently, so we do it later
         if ($logTable != Common::prefixTable('log_action')) {
             Db::deleteAllRows($logTable, $where, "idvisit ASC", $this->maxRowsToDeletePerQuery, array($maxIdVisit));
         }
     }
     // delete unused actions from the log_action table (but only if we can lock tables)
     if (Db::isLockPrivilegeGranted()) {
         $this->purgeUnusedLogActions();
     } else {
         $logMessage = get_class($this) . ": LOCK TABLES privilege not granted; skipping unused actions purge";
         Log::warning($logMessage);
     }
     // optimize table overhead after deletion
     Db::optimizeTables($logTables);
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:34,代码来源:LogDataPurger.php

示例2: addCommandIfExists

 private function addCommandIfExists($command)
 {
     if (!class_exists($command)) {
         Log::warning(sprintf('Cannot add command %s, class does not exist', $command));
     } elseif (!is_subclass_of($command, 'Piwik\\Plugin\\ConsoleCommand')) {
         Log::warning(sprintf('Cannot add command %s, class does not extend Piwik\\Plugin\\ConsoleCommand', $command));
     } else {
         $this->add(new $command());
     }
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:10,代码来源:Console.php

示例3: purgeData

 /**
  * Purges old data from the following tables:
  * - log_visit
  * - log_link_visit_action
  * - log_conversion
  * - log_conversion_item
  * - log_action
  *
  * @param int $deleteLogsOlderThan The number of days after which log entires are considered old.
  *                                 Visits and related data whose age is greater than this number
  *                                 will be purged.
  */
 public function purgeData($deleteLogsOlderThan)
 {
     $dateUpperLimit = Date::factory("today")->subDay($deleteLogsOlderThan);
     $this->logDeleter->deleteVisitsFor($start = null, $dateUpperLimit->getDatetime());
     $logTables = self::getDeleteTableLogTables();
     // delete unused actions from the log_action table (but only if we can lock tables)
     if (Db::isLockPrivilegeGranted()) {
         $this->rawLogDao->deleteUnusedLogActions();
     } else {
         $logMessage = get_class($this) . ": LOCK TABLES privilege not granted; skipping unused actions purge";
         Log::warning($logMessage);
     }
     // optimize table overhead after deletion
     Db::optimizeTables($logTables);
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:27,代码来源:LogDataPurger.php

示例4: addCommandIfExists

 private function addCommandIfExists($command)
 {
     if (!class_exists($command)) {
         Log::warning(sprintf('Cannot add command %s, class does not exist', $command));
     } elseif (!is_subclass_of($command, 'Piwik\\Plugin\\ConsoleCommand')) {
         Log::warning(sprintf('Cannot add command %s, class does not extend Piwik\\Plugin\\ConsoleCommand', $command));
     } else {
         /** @var Command $commandInstance */
         $commandInstance = new $command();
         // do not add the command if it already exists; this way we can add the command ourselves in tests
         if (!$this->has($commandInstance->getName())) {
             $this->add($commandInstance);
         }
     }
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:15,代码来源:Console.php

示例5: run

 public function run()
 {
     $console = new Application();
     $commands = $this->getAvailableCommands();
     foreach ($commands as $command) {
         if (!class_exists($command)) {
             Log::warning(sprintf('Cannot add command %s, class does not exist', $command));
         } elseif (!is_subclass_of($command, 'Piwik\\Plugin\\ConsoleCommand')) {
             Log::warning(sprintf('Cannot add command %s, class does not extend Piwik\\Plugin\\ConsoleCommand', $command));
         } else {
             $console->add(new $command());
         }
     }
     $console->run();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:15,代码来源:Console.php

示例6: doRun

 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $this->initPiwikHost($input);
     $this->initConfig($output);
     try {
         self::initPlugins();
     } catch (\Exception $e) {
         // Piwik not installed yet, no config file?
     }
     Translate::reloadLanguage('en');
     $commands = $this->getAvailableCommands();
     foreach ($commands as $command) {
         if (!class_exists($command)) {
             Log::warning(sprintf('Cannot add command %s, class does not exist', $command));
         } elseif (!is_subclass_of($command, 'Piwik\\Plugin\\ConsoleCommand')) {
             Log::warning(sprintf('Cannot add command %s, class does not extend Piwik\\Plugin\\ConsoleCommand', $command));
         } else {
             $this->add(new $command());
         }
     }
     return parent::doRun($input, $output);
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:22,代码来源:Console.php

示例7: findComponent

 /**
  * Tries to find a component such as a Menu or Tasks within this plugin.
  *
  * @param string $componentName      The name of the component you want to look for. In case you request a
  *                                   component named 'Menu' it'll look for a file named 'Menu.php' within the
  *                                   root of the plugin folder that implements a class named
  *                                   Piwik\Plugin\$PluginName\Menu . If such a file exists but does not implement
  *                                   this class it'll silently ignored.
  * @param string $expectedSubclass   If not empty, a check will be performed whether a found file extends the
  *                                   given subclass. If the requested file exists but does not extend this class
  *                                   a warning will be shown to advice a developer to extend this certain class.
  *
  * @return \stdClass|null  Null if the requested component does not exist or an instance of the found
  *                         component.
  */
 public function findComponent($componentName, $expectedSubclass)
 {
     $this->createCacheIfNeeded();
     $cacheId = 'Plugin' . $this->pluginName . $componentName . $expectedSubclass;
     $componentFile = sprintf('%s/plugins/%s/%s.php', PIWIK_INCLUDE_PATH, $this->pluginName, $componentName);
     if ($this->cache->contains($cacheId)) {
         $classname = $this->cache->fetch($cacheId);
         if (empty($classname)) {
             return null;
             // might by "false" in case has no menu, widget, ...
         }
         if (file_exists($componentFile)) {
             include_once $componentFile;
         }
     } else {
         $this->cache->save($cacheId, false);
         // prevent from trying to load over and over again for instance if there is no Menu for a plugin
         if (!file_exists($componentFile)) {
             return null;
         }
         require_once $componentFile;
         $classname = sprintf('Piwik\\Plugins\\%s\\%s', $this->pluginName, $componentName);
         if (!class_exists($classname)) {
             return null;
         }
         if (!empty($expectedSubclass) && !is_subclass_of($classname, $expectedSubclass)) {
             Log::warning(sprintf('Cannot use component %s for plugin %s, class %s does not extend %s', $componentName, $this->pluginName, $classname, $expectedSubclass));
             return null;
         }
         $this->cache->save($cacheId, $classname);
     }
     return StaticContainer::get($classname);
 }
开发者ID:nuxwin,项目名称:piwik,代码行数:48,代码来源:Plugin.php

示例8: warnIfSubtableAlreadyExists

 private function warnIfSubtableAlreadyExists()
 {
     if (!is_null($this->c[self::DATATABLE_ASSOCIATED])) {
         Log::warning("Row with label '%s' (columns = %s) has already a subtable id=%s but it was not loaded - overwriting the existing sub-table.", $this->getColumn('label'), implode(", ", $this->getColumns()), $this->getIdSubDataTable());
     }
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:6,代码来源:Row.php

示例9: testLoggingNonString

 /**
  * @dataProvider getBackendsToTest
  */
 public function testLoggingNonString($backend)
 {
     $this->recreateLogSingleton($backend);
     Log::warning(123);
     $this->checkBackend($backend, '123', $formatMessage = true, $tag = 'Monolog');
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:9,代码来源:LogTest.php

示例10: logMessageIfRequestPropertiesHaveChanged

 private function logMessageIfRequestPropertiesHaveChanged(array $requestPropertiesBefore)
 {
     $requestProperties = $this->requestConfig->getProperties();
     $diff = array_diff_assoc($this->makeSureArrayContainsOnlyStrings($requestProperties), $this->makeSureArrayContainsOnlyStrings($requestPropertiesBefore));
     if (!empty($diff['filter_sort_column'])) {
         // this here might be ok as it can be changed after data loaded but before filters applied
         unset($diff['filter_sort_column']);
     }
     if (!empty($diff['filter_sort_order'])) {
         // this here might be ok as it can be changed after data loaded but before filters applied
         unset($diff['filter_sort_order']);
     }
     if (empty($diff)) {
         return;
     }
     $details = array('changedProperties' => $diff, 'apiMethod' => $this->requestConfig->apiMethodToRequestDataTable, 'controller' => $this->config->controllerName . '.' . $this->config->controllerAction, 'viewDataTable' => static::getViewDataTableId());
     $message = 'Some ViewDataTable::requestConfig properties have changed after requesting the data table. ' . 'That means the changed values had probably no effect. For instance in beforeRender() hook. ' . 'Probably a bug? Details:' . print_r($details, 1);
     Log::warning($message);
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:19,代码来源:Visualization.php

示例11: getPreviousScheduledTime

 private function getPreviousScheduledTime($rescheduledTime)
 {
     $updaterPeriod = Option::get(self::SCHEDULE_PERIOD_OPTION_NAME);
     if ($updaterPeriod == 'week') {
         return Date::factory($rescheduledTime)->subWeek(1);
     } else {
         if ($updaterPeriod == 'month') {
             return Date::factory($rescheduledTime)->subMonth(1);
         } else {
             Log::warning("Unknown GeoIP updater period found in database: %s", $updaterPeriod);
             return Date::factory(0);
         }
     }
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:14,代码来源:GeoIPAutoUpdater.php

示例12: start

 /**
  * Start the session
  *
  * @param array|bool $options An array of configuration options; the auto-start (bool) setting is ignored
  * @return void
  */
 public static function start($options = false)
 {
     if (headers_sent() || self::$sessionStarted || defined('PIWIK_ENABLE_SESSION_START') && !PIWIK_ENABLE_SESSION_START) {
         return;
     }
     self::$sessionStarted = true;
     // use cookies to store session id on the client side
     @ini_set('session.use_cookies', '1');
     // prevent attacks involving session ids passed in URLs
     @ini_set('session.use_only_cookies', '1');
     // advise browser that session cookie should only be sent over secure connection
     if (ProxyHttp::isHttps()) {
         @ini_set('session.cookie_secure', '1');
     }
     // advise browser that session cookie should only be accessible through the HTTP protocol (i.e., not JavaScript)
     @ini_set('session.cookie_httponly', '1');
     // don't use the default: PHPSESSID
     @ini_set('session.name', self::SESSION_NAME);
     // proxies may cause the referer check to fail and
     // incorrectly invalidate the session
     @ini_set('session.referer_check', '');
     $currentSaveHandler = ini_get('session.save_handler');
     $config = Config::getInstance();
     if (self::isFileBasedSessions()) {
         // Note: this handler doesn't work well in load-balanced environments and may have a concurrency issue with locked session files
         // for "files", use our own folder to prevent local session file hijacking
         $sessionPath = self::getSessionsDirectory();
         // We always call mkdir since it also chmods the directory which might help when permissions were reverted for some reasons
         Filesystem::mkdir($sessionPath);
         @ini_set('session.save_handler', 'files');
         @ini_set('session.save_path', $sessionPath);
     } else {
         if ($config->General['session_save_handler'] === 'dbtable' || in_array($currentSaveHandler, array('user', 'mm'))) {
             // We consider these to be misconfigurations, in that:
             // - user  - we can't verify that user-defined session handler functions have already been set via session_set_save_handler()
             // - mm    - this handler is not recommended, unsupported, not available for Windows, and has a potential concurrency issue
             $config = array('name' => Common::prefixTable('session'), 'primary' => 'id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime');
             $saveHandler = new DbTable($config);
             if ($saveHandler) {
                 self::setSaveHandler($saveHandler);
             }
         }
     }
     // garbage collection may disabled by default (e.g., Debian)
     if (ini_get('session.gc_probability') == 0) {
         @ini_set('session.gc_probability', 1);
     }
     try {
         parent::start();
         register_shutdown_function(array('Zend_Session', 'writeClose'), true);
     } catch (Exception $e) {
         Log::warning('Unable to start session: ' . $e->getMessage());
         $enableDbSessions = '';
         if (DbHelper::isInstalled()) {
             $enableDbSessions = "<br/>If you still experience issues after trying these changes,\n\t\t\t            \t\t\twe recommend that you <a href='http://piwik.org/faq/how-to-install/#faq_133' target='_blank'>enable database session storage</a>.";
         }
         $pathToSessions = Filechecks::getErrorMessageMissingPermissions(Filesystem::getPathToPiwikRoot() . '/tmp/sessions/');
         $pathToSessions = SettingsPiwik::rewriteTmpPathWithInstanceId($pathToSessions);
         $message = sprintf("Error: %s %s %s\n<pre>Debug: the original error was \n%s</pre>", Piwik::translate('General_ExceptionUnableToStartSession'), $pathToSessions, $enableDbSessions, $e->getMessage());
         Piwik_ExitWithMessage($message, $e->getTraceAsString());
     }
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:68,代码来源:Session.php

示例13: download

 public function download()
 {
     Piwik::checkUserHasSuperUserAccess();
     $this->dieIfPluginsAdminIsDisabled();
     $pluginName = new PluginName();
     $pluginName = $pluginName->getPluginName();
     Nonce::checkNonce($pluginName);
     $filename = $pluginName . '.zip';
     try {
         $pathToPlugin = $this->marketplaceApi->download($pluginName);
         ProxyHttp::serverStaticFile($pathToPlugin, 'application/zip', $expire = 0, $start = false, $end = false, $filename);
     } catch (Exception $e) {
         Common::sendResponseCode(500);
         Log::warning('Could not download file . ' . $e->getMessage());
     }
     if (!empty($pathToPlugin)) {
         Filesystem::deleteFileIfExists($pathToPlugin);
     }
 }
开发者ID:piwik,项目名称:piwik,代码行数:19,代码来源:Controller.php

示例14: sendReport

 public function sendReport($idReport, $period = false, $date = false, $force = false)
 {
     Piwik::checkUserIsNotAnonymous();
     $reports = $this->getReports($idSite = false, false, $idReport);
     $report = reset($reports);
     if ($report['period'] == 'never') {
         $report['period'] = 'day';
     }
     if (!empty($period)) {
         $report['period'] = $period;
     }
     if (empty($date)) {
         $date = Date::now()->subPeriod(1, $report['period'])->toString();
     }
     $language = \Piwik\Plugins\LanguagesManager\API::getInstance()->getLanguageForUser($report['login']);
     // generate report
     list($outputFilename, $prettyDate, $reportSubject, $reportTitle, $additionalFiles) = $this->generateReport($idReport, $date, $language, self::OUTPUT_SAVE_ON_DISK, $report['period']);
     if (!file_exists($outputFilename)) {
         throw new Exception("The report file wasn't found in {$outputFilename}");
     }
     $contents = file_get_contents($outputFilename);
     if (empty($contents)) {
         Log::warning("Scheduled report file '%s' exists but is empty!", $outputFilename);
     }
     /**
      * Triggered when sending scheduled reports.
      *
      * Plugins that provide new scheduled report transport mediums should use this event to
      * send the scheduled report.
      *
      * @param string $reportType A string ID describing how the report is sent, eg,
      *                           `'sms'` or `'email'`.
      * @param array $report An array describing the scheduled report that is being
      *                      generated.
      * @param string $contents The contents of the scheduled report that was generated
      *                         and now should be sent.
      * @param string $filename The path to the file where the scheduled report has
      *                         been saved.
      * @param string $prettyDate A prettified date string for the data within the
      *                           scheduled report.
      * @param string $reportSubject A string describing what's in the scheduled
      *                              report.
      * @param string $reportTitle The scheduled report's given title (given by a Piwik user).
      * @param array $additionalFiles The list of additional files that should be
      *                               sent with this report.
      * @param \Piwik\Period $period The period for which the report has been generated.
      * @param boolean $force A report can only be sent once per period. Setting this to true
      *                       will force to send the report even if it has already been sent.
      */
     Piwik::postEvent(self::SEND_REPORT_EVENT, array($report['type'], $report, $contents, $filename = basename($outputFilename), $prettyDate, $reportSubject, $reportTitle, $additionalFiles, \Piwik\Period\Factory::build($report['period'], $date), $force));
     // Update flag in DB
     $now = Date::now()->getDatetime();
     $this->getModel()->updateReport($report['idreport'], array('ts_last_sent' => $now));
     // If running from piwik.php with debug, do not delete the PDF after sending the email
     if (!isset($GLOBALS['PIWIK_TRACKER_DEBUG']) || !$GLOBALS['PIWIK_TRACKER_DEBUG']) {
         @chmod($outputFilename, 0600);
     }
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:58,代码来源:API.php

示例15: getPiwikPasswordForLdapUser

 /**
  * The password we store for a mapped user isn't used to authenticate, it's just
  * data used to generate a user's token auth.
  */
 private function getPiwikPasswordForLdapUser($ldapUser, $user)
 {
     $ldapPassword = $this->getLdapUserField($ldapUser, $this->ldapUserPasswordField);
     if ($this->isRandomTokenAuthGenerationEnabled || empty($ldapPassword)) {
         if (!empty($user['password'])) {
             // do not generate new passwords for users that are already synchronized
             return $user['password'];
         } else {
             if (!$this->isRandomTokenAuthGenerationEnabled) {
                 Log::warning("UserMapper::%s: Could not find LDAP password for user '%s', generating random one.", __FUNCTION__, @$ldapUser[$this->ldapUserIdField]);
             }
             return $this->generateRandomPassword();
         }
     } else {
         return $this->processPassword($ldapPassword);
     }
 }
开发者ID:polytan02,项目名称:dev_piwik_ynh,代码行数:21,代码来源:UserMapper.php


注:本文中的Piwik\Log::warning方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。