critical() публичный статический Метод

Log a critical message.
public static critical ( $string )
Пример #1
0
 /**
  * Logs with an arbitrary level.
  *
  * @param mixed $level
  * @param string $message
  * @param array $context
  * @return null
  */
 public function log($level, $message, array $context = array())
 {
     switch ($level) {
         case \SimpleSAML\Logger::ALERT:
             \SimpleSAML\Logger::alert($message);
             break;
         case \SimpleSAML\Logger::CRIT:
             \SimpleSAML\Logger::critical($message);
             break;
         case \SimpleSAML\Logger::DEBUG:
             \SimpleSAML\Logger::debug($message);
             break;
         case \SimpleSAML\Logger::EMERG:
             \SimpleSAML\Logger::emergency($message);
             break;
         case \SimpleSAML\Logger::ERR:
             \SimpleSAML\Logger::error($message);
             break;
         case \SimpleSAML\Logger::INFO:
             \SimpleSAML\Logger::info($message);
             break;
         case \SimpleSAML\Logger::NOTICE:
             \SimpleSAML\Logger::notice($message);
             break;
         case \SimpleSAML\Logger::WARNING:
             \SimpleSAML\Logger::warning($message);
     }
 }
Пример #2
0
 public function getLangPath($domain = self::DEFAULT_DOMAIN)
 {
     $langcode = explode('_', $this->langcode);
     $langcode = $langcode[0];
     $localeDir = $this->localeDomainMap[$domain];
     $langPath = $localeDir . '/' . $langcode . '/LC_MESSAGES/';
     \SimpleSAML\Logger::debug("Trying langpath for '{$langcode}' as '{$langPath}'");
     if (is_dir($langPath) && is_readable($langPath)) {
         return $langPath;
     }
     // Language not found, fall back to default
     $defLangcode = $this->language->getDefaultLanguage();
     $langPath = $localeDir . '/' . $defLangcode . '/LC_MESSAGES/';
     if (is_dir($langPath) && is_readable($langPath)) {
         // Report that the localization for the preferred language is missing
         $error = "Localization not found for langcode '{$langcode}' at '{$langPath}', falling back to langcode '" . $defLangcode . "'";
         \SimpleSAML\Logger::error($_SERVER['PHP_SELF'] . ' - ' . $error);
         return $langPath;
     }
     // Locale for default language missing even, error out
     $error = "Localization directory missing/broken for langcode '{$langcode}' and domain '{$domain}'";
     \SimpleSAML\Logger::critical($_SERVER['PHP_SELF'] . ' - ' . $error);
     throw new \Exception($error);
 }
Пример #3
0
 /**
  * Find template path.
  *
  * This function locates the given template based on the template name. It will first search for the template in
  * the current theme directory, and then the default theme.
  *
  * The template name may be on the form <module name>:<template path>, in which case it will search for the
  * template file in the given module.
  *
  * @param string $template The relative path from the theme directory to the template file.
  *
  * @return string The absolute path to the template file.
  *
  * @throws Exception If the template file couldn't be found.
  */
 private function findTemplatePath($template, $throw_exception = true)
 {
     assert('is_string($template)');
     $result = $this->findModuleAndTemplateName($template);
     $templateModule = $result[0] ? $result[0] : 'default';
     $templateName = $result[1];
     $tmp = explode(':', $this->configuration->getString('theme.use', 'default'), 2);
     if (count($tmp) === 2) {
         $themeModule = $tmp[0];
         $themeName = $tmp[1];
     } else {
         $themeModule = null;
         $themeName = $tmp[0];
     }
     // first check the current theme
     if ($themeModule !== null) {
         // .../module/<themeModule>/themes/<themeName>/<templateModule>/<templateName>
         $filename = \SimpleSAML\Module::getModuleDir($themeModule) . '/themes/' . $themeName . '/' . $templateModule . '/' . $templateName;
     } elseif ($templateModule !== 'default') {
         // .../module/<templateModule>/templates/<templateName>
         $filename = \SimpleSAML\Module::getModuleDir($templateModule) . '/templates/' . $templateName;
     } else {
         // .../templates/<theme>/<templateName>
         $filename = $this->configuration->getPathValue('templatedir', 'templates/') . $templateName;
     }
     if (file_exists($filename)) {
         return $filename;
     }
     // not found in current theme
     \SimpleSAML\Logger::debug($_SERVER['PHP_SELF'] . ' - Template: Could not find template file [' . $template . '] at [' . $filename . '] - now trying the base template');
     // try default theme
     if ($templateModule !== 'default') {
         // .../module/<templateModule>/templates/<templateName>
         $filename = \SimpleSAML\Module::getModuleDir($templateModule) . '/templates/' . $templateName;
     } else {
         // .../templates/<templateName>
         $filename = $this->configuration->getPathValue('templatedir', 'templates/') . '/' . $templateName;
     }
     if (file_exists($filename)) {
         return $filename;
     }
     // not found in default template
     if ($throw_exception) {
         // log error and throw exception
         $error = 'Template: Could not find template file [' . $template . '] at [' . $filename . ']';
         \SimpleSAML\Logger::critical($_SERVER['PHP_SELF'] . ' - ' . $error);
         throw new Exception($error);
     } else {
         // missing template expected, return NULL
         return null;
     }
 }