本文整理汇总了PHP中Pimcore\Logger::crit方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::crit方法的具体用法?PHP Logger::crit怎么用?PHP Logger::crit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Logger
的用法示例。
在下文中一共展示了Logger::crit方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
/**
* @param null $adapter
* @return null|Adapter\GD|Adapter\Imagick
* @throws \Exception
*/
public static function getInstance($adapter = null)
{
// use the default adapter if set manually (!= null) and no specify adapter is given
if (!$adapter && self::$defaultAdapter) {
$adapter = self::$defaultAdapter;
}
try {
if ($adapter) {
$adapterClass = "\\Pimcore\\Image\\Adapter\\" . $adapter;
if (Tool::classExists($adapterClass)) {
return new $adapterClass();
} else {
if (Tool::classExists($adapter)) {
return new $adapter();
} else {
throw new \Exception("Image-transform adapter `" . $adapter . "´ does not exist.");
}
}
} else {
if (extension_loaded("imagick")) {
return new Adapter\Imagick();
} else {
return new Adapter\GD();
}
}
} catch (\Exception $e) {
\Logger::crit("Unable to load image extensions: " . $e->getMessage());
throw $e;
}
return null;
}
示例2: create
/**
* @return null|Adapter\GD|Adapter\Imagick
* @throws \Exception
*/
public static function create()
{
try {
if (extension_loaded("imagick")) {
return new Adapter\Imagick();
} else {
return new Adapter\GD();
}
} catch (\Exception $e) {
Logger::crit("Unable to load image extensions: " . $e->getMessage());
throw $e;
}
}
示例3: getInstance
/**
* @param null $adapter
* @return bool|null|Document
* @throws \Exception
*/
public static function getInstance($adapter = null)
{
try {
if ($adapter) {
$adapterClass = "\\Pimcore\\Document\\Adapter\\" . $adapter;
if (Tool::classExists($adapterClass)) {
return new $adapterClass();
} else {
throw new \Exception("document-transcode adapter `" . $adapter . "´ does not exist.");
}
} else {
if ($adapter = self::getDefaultAdapter()) {
return $adapter;
}
}
} catch (\Exception $e) {
\Logger::crit("Unable to load document adapter: " . $e->getMessage());
throw $e;
}
return null;
}
示例4: setDataFromElement
//.........这里部分代码省略.........
$this->subtype = $this->type;
}
$this->properties = "";
$properties = $element->getProperties();
if (is_array($properties)) {
foreach ($properties as $nextProperty) {
$pData = (string) $nextProperty->getData();
if ($nextProperty->getName() == "bool") {
$pData = $pData ? "true" : "false";
}
$this->properties .= $nextProperty->getName() . ":" . $pData . " ";
}
}
$this->data = "";
if ($element instanceof Document) {
if ($element instanceof Document\Folder) {
$this->data = $element->getKey();
$this->published = true;
} elseif ($element instanceof Document\Link) {
$this->published = $element->isPublished();
$this->data = $element->getTitle() . " " . $element->getHref();
} elseif ($element instanceof Document\PageSnippet) {
$this->published = $element->isPublished();
$elements = $element->getElements();
if (is_array($elements) && !empty($elements)) {
foreach ($elements as $tag) {
if ($tag instanceof Document\Tag\TagInterface) {
ob_start();
$this->data .= strip_tags($tag->frontend()) . " ";
$this->data .= ob_get_clean();
}
}
}
if ($element instanceof Document\Page) {
$this->published = $element->isPublished();
$this->data .= " " . $element->getTitle() . " " . $element->getDescription() . " " . $element->getPrettyUrl();
}
}
} elseif ($element instanceof Asset) {
$this->data = $element->getFilename();
$elementMetadata = $element->getMetadata();
if (is_array($elementMetadata)) {
foreach ($elementMetadata as $md) {
if (is_scalar($md['data'])) {
$this->data .= " " . $md["name"] . ":" . $md["data"];
}
}
}
if ($element instanceof Asset\Document && \Pimcore\Document::isAvailable()) {
if (\Pimcore\Document::isFileTypeSupported($element->getFilename())) {
try {
$contentText = $element->getText();
$contentText = Encoding::toUTF8($contentText);
$contentText = str_replace(["\r\n", "\r", "\n", "\t", "\f"], " ", $contentText);
$contentText = preg_replace("/[ ]+/", " ", $contentText);
$this->data .= " " . $contentText;
} catch (\Exception $e) {
Logger::error($e);
}
}
} elseif ($element instanceof Asset\Text) {
try {
$contentText = $element->getData();
$contentText = Encoding::toUTF8($contentText);
$this->data .= " " . $contentText;
} catch (\Exception $e) {
Logger::error($e);
}
} elseif ($element instanceof Asset\Image) {
try {
$metaData = array_merge($element->getEXIFData(), $element->getIPTCData());
foreach ($metaData as $key => $value) {
$this->data .= " " . $key . " : " . $value;
}
} catch (\Exception $e) {
Logger::error($e);
}
}
$this->published = true;
} elseif ($element instanceof Object\AbstractObject) {
if ($element instanceof Object\Concrete) {
$getInheritedValues = Object\AbstractObject::doGetInheritedValues();
Object\AbstractObject::setGetInheritedValues(true);
$this->published = $element->isPublished();
foreach ($element->getClass()->getFieldDefinitions() as $key => $value) {
$this->data .= $value->getDataForSearchIndex($element) . " ";
}
Object\AbstractObject::setGetInheritedValues($getInheritedValues);
} elseif ($element instanceof Object\Folder) {
$this->data = $element->getKey();
$this->published = true;
}
} else {
Logger::crit("Search\\Backend\\Data received an unknown element!");
}
if ($element instanceof Element\ElementInterface) {
$this->data = "ID: " . $element->getId() . " \nPath: " . $this->getFullPath() . " \n" . $this->cleanupData($this->data);
}
return $this;
}
示例5: protect
protected function protect()
{
$user = $this->getParam("username");
$data = $this->readLogFile();
$matchesIpOnly = 0;
$matchesUserOnly = 0;
$matchesUserIp = 0;
foreach ($data as $login) {
$matchIp = false;
$matchUser = false;
if ($login[0] > time() - 300) {
if ($user && $login[2] == $user) {
$matchesUserOnly++;
$matchUser = true;
}
if ($login[1] == Tool::getAnonymizedClientIp()) {
$matchesIpOnly++;
$matchIp = true;
}
if ($matchIp && $matchUser) {
$matchesUserIp++;
}
}
}
if ($matchesIpOnly > 49 || $matchesUserOnly > 9 || $matchesUserIp > 4) {
$m = "Security Alert: Too many login attempts , please wait 5 minutes and try again.";
Logger::crit($m);
die($m);
}
}
示例6: clearDependentCache
/**
* @param array $additionalTags
*/
public function clearDependentCache($additionalTags = [])
{
try {
$tags = ["object_" . $this->getId(), "object_properties", "output"];
$tags = array_merge($tags, $additionalTags);
Cache::clearTags($tags);
} catch (\Exception $e) {
Logger::crit($e);
}
}
示例7: clearDependentCache
/**
* @return void
*/
public function clearDependentCache()
{
// this is mostly called in Redirect\Dao not here
try {
\Pimcore\Cache::clearTag("redirect");
} catch (\Exception $e) {
Logger::crit($e);
}
}
示例8: init
/**
*
*/
public static function init()
{
if (!self::$instance instanceof \Zend_Cache_Core) {
// check for custom cache configuration
$customCacheFile = PIMCORE_CONFIGURATION_DIRECTORY . "/cache.xml";
if (is_file($customCacheFile)) {
$config = self::getDefaultConfig();
try {
$conf = new \Zend_Config_Xml($customCacheFile);
if ($conf->frontend) {
$config["frontendType"] = (string) $conf->frontend->type;
$config["customFrontendNaming"] = (bool) $conf->frontend->custom;
if ($conf->frontend->options && method_exists($conf->frontend->options, "toArray")) {
$config["frontendConfig"] = $conf->frontend->options->toArray();
}
}
if ($conf->backend) {
$config["backendType"] = (string) $conf->backend->type;
$config["customBackendNaming"] = (bool) $conf->backend->custom;
if ($conf->backend->options && method_exists($conf->backend->options, "toArray")) {
$config["backendConfig"] = $conf->backend->options->toArray();
}
}
if (isset($config["frontendConfig"]["lifetime"])) {
self::$defaultLifetime = $config["frontendConfig"]["lifetime"];
}
$config = self::normalizeConfig($config);
// here you can use the cache backend you like
try {
self::$instance = self::initializeCache($config);
} catch (\Exception $e) {
\Logger::crit("can't initialize cache with the given configuration " . $e->getMessage());
}
} catch (\Exception $e) {
\Logger::crit($e);
\Logger::crit("Error while reading cache configuration, using the default file backend");
}
}
}
// return default cache if cache cannot be initialized
if (!self::$instance instanceof \Zend_Cache_Core) {
self::$instance = self::getDefaultCache();
}
self::$instance->setLifetime(self::$defaultLifetime);
self::$instance->setOption("automatic_serialization", true);
self::$instance->setOption("automatic_cleaning_factor", 0);
// init the write lock once (from other processes etc.)
if (self::$writeLockTimestamp === null) {
self::$writeLockTimestamp = 0;
// set the write lock to 0, otherwise infinite loop (self::hasWriteLock() calls self::getInstance())
self::hasWriteLock();
}
self::setZendFrameworkCaches(self::$instance);
}
示例9: init
/**
*
*/
public static function init()
{
if (!self::$instance instanceof \Zend_Cache_Core) {
// check for custom cache configuration
$customConfigFile = \Pimcore\Config::locateConfigFile("cache.php");
if (is_file($customConfigFile)) {
$config = self::getDefaultConfig();
$conf = (include $customConfigFile);
if (is_array($conf)) {
if (isset($conf["frontend"])) {
$config["frontendType"] = $conf["frontend"]["type"];
$config["customFrontendNaming"] = $conf["frontend"]["custom"];
if (isset($conf["frontend"]["options"])) {
$config["frontendConfig"] = $conf["frontend"]["options"];
}
}
if (isset($conf["backend"])) {
$config["backendType"] = $conf["backend"]["type"];
$config["customBackendNaming"] = $conf["backend"]["custom"];
if (isset($conf["backend"]["options"])) {
$config["backendConfig"] = $conf["backend"]["options"];
}
}
if (isset($config["frontendConfig"]["lifetime"])) {
self::$defaultLifetime = $config["frontendConfig"]["lifetime"];
}
$config = self::normalizeConfig($config);
// here you can use the cache backend you like
try {
self::$instance = self::initializeCache($config);
} catch (\Exception $e) {
Logger::crit("can't initialize cache with the given configuration " . $e->getMessage());
}
} else {
Logger::crit("Error while reading cache configuration, using the default database backend");
}
}
}
// return default cache if cache cannot be initialized
if (!self::$instance instanceof \Zend_Cache_Core) {
self::$instance = self::getDefaultCache();
}
self::$instance->setLifetime(self::$defaultLifetime);
self::$instance->setOption("automatic_serialization", true);
self::$instance->setOption("automatic_cleaning_factor", 0);
// init the write lock once (from other processes etc.)
if (self::$writeLockTimestamp === null) {
self::$writeLockTimestamp = 0;
// set the write lock to 0, otherwise infinite loop (self::hasWriteLock() calls self::getInstance())
self::hasWriteLock();
}
self::setZendFrameworkCaches(self::$instance);
}
示例10: install
/**
* install function
* @return string $message statusmessage to display in frontend
*/
public static function install()
{
try {
$install = new Install();
$install->installConfigFile();
$install->installProperties();
$install->createDirectories();
$install->createRedirect();
} catch (\Exception $e) {
\Pimcore\Logger::crit($e);
return self::getTranslate()->_('lucenesearch_install_failed');
}
if (Configuration::get('frontend.enabled')) {
self::forceCrawlerStartOnNextMaintenance('frontend');
}
return self::getTranslate()->_('lucenesearch_install_successfully');
}