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


PHP Logger::warning方法代码示例

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


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

示例1: tag

 /**
  * @param $type
  * @param $realName
  * @param array $options
  * @return Model\Document\Tag
  */
 public function tag($type, $realName, $options = array())
 {
     $type = strtolower($type);
     $document = $this->document;
     $name = Model\Document\Tag::buildTagName($type, $realName, $document);
     try {
         if ($document instanceof Model\Document\PageSnippet) {
             $tag = $document->getElement($name);
             if ($tag instanceof Model\Document\Tag && $tag->getType() == $type) {
                 // call the load() method if it exists to reinitialize the data (eg. from serializing, ...)
                 if (method_exists($tag, "load")) {
                     $tag->load();
                 }
                 // set view & controller, editmode
                 $tag->setController($this->controller);
                 $tag->setView($this);
                 $tag->setEditmode($this->editmode);
                 $tag->setOptions($options);
             } else {
                 $tag = Model\Document\Tag::factory($type, $name, $document->getId(), $options, $this->controller, $this, $this->editmode);
                 $document->setElement($name, $tag);
             }
             // set the real name of this editable, without the prefixes and suffixes from blocks and areablocks
             $tag->setRealName($realName);
         }
         return $tag;
     } catch (\Exception $e) {
         \Logger::warning($e);
     }
 }
开发者ID:jjpeters67,项目名称:pimcore,代码行数:36,代码来源:View.php

示例2: addPropertiesToDocument

 /**
  * @param Model\Document $document
  * @throws \Zend_Json_Exception
  */
 protected function addPropertiesToDocument(Model\Document $document)
 {
     // properties
     if ($this->getParam("properties")) {
         $properties = [];
         // assign inherited properties
         foreach ($document->getProperties() as $p) {
             if ($p->isInherited()) {
                 $properties[$p->getName()] = $p;
             }
         }
         $propertiesData = \Zend_Json::decode($this->getParam("properties"));
         if (is_array($propertiesData)) {
             foreach ($propertiesData as $propertyName => $propertyData) {
                 $value = $propertyData["data"];
                 try {
                     $property = new Property();
                     $property->setType($propertyData["type"]);
                     $property->setName($propertyName);
                     $property->setCtype("document");
                     $property->setDataFromEditmode($value);
                     $property->setInheritable($propertyData["inheritable"]);
                     $properties[$propertyName] = $property;
                 } catch (\Exception $e) {
                     Logger::warning("Can't add " . $propertyName . " to document " . $document->getRealFullPath());
                 }
             }
         }
         if ($document->isAllowed("properties")) {
             $document->setProperties($properties);
         }
     }
     // force loading of properties
     $document->getProperties();
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:39,代码来源:Document.php

示例3: getByName

 /**
  * @param $name
  */
 public static function getByName($name)
 {
     try {
         $config = new self();
         $config->setName($name);
         $config->getDao()->getByName();
         return $config;
     } catch (\Exception $e) {
         Logger::warning($e);
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:14,代码来源:TranslatorConfig.php

示例4: isAvailable

 /**
  * @return bool
  */
 public function isAvailable()
 {
     try {
         $ghostscript = self::getGhostscriptCli();
         $phpCli = Console::getPhpCli();
         if ($ghostscript && $phpCli) {
             return true;
         }
     } catch (\Exception $e) {
         Logger::warning($e);
     }
     return false;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:16,代码来源:Ghostscript.php

示例5: isAvailable

 /**
  * @return bool
  */
 public function isAvailable()
 {
     try {
         $lo = self::getLibreOfficeCli();
         if ($lo && parent::isAvailable()) {
             // LibreOffice and GhostScript is necessary
             return true;
         }
     } catch (\Exception $e) {
         Logger::warning($e);
     }
     return false;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:16,代码来源:LibreOffice.php

示例6: isAvailable

 /**
  * @return bool
  */
 public function isAvailable()
 {
     try {
         $ffmpeg = self::getFfmpegCli();
         $phpCli = Console::getPhpCli();
         if ($ffmpeg && $phpCli) {
             return true;
         }
     } catch (\Exception $e) {
         Logger::warning($e);
     }
     return false;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:16,代码来源:Ffmpeg.php

示例7: getById

 /**
  * Get the data for the object from database for the given id
  *
  * @param integer $id
  * @return void
  */
 public function getById($id)
 {
     try {
         $data = $this->db->fetchRow("SELECT objects.*, tree_locks.locked as o_locked FROM objects\n                LEFT JOIN tree_locks ON objects.o_id = tree_locks.id AND tree_locks.type = 'object'\n                    WHERE o_id = ?", $id);
         if ($data["o_id"]) {
             $this->assignVariablesToModel($data);
             $this->getData();
         } else {
             throw new \Exception("Object with the ID " . $id . " doesn't exists");
         }
     } catch (\Exception $e) {
         Logger::warning($e);
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:20,代码来源:Dao.php

示例8: getDataFromEditmode

 public static function getDataFromEditmode($data, $pimcoreTagName)
 {
     $tagClass = '\\Pimcore\\Model\\Object\\ClassDefinition\\Data\\' . ucfirst($pimcoreTagName);
     if (\Pimcore\Tool::classExists($tagClass)) {
         /**
          * @var \Pimcore\Model\Object\ClassDefinition\Data $tag
          */
         $tag = new $tagClass();
         return $tag->getDataFromEditmode($data);
     }
     //purposely return null if there is no valid class, log a warning
     Logger::warning("No valid pimcore tag found for fieldType ({$pimcoreTagName}), check 'fieldType' exists, and 'type' is not being used in config");
     return null;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:14,代码来源:Service.php

示例9: getDefaultAdapter

 /**
  * @return bool
  */
 public static function getDefaultAdapter()
 {
     $adapters = ["Ffmpeg"];
     foreach ($adapters as $adapter) {
         $adapterClass = "\\Pimcore\\Video\\Adapter\\" . $adapter;
         if (Tool::classExists($adapterClass)) {
             try {
                 $adapter = new $adapterClass();
                 if ($adapter->isAvailable()) {
                     return $adapter;
                 }
             } catch (\Exception $e) {
                 Logger::warning($e);
             }
         }
     }
     return null;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:21,代码来源:Video.php

示例10: getChildren

 /**
  * Returns the children of the asset if the asset is a folder
  *
  * @return array
  */
 public function getChildren()
 {
     $children = [];
     if ($this->asset->hasChilds()) {
         foreach ($this->asset->getChilds() as $child) {
             if ($child->isAllowed("view")) {
                 try {
                     if ($child = $this->getChild($child)) {
                         $children[] = $child;
                     }
                 } catch (\Exception $e) {
                     Logger::warning($e);
                 }
             }
         }
     }
     return $children;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:23,代码来源:Folder.php

示例11: getDefaultAdapter

 /**
  * @return bool
  */
 public static function getDefaultAdapter()
 {
     $adapters = array("LibreOffice", "Ghostscript");
     foreach ($adapters as $adapter) {
         $adapterClass = "\\Pimcore\\Document\\Adapter\\" . $adapter;
         if (Tool::classExists($adapterClass)) {
             try {
                 $adapter = new $adapterClass();
                 if ($adapter->isAvailable()) {
                     return $adapter;
                 }
             } catch (\Exception $e) {
                 \Logger::warning($e);
             }
         }
     }
     return null;
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:21,代码来源:Document.php

示例12: save

 /**
  * @param Object\Concrete $object
  * @throws \Exception
  */
 public function save(Object\Concrete $object)
 {
     // HACK: set the pimcore admin mode to false to get the inherited values from parent if this source one is empty
     $inheritedValues = Object\AbstractObject::doGetInheritedValues();
     $storetable = $this->model->getDefinition()->getTableName($object->getClass(), false);
     $querytable = $this->model->getDefinition()->getTableName($object->getClass(), true);
     $this->inheritanceHelper = new Object\Concrete\Dao\InheritanceHelper($object->getClassId(), "o_id", $storetable, $querytable);
     Object\AbstractObject::setGetInheritedValues(false);
     $fieldDefinitions = $this->model->getDefinition()->getFieldDefinitions();
     $data = [];
     $data["o_id"] = $object->getId();
     $data["fieldname"] = $this->model->getFieldname();
     // remove all relations
     try {
         $this->db->delete("object_relations_" . $object->getClassId(), "src_id = " . $object->getId() . " AND ownertype = 'objectbrick' AND ownername = '" . $this->model->getFieldname() . "' AND (position = '" . $this->model->getType() . "' OR position IS NULL OR position = '')");
     } catch (\Exception $e) {
         Logger::warning("Error during removing old relations: " . $e);
     }
     foreach ($fieldDefinitions as $key => $fd) {
         $getter = "get" . ucfirst($fd->getName());
         if (method_exists($fd, "save")) {
             // for fieldtypes which have their own save algorithm eg. objects, multihref, ...
             $fd->save($this->model);
         } elseif ($fd->getColumnType()) {
             if (is_array($fd->getColumnType())) {
                 $insertDataArray = $fd->getDataForResource($this->model->{$getter}(), $object, ['context' => $this->model]);
                 $data = array_merge($data, $insertDataArray);
             } else {
                 $insertData = $fd->getDataForResource($this->model->{$getter}(), $object, ['context' => $this->model]);
                 $data[$key] = $insertData;
             }
         }
     }
     $this->db->insertOrUpdate($storetable, $data);
     // get data for query table
     // $tableName = $this->model->getDefinition()->getTableName($object->getClass(), true);
     // this is special because we have to call each getter to get the inherited values from a possible parent object
     $data = [];
     $data["o_id"] = $object->getId();
     $data["fieldname"] = $this->model->getFieldname();
     $this->inheritanceHelper->resetFieldsToCheck();
     $oldData = $this->db->fetchRow("SELECT * FROM " . $querytable . " WHERE o_id = ?", $object->getId());
     $inheritanceEnabled = $object->getClass()->getAllowInherit();
     $parentData = null;
     if ($inheritanceEnabled) {
         // get the next suitable parent for inheritance
         $parentForInheritance = $object->getNextParentForInheritance();
         if ($parentForInheritance) {
             // we don't use the getter (built in functionality to get inherited values) because we need to avoid race conditions
             // we cannot Object\AbstractObject::setGetInheritedValues(true); and then $this->model->$method();
             // so we select the data from the parent object using FOR UPDATE, which causes a lock on this row
             // so the data of the parent cannot be changed while this transaction is on progress
             $parentData = $this->db->fetchRow("SELECT * FROM " . $querytable . " WHERE o_id = ? FOR UPDATE", $parentForInheritance->getId());
         }
     }
     foreach ($fieldDefinitions as $key => $fd) {
         if ($fd->getQueryColumnType()) {
             //exclude untouchables if value is not an array - this means data has not been loaded
             $method = "get" . $key;
             $fieldValue = $this->model->{$method}();
             $insertData = $fd->getDataForQueryResource($fieldValue, $object);
             $isEmpty = $fd->isEmpty($fieldValue);
             if (is_array($insertData)) {
                 $columnNames = array_keys($insertData);
                 $data = array_merge($data, $insertData);
             } else {
                 $columnNames = [$key];
                 $data[$key] = $insertData;
             }
             // if the current value is empty and we have data from the parent, we just use it
             if ($isEmpty && $parentData) {
                 foreach ($columnNames as $columnName) {
                     if (array_key_exists($columnName, $parentData)) {
                         $data[$columnName] = $parentData[$columnName];
                         if (is_array($insertData)) {
                             $insertData[$columnName] = $parentData[$columnName];
                         } else {
                             $insertData = $parentData[$columnName];
                         }
                     }
                 }
             }
             if ($inheritanceEnabled) {
                 //get changed fields for inheritance
                 if ($fd instanceof Object\ClassDefinition\Data\CalculatedValue) {
                     // nothing to do, see https://github.com/pimcore/pimcore/issues/727
                     continue;
                 } elseif ($fd->isRelationType()) {
                     if (is_array($insertData)) {
                         $doInsert = false;
                         foreach ($insertData as $insertDataKey => $insertDataValue) {
                             if ($isEmpty && $oldData[$insertDataKey] == $parentData[$insertDataKey]) {
                                 // do nothing, ... value is still empty and parent data is equal to current data in query table
                             } elseif ($oldData[$insertDataKey] != $insertDataValue) {
                                 $doInsert = true;
                                 break;
//.........这里部分代码省略.........
开发者ID:pimcore,项目名称:pimcore,代码行数:101,代码来源:Dao.php

示例13: saveTags

 /**
  * @param string $id
  * @param array $tags
  * @return void
  */
 protected function saveTags($id, $tags)
 {
     //$this->getDb()->beginTransaction();
     try {
         while ($tag = array_shift($tags)) {
             try {
                 $this->getDb()->insertOrUpdate("cache_tags", ["id" => $id, "tag" => $tag]);
             } catch (\Exception $e) {
                 if (strpos(strtolower($e->getMessage()), "is full") !== false) {
                     Logger::warning($e);
                     if ($this->_options["tags_do_not_switch_to_innodb"]) {
                         $this->clean();
                     } else {
                         // it seems that the MEMORY table is on the limit an full
                         // change the storage engine of the cache tags table to InnoDB
                         $this->getDb()->query("ALTER TABLE `cache_tags` ENGINE=InnoDB");
                     }
                     // try it again
                     $tags[] = $tag;
                 } else {
                     // it seems that the item does already exist
                     throw $e;
                 }
             }
         }
         //$this->getDb()->commit();
     } catch (\Exception $e) {
         Logger::error($e);
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:35,代码来源:Memcached.php

示例14: getByPath

 /**
  * @param string $path
  * @return self
  */
 public static function getByPath($path)
 {
     $path = Model\Element\Service::correctPath($path);
     try {
         $object = new self();
         if (Tool::isValidPath($path)) {
             $object->getDao()->getByPath($path);
             return self::getById($object->getId());
         }
     } catch (\Exception $e) {
         Logger::warning($e->getMessage());
     }
     return null;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:18,代码来源:AbstractObject.php

示例15: getById

 /**
  * Static helper to get an asset by the passed ID
  * @param integer $id
  * @return Asset|Asset\Archive|Asset\Audio|Asset\Document|Asset\Folder|Asset\Image|Asset\Text|Asset\Unknown|Asset\Video
  */
 public static function getById($id)
 {
     $id = intval($id);
     if ($id < 1) {
         return null;
     }
     $cacheKey = "asset_" . $id;
     try {
         $asset = \Zend_Registry::get($cacheKey);
         if (!$asset) {
             throw new \Exception("Asset in registry is null");
         }
     } catch (\Exception $e) {
         try {
             if (!($asset = \Pimcore\Cache::load($cacheKey))) {
                 $asset = new Asset();
                 $asset->getDao()->getById($id);
                 $className = "Pimcore\\Model\\Asset\\" . ucfirst($asset->getType());
                 $asset = \Pimcore::getDiContainer()->make($className);
                 \Zend_Registry::set($cacheKey, $asset);
                 $asset->getDao()->getById($id);
                 \Pimcore\Cache::save($asset, $cacheKey);
             } else {
                 \Zend_Registry::set($cacheKey, $asset);
             }
         } catch (\Exception $e) {
             Logger::warning($e->getMessage());
             return null;
         }
     }
     if (!$asset) {
         return null;
     }
     return $asset;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:40,代码来源:Asset.php


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