本文整理汇总了PHP中Pimcore\Logger::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::error方法的具体用法?PHP Logger::error怎么用?PHP Logger::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Logger
的用法示例。
在下文中一共展示了Logger::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runCrawler
public static function runCrawler()
{
$running = Configuration::getCoreSetting('running');
if ($running === TRUE) {
return FALSE;
}
$indexDir = \LuceneSearch\Plugin::getFrontendSearchIndex();
if ($indexDir) {
exec('rm -Rf ' . str_replace('/index/', '/tmpindex', $indexDir));
\Pimcore\Logger::debug('LuceneSearch: rm -Rf ' . str_replace('/index/', '/tmpindex', $indexDir));
\Pimcore\Logger::debug('LuceneSearch: Starting crawl');
try {
$urls = Configuration::get('frontend.urls');
$invalidLinkRegexesSystem = Configuration::get('frontend.invalidLinkRegexes');
$invalidLinkRegexesEditable = Configuration::get('frontend.invalidLinkRegexesEditable');
if (!empty($invalidLinkRegexesEditable) and !empty($invalidLinkRegexesSystem)) {
$invalidLinkRegexes = array_merge($invalidLinkRegexesEditable, array($invalidLinkRegexesSystem));
} else {
if (!empty($invalidLinkRegexesEditable)) {
$invalidLinkRegexes = $invalidLinkRegexesEditable;
} else {
if (!empty($invalidLinkRegexesSystem)) {
$invalidLinkRegexes = array($invalidLinkRegexesSystem);
} else {
$invalidLinkRegexes = array();
}
}
}
self::setCrawlerState('frontend', 'started', TRUE);
try {
foreach ($urls as $seed) {
$parser = new Parser();
$parser->setDepth(Configuration::get('frontend.crawler.maxLinkDepth'))->setValidLinkRegexes(Configuration::get('frontend.validLinkRegexes'))->setInvalidLinkRegexes($invalidLinkRegexes)->setSearchStartIndicator(Configuration::get('frontend.crawler.contentStartIndicator'))->setSearchEndIndicator(Configuration::get('frontend.crawler.contentEndIndicator'))->setSearchExcludeStartIndicator(Configuration::get('frontend.crawler.contentExcludeStartIndicator'))->setSearchExcludeEndIndicator(Configuration::get('frontend.crawler.contentExcludeEndIndicator'))->setAllowSubdomain(FALSE)->setAllowedSchemes(Configuration::get('frontend.allowedSchemes'))->setDownloadLimit(Configuration::get('frontend.crawler.maxDownloadLimit'))->setSeed($seed);
if (Configuration::get('frontend.auth.useAuth') === TRUE) {
$parser->setAuth(Configuration::get('frontend.auth.username'), Configuration::get('frontend.auth.password'));
}
$parser->startParser();
$parser->optimizeIndex();
}
} catch (\Exception $e) {
}
self::setCrawlerState('frontend', 'finished', FALSE);
//only remove index, if tmp exists!
$tmpIndex = str_replace('/index', '/tmpindex', $indexDir);
if (is_dir($tmpIndex)) {
exec('rm -Rf ' . $indexDir);
\Pimcore\Logger::debug('LuceneSearch: rm -Rf ' . $indexDir);
exec('cp -R ' . substr($tmpIndex, 0, -1) . ' ' . substr($indexDir, 0, -1));
\Pimcore\Logger::debug('LuceneSearch: cp -R ' . substr($tmpIndex, 0, -1) . ' ' . substr($indexDir, 0, -1));
\Pimcore\Logger::debug('LuceneSearch: replaced old index');
\Pimcore\Logger::info('LuceneSearch: Finished crawl');
} else {
\Pimcore\Logger::error('LuceneSearch: skipped index replacing. no tmp index found.');
}
} catch (\Exception $e) {
\Pimcore\Logger::error($e);
throw $e;
}
}
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
// display error message
if (!$input->getOption("mode")) {
$this->writeError("Please specify the mode!");
exit;
}
$db = \Pimcore\Db::get();
if ($input->getOption("mode") == "optimize") {
$tables = $db->fetchAll("SHOW TABLES");
foreach ($tables as $table) {
$t = current($table);
try {
Logger::debug("Running: OPTIMIZE TABLE " . $t);
$db->query("OPTIMIZE TABLE " . $t);
} catch (\Exception $e) {
Logger::error($e);
}
}
} elseif ($input->getOption("mode") == "warmup") {
$tables = $db->fetchAll("SHOW TABLES");
foreach ($tables as $table) {
$t = current($table);
try {
Logger::debug("Running: SELECT COUNT(*) FROM {$t}");
$res = $db->fetchOne("SELECT COUNT(*) FROM {$t}");
Logger::debug("Result: " . $res);
} catch (\Exception $e) {
Logger::error($e);
}
}
}
}
示例3: reverseMap
/**
* @param $object
* @param bool $disableMappingExceptions
* @param null $idMapper
* @throws \Exception
*/
public function reverseMap($object, $disableMappingExceptions = false, $idMapper = null)
{
$keys = get_object_vars($this);
foreach ($keys as $key => $value) {
$method = "set" . $key;
if (method_exists($object, $method)) {
$object->{$method}($value);
}
}
//must be after generic setters above!!
parent::reverseMap($object, $disableMappingExceptions, $idMapper);
if (is_array($this->elements)) {
foreach ($this->elements as $element) {
$class = $object->getClass();
$setter = "set" . ucfirst($element->name);
if (method_exists($object, $setter)) {
$tag = $class->getFieldDefinition($element->name);
if ($tag) {
if ($class instanceof Model\Object\ClassDefinition\Data\Fieldcollections) {
$object->{$setter}($tag->getFromWebserviceImport($element->fieldcollection, $object, [], $idMapper));
} else {
$object->{$setter}($tag->getFromWebserviceImport($element->value, $object, [], $idMapper));
}
} else {
Logger::error("tag for field " . $element->name . " not found");
}
} else {
if (!$disableMappingExceptions) {
throw new \Exception("No element [ " . $element->name . " ] of type [ " . $element->type . " ] found in class definition [" . $class->getId() . "] | " . $class->getName());
}
}
}
}
}
示例4: save
/**
*
*/
public function save()
{
try {
$data = ["id" => $this->model->getId()->getId(), "fullpath" => $this->model->getFullPath(), "maintype" => $this->model->getId()->getType(), "type" => $this->model->getType(), "subtype" => $this->model->getSubtype(), "published" => $this->model->isPublished(), "creationdate" => $this->model->getCreationDate(), "modificationdate" => $this->model->getmodificationDate(), "userowner" => $this->model->getUserOwner(), "usermodification" => $this->model->getUserModification(), "data" => $this->model->getData(), "properties" => $this->model->getProperties()];
$this->db->insertOrUpdate("search_backend_data", $data);
} catch (\Exception $e) {
Logger::error($e);
}
}
示例5: getByName
/**
* @param string $name
* @return WebsiteSetting
*/
public static function getByName($name, $siteId = null)
{
// create a tmp object to obtain the id
$setting = new self();
try {
$setting->getDao()->getByName($name, $siteId);
} catch (\Exception $e) {
Logger::error($e);
return null;
}
return $setting;
}
示例6: save
/**
* Save object to database
*
* @return void
*/
public function save()
{
$version = get_object_vars($this->model);
foreach ($version as $key => $value) {
if (in_array($key, $this->getValidTableColumns("recyclebin"))) {
$data[$key] = $value;
}
}
try {
$this->db->insert("recyclebin", $data);
$this->model->setId($this->db->lastInsertId());
} catch (\Exception $e) {
Logger::error($e);
}
return true;
}
示例7: writeLog
/**
*
*/
public function writeLog()
{
$code = (string) $this->getResponse()->getHttpResponseCode();
$db = \Pimcore\Db::get();
try {
$uri = $this->getRequest()->getScheme() . "://" . $this->getRequest()->getHttpHost() . $this->getRequest()->getRequestUri();
$exists = $db->fetchOne("SELECT date FROM http_error_log WHERE uri = ?", $uri);
if ($exists) {
$db->query("UPDATE http_error_log SET `count` = `count` + 1, date = ? WHERE uri = ?", [time(), $uri]);
} else {
$db->insert("http_error_log", ["uri" => $uri, "code" => (int) $code, "parametersGet" => serialize($_GET), "parametersPost" => serialize($_POST), "cookies" => serialize($_COOKIE), "serverVars" => serialize($_SERVER), "date" => time(), "count" => 1]);
}
} catch (\Exception $e) {
Logger::error("Unable to log http error");
Logger::error($e);
}
}
示例8: buildPdf
protected function buildPdf(Document\PrintAbstract $document, $config)
{
$web2PrintConfig = Config::getWeb2PrintConfig();
$params = [];
$params['printermarks'] = $config->printermarks == "true";
$params['screenResolutionImages'] = $config->screenResolutionImages == "true";
$this->updateStatus($document->getId(), 10, "start_html_rendering");
$html = $document->renderDocument($params);
$this->updateStatus($document->getId(), 40, "finished_html_rendering");
$filePath = PIMCORE_TEMPORARY_DIRECTORY . "/pdf-reactor-input-" . $document->getId() . ".html";
file_put_contents($filePath, $html);
$html = null;
$this->updateStatus($document->getId(), 45, "saved_html_file");
ini_set("default_socket_timeout", 3000);
ini_set('max_input_time', -1);
include_once 'Pimcore/Web2Print/Processor/api/v' . $web2PrintConfig->get('pdfreactorVersion', '8.0') . '/PDFreactor.class.php';
$port = (string) $web2PrintConfig->pdfreactorServerPort ? (string) $web2PrintConfig->pdfreactorServerPort : "9423";
$pdfreactor = new \PDFreactor("http://" . $web2PrintConfig->pdfreactorServer . ":" . $port . "/service/rest");
$filePath = str_replace(PIMCORE_DOCUMENT_ROOT, "", $filePath);
$reactorConfig = ["document" => (string) $web2PrintConfig->pdfreactorBaseUrl . $filePath, "baseURL" => (string) $web2PrintConfig->pdfreactorBaseUrl, "author" => $config->author ? $config->author : "", "title" => $config->title ? $config->title : "", "addLinks" => $config->links == "true", "addBookmarks" => $config->bookmarks == "true", "javaScriptMode" => $config->javaScriptMode, "viewerPreferences" => [$config->viewerPreference], "defaultColorSpace" => $config->colorspace, "encryption" => $config->encryption, "addTags" => $config->tags == "true", "logLevel" => $config->loglevel];
if (trim($web2PrintConfig->pdfreactorLicence)) {
$reactorConfig["licenseKey"] = trim($web2PrintConfig->pdfreactorLicence);
}
try {
$progress = new \stdClass();
$progress->finished = false;
$processId = $pdfreactor->convertAsync($reactorConfig);
while (!$progress->finished) {
$progress = $pdfreactor->getProgress($processId);
$this->updateStatus($document->getId(), 50 + $progress->progress / 2, "pdf_conversion");
Logger::info("PDF converting progress: " . $progress->progress . "%");
sleep(2);
}
$this->updateStatus($document->getId(), 100, "saving_pdf_document");
$result = $pdfreactor->getDocument($processId);
$pdf = base64_decode($result->document);
} catch (\Exception $e) {
Logger::error($e);
$document->setLastGenerateMessage($e->getMessage());
throw new \Exception("Error during REST-Request:" . $e->getMessage());
}
$document->setLastGenerateMessage("");
return $pdf;
}
示例9: move
/**
* Moves a file/directory
*
* @param string $sourcePath
* @param string $destinationPath
* @return void
*/
public function move($sourcePath, $destinationPath)
{
$nameParts = explode("/", $sourcePath);
$nameParts[count($nameParts) - 1] = Element\Service::getValidKey($nameParts[count($nameParts) - 1], "asset");
$sourcePath = implode("/", $nameParts);
$nameParts = explode("/", $destinationPath);
$nameParts[count($nameParts) - 1] = Element\Service::getValidKey($nameParts[count($nameParts) - 1], "asset");
$destinationPath = implode("/", $nameParts);
try {
if (dirname($sourcePath) == dirname($destinationPath)) {
$asset = null;
if ($asset = Asset::getByPath("/" . $destinationPath)) {
// If we got here, this means the destination exists, and needs to be overwritten
$sourceAsset = Asset::getByPath("/" . $sourcePath);
$asset->setData($sourceAsset->getData());
$sourceAsset->delete();
}
// see: Asset\WebDAV\File::delete() why this is necessary
$log = Asset\WebDAV\Service::getDeleteLog();
if (!$asset && array_key_exists("/" . $destinationPath, $log)) {
$asset = \Pimcore\Tool\Serialize::unserialize($log["/" . $destinationPath]["data"]);
if ($asset) {
$sourceAsset = Asset::getByPath("/" . $sourcePath);
$asset->setData($sourceAsset->getData());
$sourceAsset->delete();
}
}
if (!$asset) {
$asset = Asset::getByPath("/" . $sourcePath);
}
$asset->setFilename(basename($destinationPath));
} else {
$asset = Asset::getByPath("/" . $sourcePath);
$parent = Asset::getByPath("/" . dirname($destinationPath));
$asset->setPath($parent->getRealFullPath() . "/");
$asset->setParentId($parent->getId());
}
$user = \Pimcore\Tool\Admin::getCurrentUser();
$asset->setUserModification($user->getId());
$asset->save();
} catch (\Exception $e) {
Logger::error($e);
}
}
示例10: authenticateHttpBasic
/**
* @static
* @throws \Exception
* @return User
*/
public static function authenticateHttpBasic()
{
// we're using Sabre\HTTP for basic auth
$request = \Sabre\HTTP\Sapi::getRequest();
$response = new \Sabre\HTTP\Response();
$auth = new \Sabre\HTTP\Auth\Basic(Tool::getHostname(), $request, $response);
$result = $auth->getCredentials();
if (is_array($result)) {
list($username, $password) = $result;
$user = self::authenticatePlaintext($username, $password);
if ($user) {
return $user;
}
}
$auth->requireLogin();
$response->setBody("Authentication required");
Logger::error("Authentication Basic (WebDAV) required");
\Sabre\HTTP\Sapi::sendResponse($response);
die;
}
示例11: getById
/**
* @param integer $id
* @return Configuration
*/
public static function getById($id)
{
$cacheKey = 'lucenesearch_configuration_' . $id;
try {
$configurationEntry = \Zend_Registry::get($cacheKey);
if (!$configurationEntry) {
throw new \Exception('Configuration in registry is null');
}
} catch (\Exception $e) {
try {
$configurationEntry = new self();
\Zend_Registry::set($cacheKey, $configurationEntry);
$configurationEntry->setId(intval($id));
$configurationEntry->getDao()->getById();
} catch (\Exception $e) {
\Pimcore\Logger::error($e);
return NULL;
}
}
return $configurationEntry;
}
示例12: paymentAction
public function paymentAction()
{
$gateway = $this->getModule()->getGateway();
if (!$gateway->supportsPurchase()) {
\Pimcore\Logger::error("OmniPay Gateway payment [" . $this->getModule()->getName() . "] does not support purchase");
throw new \CoreShop\Exception("Gateway doesn't support purchase!");
}
$params = $this->getGatewayParams();
$response = $gateway->purchase($params)->send();
if ($response instanceof \Omnipay\Common\Message\ResponseInterface) {
if ($response->getTransactionReference()) {
$this->cart->setCustomIdentifier($response->getTransactionReference());
} else {
$this->cart->setCustomIdentifier($params['transactionId']);
}
$this->cart->save();
try {
if ($response->isSuccessful()) {
\Pimcore\Logger::notice("OmniPay Gateway payment [" . $this->getModule()->getName() . "]: Gateway successfully responded redirect!");
$this->redirect($params['returnUrl']);
} else {
if ($response->isRedirect()) {
if ($response instanceof \Omnipay\Common\Message\RedirectResponseInterface) {
\Pimcore\Logger::notice("OmniPay Gateway payment [" . $this->getModule()->getName() . "]: response is a redirect. RedirectMethod: " . $response->getRedirectMethod());
if ($response->getRedirectMethod() === "GET") {
$this->redirect($response->getRedirectUrl());
} else {
$this->view->response = $response;
$this->_helper->viewRenderer('payment/post', null, true);
}
}
} else {
throw new \CoreShop\Exception($response->getMessage());
}
}
} catch (\Exception $e) {
\Pimcore\Logger::error("OmniPay Gateway payment [" . $this->getModule()->getName() . "] Error: " . $e->getMessage());
}
}
}
示例13: update
/**
* @return void
*/
protected function update()
{
// only do this if the file exists and contains data
if ($this->getDataChanged() || !$this->getCustomSetting("imageDimensionsCalculated")) {
try {
// save the current data into a tmp file to calculate the dimensions, otherwise updates wouldn't be updated
// because the file is written in parent::update();
$tmpFile = $this->getTemporaryFile();
$dimensions = $this->getDimensions($tmpFile, true);
unlink($tmpFile);
if ($dimensions && $dimensions["width"]) {
$this->setCustomSetting("imageWidth", $dimensions["width"]);
$this->setCustomSetting("imageHeight", $dimensions["height"]);
}
} catch (\Exception $e) {
Logger::error("Problem getting the dimensions of the image with ID " . $this->getId());
}
// this is to be downward compatible so that the controller can check if the dimensions are already calculated
// and also to just do the calculation once, because the calculation can fail, an then the controller tries to
// calculate the dimensions on every request an also will create a version, ...
$this->setCustomSetting("imageDimensionsCalculated", true);
}
parent::update();
$this->clearThumbnails();
// now directly create "system" thumbnails (eg. for the tree, ...)
if ($this->getDataChanged()) {
try {
$path = $this->getThumbnail(Image\Thumbnail\Config::getPreviewConfig())->getFileSystemPath();
// set the modification time of the thumbnail to the same time from the asset
// so that the thumbnail check doesn't fail in Asset\Image\Thumbnail\Processor::process();
// we need the @ in front of touch because of some stream wrapper (eg. s3) which don't support touch()
@touch($path, $this->getModificationDate());
} catch (\Exception $e) {
Logger::error("Problem while creating system-thumbnails for image " . $this->getRealFullPath());
Logger::error($e);
}
}
}
示例14: routeStartup
/**
* @param \Zend_Controller_Request_Abstract $request
*/
public function routeStartup(\Zend_Controller_Request_Abstract $request)
{
if (preg_match("@^/qr~-~code/([a-zA-Z0-9_\\-]+)@", $request->getPathInfo(), $matches)) {
if (array_key_exists(1, $matches) && !empty($matches[1])) {
$code = Tool\Qrcode\Config::getByName($matches[1]);
if ($code) {
$url = $code->getUrl();
if ($code->getGoogleAnalytics()) {
$glue = "?";
if (strpos($url, "?")) {
$glue = "&";
}
$url .= $glue;
$url .= "utm_source=Mobile&utm_medium=QR-Code&utm_campaign=" . $code->getName();
}
header("Location: " . $url, true, 302);
exit;
} else {
Logger::error("called an QR code but '" . $matches[1] . " is not a code in the system.");
}
}
}
}
示例15: getWorkflowManagementConfig
/**
* @param bool $forceReload
* @return array|null
*/
public static function getWorkflowManagementConfig($forceReload = false)
{
$config = null;
if (\Zend_Registry::isRegistered("pimcore_config_workflowmanagement") && !$forceReload) {
$config = \Zend_Registry::get("pimcore_config_workflowmanagement");
} else {
try {
$file = \Pimcore\Config::locateConfigFile("workflowmanagement.php");
if (is_file($file)) {
$config = (include $file);
if (is_array($config)) {
self::setWorkflowManagementConfig($config);
} else {
Logger::error("{$file} exists but it is not a valid PHP array configuration.");
}
}
} catch (\Exception $e) {
$file = \Pimcore\Config::locateConfigFile("workflowmanagement.php");
Logger::emergency("Cannot find workflow configuration, should be located at: " . $file);
}
}
return $config;
}