本文整理汇总了PHP中Logger::warning方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::warning方法的具体用法?PHP Logger::warning怎么用?PHP Logger::warning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::warning方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setProductFilter
/**
* Fill the product filter with a array.
*
* @author David Pauli <contact@david-pauli.de>
* @since 0.0.1
* @since 0.1.0 Use a default Locale and Currency.
* @api
* @param String[] $productFilterParameter The values of a product filter.
*/
public function setProductFilter($productFilterParameter)
{
if (!InputValidator::isArray($productFilterParameter) || InputValidator::isEmptyArray($productFilterParameter)) {
return;
}
foreach ($productFilterParameter as $key => $parameter) {
if ($key == "page") {
$this->setPage($parameter);
} else {
if ($key == "resultsPerPage") {
$this->setResultsPerPage($parameter);
} else {
if ($key == "direction") {
$this->setDirection($parameter);
} else {
if ($key == "sort") {
$this->setSort($parameter);
} else {
if ($key == "q") {
$this->setQ($parameter);
} else {
if ($key == "categoryID") {
$this->setCategoryID($parameter);
} else {
Logger::warning("Unknown attribute <i>" . $key . "</i> in product filter attribute.");
}
}
}
}
}
}
}
}
示例2: __construct
/**
* @param GenerationThread $thread
* @param \Logger $logger
* @param \ClassLoader $loader
*/
public function __construct(GenerationThread $thread, \Logger $logger, \ClassLoader $loader)
{
$this->thread = $thread;
$this->logger = $logger;
$this->loader = $loader;
$chunkX = $chunkZ = null;
while ($this->shutdown !== true) {
try {
if (count($this->requestQueue) > 0) {
foreach ($this->requestQueue as $levelID => $chunks) {
if (count($chunks) === 0) {
unset($this->requestQueue[$levelID]);
} else {
$key = key($chunks);
if (PHP_INT_SIZE === 8) {
$chunkX = $key >> 32 << 32 >> 32;
$chunkZ = ($key & 0xffffffff) << 32 >> 32;
} else {
list($chunkX, $chunkZ) = explode(":", $key);
$chunkX = (int) $chunkX;
$chunkZ = (int) $chunkZ;
}
unset($this->requestQueue[$levelID][$key]);
$this->generateChunk($levelID, $chunkX, $chunkZ);
}
}
} else {
$this->readPacket();
}
} catch (\Exception $e) {
$this->logger->warning("[Generator Thread] Exception: " . $e->getMessage() . " on file \"" . $e->getFile() . "\" line " . $e->getLine());
}
}
}
示例3: optionsAction
/**
* Produces the json to feed the dynamic dropdown
* Used by pimcore.object.tags.dynamicDropdown
*/
public function optionsAction()
{
$filter = new \Zend_Filter_PregReplace(array("match" => "@[^a-zA-Z0-9/\\-_]@", "replace" => ""));
$parentFolderPath = $filter->filter($this->_getParam("source_parent"));
if ($parentFolderPath) {
// remove trailing slash
if ($parentFolderPath != "/") {
$parentFolderPath = rtrim($parentFolderPath, "/ ");
}
// correct wrong path (root-node problem)
$parentFolderPath = str_replace("//", "/", $parentFolderPath);
$folder = Object_Folder::getByPath($parentFolderPath);
if ($folder) {
$options = $this->walk_path($folder);
} else {
Logger::warning("The folder submitted for could not be found: \"" . $this->_getParam("source_parent") . "\"");
}
} else {
Logger::warning("The folder submitted for source_parent is not valid: \"" . $this->_getParam("source_parent") . "\"");
}
$sort = $this->_getParam("sort_by");
usort($options, function ($a, $b) use($sort) {
$field = "id";
if ($sort == "byvalue") {
$field = "key";
}
if ($a[$field] == $b[$field]) {
return 0;
}
return $a[$field] < $b[$field] ? 0 : 1;
});
$this->_helper->json($options);
}
示例4: get_login
public function get_login()
{
$buf = $this->prefs->get('AuthMethod', 'Token');
$token_url = $buf['url'];
$user_node_name = $buf['user_node_name'];
$login_attribute_name = $buf['login_attribute_name'];
if (!isset($token_url) or $token_url == '') {
Logger::error('main', 'Token URL is not defined');
return NULL;
}
if (!isset($_REQUEST['token'])) {
Logger::warning('main', 'Missing parameter : token');
return NULL;
}
$token_url = str_replace('%TOKEN%', $_REQUEST['token'], $token_url);
$xml = query_url($token_url);
$dom = new DomDocument('1.0', 'utf-8');
$ret = @$dom->loadXML($xml);
if (!$ret) {
Logger::error('main', 'Token webservice does not send a valid XML');
return NULL;
}
$user_node = $dom->getElementsByTagname($user_node_name)->item(0);
if (!is_object($user_node)) {
Logger::error('main', 'Token webservice does not send a valid XML');
return NULL;
}
if (!$user_node->hasAttribute($login_attribute_name)) {
Logger::error('main', 'Token webservice does not send a valid XML');
return NULL;
}
$this->login = $user_node->getAttribute($login_attribute_name);
return $this->login;
}
示例5: 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] = Pimcore_File::getValidFilename($nameParts[count($nameParts) - 1]);
$sourcePath = implode("/", $nameParts);
$nameParts = explode("/", $destinationPath);
$nameParts[count($nameParts) - 1] = Pimcore_File::getValidFilename($nameParts[count($nameParts) - 1]);
$destinationPath = implode("/", $nameParts);
try {
if (dirname($sourcePath) == dirname($destinationPath)) {
try {
$destinationNode = $this->getNodeForPath($destinationPath);
// If we got here, it means the destination exists, and needs to be overwritten
$destinationNode->delete();
} catch (Sabre_DAV_Exception_FileNotFound $e) {
// If we got here, it means the destination node does not yet exist
Logger::warning("Sabre_DAV_Exception_FileNotFound");
}
$asset = Asset::getByPath("/" . $sourcePath);
$asset->setFilename(basename($destinationPath));
} else {
$asset = Asset::getByPath("/" . $sourcePath);
$parent = Asset::getByPath("/" . dirname($destinationPath));
$asset->setPath($parent->getFullPath() . "/");
$asset->setParentId($parent->getId());
}
} catch (Exception $e) {
Logger::error($e);
}
$asset->save();
}
示例6: __construct
/**
* @param GenerationThread $thread
* @param \Logger $logger
* @param \ClassLoader $loader
*/
public function __construct(GenerationThread $thread, \Logger $logger, \ClassLoader $loader)
{
$this->thread = $thread;
$this->logger = $logger;
$this->loader = $loader;
$chunkX = $chunkZ = null;
while ($this->shutdown !== true) {
try {
if (count($this->requestQueue) > 0) {
foreach ($this->requestQueue as $levelID => $chunks) {
if (count($chunks) === 0) {
unset($this->requestQueue[$levelID]);
} else {
Level::getXZ($key = key($chunks), $chunkX, $chunkZ);
unset($this->requestQueue[$levelID][$key]);
$this->generateChunk($levelID, $chunkX, $chunkZ);
}
}
} else {
$this->readPacket();
}
} catch (\Exception $e) {
$this->logger->warning("[Generator Thread] Exception: " . $e->getMessage() . " on file \"" . $e->getFile() . "\" line " . $e->getLine());
}
}
}
示例7: addPropertiesToDocument
/**
* @param Model\Document $document
* @throws \Zend_Json_Exception
*/
protected function addPropertiesToDocument(Model\Document $document)
{
// properties
if ($this->getParam("properties")) {
$properties = array();
// 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->getFullPath());
}
}
}
if ($document->isAllowed("properties")) {
$document->setProperties($properties);
}
}
// force loading of properties
$document->getProperties();
}
示例8: builder
public function builder()
{
if (empty($this->request->get['theme'])) {
$this->redirect($this->url->link('settings/themes', '', 'SSL'));
exit;
}
if (empty($this->request->get['store_id'])) {
$this->request->get['store_id'] = 0;
}
$theme = $this->request->get['theme'];
$this->document->setTitle(Language::getVar('SUMO_ADMIN_THEMES_BUILDER'));
$this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SETTINGS_DASHBOARD'), 'href' => $this->url->link('settings/dashboard', '', 'SSL')));
$this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_THEMES_SETTINGS'), 'href' => $this->url->link('settings/themes/', '', 'SSL')));
$this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_THEMES_BUILDER')));
$this->document->addScript('view/js/jquery/jquery.ajaxupload.js');
$this->data['stores'] = $this->model_settings_stores->getStores();
$this->data['current_store'] = isset($this->request->get['store_id']) ? $this->request->get['store_id'] : 0;
if (empty($this->request->get['action'])) {
$this->request->get['action'] = 'colors';
}
$action = $this->request->get['action'];
if (!method_exists($this, $action)) {
Logger::warning('It seems ' . $action . ' is not callable?');
$action = 'colors';
}
$this->data['action'] = $action;
$this->data['theme'] = $theme;
$this->data['content'] = $this->{$action}($this->data['current_store'], $this->data['theme']);
$this->template = 'settings/themes/builder.tpl';
$this->children = array('common/header', 'common/footer');
//$this->data['content'] = $this->data[$action];
$this->response->setOutput($this->render());
}
示例9: checkDependencies
/**
* Check dependencies
*
* @param Compiler $compiler
*/
public function checkDependencies(Compiler $compiler)
{
$classDefinition = $this->_classDefinition;
$extendedClass = $classDefinition->getExtendsClass();
if ($extendedClass) {
if ($classDefinition->getType() == 'class') {
if ($compiler->isClass($extendedClass)) {
$extendedDefinition = $compiler->getClassDefinition($extendedClass);
$classDefinition->setExtendsClassDefinition($extendedDefinition);
} else {
if ($compiler->isBundledClass($extendedClass)) {
$extendedDefinition = $compiler->getInternalClassDefinition($extendedClass);
$classDefinition->setExtendsClassDefinition($extendedDefinition);
} else {
$extendedDefinition = new ClassDefinitionRuntime($extendedClass);
$classDefinition->setExtendsClassDefinition($extendedDefinition);
$this->_logger->warning('Cannot locate class "' . $extendedClass . '" when extending class "' . $classDefinition->getCompleteName() . '"', 'nonexistent-class', $this->_originalNode);
}
}
} else {
if ($compiler->isInterface($extendedClass)) {
$extendedDefinition = $compiler->getClassDefinition($extendedClass);
$classDefinition->setExtendsClassDefinition($extendedDefinition);
} else {
if ($compiler->isBundledInterface($extendedClass)) {
$extendedDefinition = $compiler->getInternalClassDefinition($extendedClass);
$classDefinition->setExtendsClassDefinition($extendedDefinition);
} else {
$extendedDefinition = new ClassDefinitionRuntime($extendedClass);
$classDefinition->setExtendsClassDefinition($extendedDefinition);
$this->_logger->warning('Cannot locate class "' . $extendedClass . '" when extending interface "' . $classDefinition->getCompleteName() . '"', 'nonexistent-class', $this->_originalNode);
}
}
}
}
$implementedInterfaces = $classDefinition->getImplementedInterfaces();
if ($implementedInterfaces) {
$interfaceDefinitions = array();
foreach ($implementedInterfaces as $interface) {
if ($compiler->isInterface($interface)) {
$interfaceDefinitions[$interface] = $compiler->getClassDefinition($interface);
} else {
if ($compiler->isBundledInterface($interface)) {
$interfaceDefinitions[$interface] = $compiler->getInternalClassDefinition($interface);
} else {
$extendedDefinition = new ClassDefinitionRuntime($extendedClass);
$classDefinition->setExtendsClassDefinition($extendedDefinition);
$this->_logger->warning('Cannot locate class "' . $interface . '" when extending interface "' . $classDefinition->getCompleteName() . '"', 'nonexistent-class', $this->_originalNode);
}
}
}
if ($interfaceDefinitions) {
$classDefinition->setImplementedInterfaceDefinitions($interfaceDefinitions);
}
}
}
示例10: e
/**
*
* @param \Exception|string $e
* @throws unknown
*/
public static function e($e)
{
if ($e === null || is_string($e)) {
Logger::warning($e);
throw new \Exception($e);
} else {
Logger::warning($e->__toString());
throw $e;
}
}
示例11: 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);
}
}
示例12: set
/**
* 设置cache
*
* @param string $name
* @param mixed $var
* @param int
* @param SerializableFunc $expire_check
* @return boolean
* 缓存过期检查方法, 缓存过期(超过ttl)后, get时调用, 返回true表示缓存继续可用.
* 如checker($got_var, $time)
*
*/
public function set($name, $var, $ttl = 0, $expire_check = null)
{
$name = $this->tag . $name;
$res = $this->impl->set($name, array($var, $ttl, $expire_check, time()), is_null($expire_check) ? $ttl : 0);
if (!$res) {
Logger::warning("set cache {$name} failed");
} else {
Logger::debug("set cache {$name} ok, ttl={$ttl}, check=" . ($expire_check === null ? 'null' : get_class($expire_check)));
}
return $res;
}
示例13: createJSON
/**
* Call this function to create a JSON string from a array.
*
* @author David Pauli <contact@david-pauli.de>
* @since 0.0.0
* @param mixed[] $array The array to make a JSON.
* @return String The JSON string.
*/
public static function createJSON($array)
{
if (!InputValidator::isArray($array)) {
return null;
}
$result = json_encode($array);
if (!InputValidator::isJSON($result)) {
Logger::warning("There is an error with creating a JSON with the following array: <strong>" . json_last_error() . ": " . json_last_error_msg() . "</strong><br/>\n" . "<pre>" . $array . "</pre>");
return null;
}
return $result;
}
示例14: parseJSON
/**
* Call this function with the JSON in parameter.
*
* @param String $JSON The JSON string to parse.
* @return array The array of the JSON element or null if there is an error.
*/
public static function parseJSON($JSON)
{
if (!InputValidator::isJSON($JSON)) {
return array();
}
$result = json_decode($JSON, true);
if (!InputValidator::isArray($result)) {
Logger::warning("There is an error with parsing the follwing JSON: <strong>" . json_last_error() . ": " . json_last_error_msg() . "</strong><br/>\n" . "<pre>" . $JSON . "</pre>");
return array();
}
return $result;
}
示例15: import
public function import($data)
{
foreach ($data as $class => $rows) {
Logger::warning("Import data for {$class}");
$class = __NAMESPACE__ . "\\{$class}";
$model = new $class();
foreach ($rows as $row_data) {
$row = $model->newRow();
$row->setValues($row_data);
$row->save();
}
}
}