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


PHP CakeLog类代码示例

本文整理汇总了PHP中CakeLog的典型用法代码示例。如果您正苦于以下问题:PHP CakeLog类的具体用法?PHP CakeLog怎么用?PHP CakeLog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: saveUserAttributesOrder

 /**
  * Move Order UserAttributes
  *
  * @param array $data received post data
  * @return bool True on success, false on validation errors
  * @throws InternalErrorException
  */
 public function saveUserAttributesOrder($data)
 {
     //トランザクションBegin
     $this->setDataSource('master');
     $dataSource = $this->getDataSource();
     $dataSource->begin();
     try {
         ////バリデーション
         //$indexes = array_keys($data['LinkOrders']);
         //foreach ($indexes as $i) {
         //	if (! $this->validateLinkOrder($data['LinkOrders'][$i])) {
         //		return false;
         //	}
         //}
         //
         ////登録処理
         //foreach ($indexes as $i) {
         //	if (! $this->save($data['LinkOrders'][$i], false, false)) {
         //		throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         //	}
         //}
         //トランザクションCommit
         $dataSource->commit();
     } catch (Exception $ex) {
         //トランザクションRollback
         $dataSource->rollback();
         CakeLog::error($ex);
         throw $ex;
     }
     return true;
 }
开发者ID:Onasusweb,项目名称:UserAttributes,代码行数:38,代码来源:UserAttributeSetting.php

示例2: view

 /**
  * view
  *
  * @return void
  * @throws Exception
  */
 public function view()
 {
     if (!Current::read('Block.id')) {
         $this->autoRender = false;
         return;
     }
     $isAccessed = 'block_key_' . Current::read('Block.key');
     //AccessCounterFrameSettingデータ取得
     $counterFrameSetting = $this->AccessCounterFrameSetting->getAccessCounterFrameSetting(true);
     $this->set('accessCounterFrameSetting', $counterFrameSetting['AccessCounterFrameSetting']);
     //AccessCounterデータ取得
     $accessCounter = $this->AccessCounter->getAccessCounter(true);
     // カウントアップ処理
     if (!$this->Session->read($isAccessed)) {
         try {
             $this->AccessCounter->updateCountUp($accessCounter);
             $accessCounter['AccessCounter']['count']++;
             // アクセス情報を記録
             $this->Session->write($isAccessed, CakeSession::read('Config.userAgent'));
         } catch (Exception $ex) {
             CakeLog::error($ex);
             throw $ex;
         }
     }
     $this->set('accessCounter', $accessCounter['AccessCounter']);
 }
开发者ID:Onasusweb,项目名称:AccessCounters,代码行数:32,代码来源:AccessCountersController.php

示例3: convertToMo

 public static function convertToMo($source, $destination)
 {
     Converter::admin_clear_cache();
     $shellCmd = 'msgfmt -cv -o ' . $destination . ' ' . $source . ' 2>&1';
     $result = shell_exec($shellCmd);
     CakeLog::write('debug', 'Translation : ' . $result . 'Path : ' . $destination);
 }
开发者ID:ivanbautsita,项目名称:gestion-escolar-campus-virtuales,代码行数:7,代码来源:Converter.php

示例4: processSubscription

 public function processSubscription()
 {
     if (!$this->request->is('post') || !isset($this->request->data['bt_signature']) || !isset($this->request->data['bt_payload'])) {
         $this->response->statusCode(404);
         return $this->response;
     }
     $webhookNotification = Braintree_WebhookNotification::parse($this->request->data['bt_signature'], $this->request->data['bt_payload']);
     if (!isset($webhookNotification->subscription)) {
         $this->response->statusCode(404);
         return $this->response;
     }
     CakeLog::write('debug', __d('billing', '%s Braintree webhook for subscription %s: %s', $webhookNotification->timestamp, $webhookNotification->subscription->id, $webhookNotification->kind));
     $braintreeSubscription = $webhookNotification->subscription;
     CakeLog::write('debug', json_encode($webhookNotification->subscription));
     $subscription = $this->BillingSubscription->findByRemoteSubscriptionId($braintreeSubscription->id);
     if (empty($subscription)) {
         $this->response->statusCode(404);
         return $this->response;
     }
     switch ($braintreeSubscription->status) {
         case 'Canceled':
             $result = $this->BillingSubscription->cancel($subscription['BillingSubscription']['id']);
             break;
         default:
             $result = true;
     }
     if ($result) {
         $this->response->statusCode(200);
     } else {
         $this->response->statusCode(500);
     }
     return $this->response;
 }
开发者ID:nilBora,项目名称:konstruktor,代码行数:33,代码来源:BillingCallbackController.php

示例5: ping

 /**
  * PING
  *
  * @param string|null $url pingのURL(テストで使用する)
  * @return mixed fsockopenの結果
  */
 public function ping($url = null)
 {
     //サイトの生死確認
     $errno = 0;
     $errstr = null;
     if (!$url) {
         $url = self::NOTIFICATION_PING_URL;
     }
     CakeLog::info('Execute ping ' . $url);
     try {
         $resource = fsockopen($url, 80, $errno, $errstr, 3);
     } catch (Exception $ex) {
         $resource = false;
         CakeLog::error($ex);
     }
     if (!$resource) {
         CakeLog::info('Failure ping ' . $url);
         $result = false;
     } else {
         fclose($resource);
         $result = true;
         CakeLog::info('Success ping ' . $url);
     }
     return $result;
 }
开发者ID:NetCommons3,项目名称:Notifications,代码行数:31,代码来源:Notification.php

示例6: onProductBought

 public function onProductBought($event)
 {
     $this->Product->id = $event->data['product']['id'];
     $this->Product->recursive = 2;
     $product = $this->Product->read();
     if ($product[$this->Product->WebhostingProduct->alias]['id'] === null) {
         return;
     }
     $this->Product->WebhostingProduct->HostGroup->id = $product['HostGroup']['id'];
     $this->Product->WebhostingProduct->HostGroup->recursive = 2;
     $hostGroup = $this->Product->WebhostingProduct->HostGroup->read();
     $WebhostingProvider = BasicWebhostingProvider::get($hostGroup['Host'][0]['Provider']['class']);
     $webhostingPackage = $this->WebhostingPackage->createFromWebhostingProduct($product['WebhostingProduct'], $event->data['customer']['id'], $hostGroup['Host'][0]['id']);
     $webhostingDetails = $WebhostingProvider->createPackage($webhostingPackage['WebhostingPackage']['id']);
     if ($webhostingDetails === false) {
         CakeLog::write(LOG_ERROR, __d('pltfrm', 'Webhosting provider %1$s could not create webhosting package with id %2$d owned by %3$s', $hostGroup['Host'][0]['Provider']['class'], $webhostingPackage['WebhostingPackage']['id'], $webhostingPackage['Customer']['name']), array('webhosting', 'pltfrm'));
         return false;
     }
     $eventData = array();
     $eventData['webhosting']['id'] = $webhostingPackage['WebhostingPackage']['id'];
     $eventData['details'] = $webhostingDetails;
     $eventData['metadata'] = array();
     $webhostingCreatedEvent = new CakeEvent('Webhosting.created', $this, $eventData);
     CakeEventManager::instance()->dispatch($webhostingCreatedEvent);
     CakeLog::write(LOG_INFO, __d('pltfrm', 'Webhosting provider %1$s created webhosting package with id %2$d', $hostGroup['Host'][0]['Provider']['class'], $webhostingPackage['WebhostingPackage']['id']), array('webhosting', 'pltfrm'));
     if (isset($event->data['order'])) {
         $this->OrderProduct->changeStatus('delivered', $event->data['order']['product_id']);
     }
     return true;
 }
开发者ID:cvo-technologies,项目名称:pltfrm,代码行数:30,代码来源:WebhostingHandler.php

示例7: throwError

 protected function throwError($mustacheError = '')
 {
     if (Configure::write('debug') > 0) {
         return debug(compact('mustacheError'));
     }
     return CakeLog::write('error', compact('mustacheError'));
 }
开发者ID:JacopKane,项目名称:Cake-Mustache,代码行数:7,代码来源:MustacheHelper.php

示例8: uninstallPlugin

 /**
  * Uninstall plugin
  *
  * @param Model $model Model using this behavior
  * @param array $data Plugin data
  * @return bool True on success
  * @throws InternalErrorException
  */
 public function uninstallPlugin(Model $model, $data)
 {
     $model->loadModels(['Plugin' => 'PluginManager.Plugin', 'PluginsRole' => 'PluginManager.PluginsRole', 'PluginsRoom' => 'PluginManager.PluginsRoom']);
     //トランザクションBegin
     $model->setDataSource('master');
     $dataSource = $model->getDataSource();
     $dataSource->begin();
     if (is_string($data)) {
         $key = $data;
     } else {
         $key = $data[$model->alias]['key'];
     }
     try {
         //Pluginの削除
         if (!$model->deleteAll(array($model->alias . '.key' => $key), false)) {
             throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         }
         //PluginsRoomの削除
         if (!$model->PluginsRoom->deleteAll(array($model->PluginsRoom->alias . '.plugin_key' => $key), false)) {
             throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         }
         //PluginsRoleの削除
         if (!$model->PluginsRole->deleteAll(array($model->PluginsRole->alias . '.plugin_key' => $key), false)) {
             throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         }
         //トランザクションCommit
         $dataSource->commit();
     } catch (Exception $ex) {
         //トランザクションRollback
         $dataSource->rollback();
         CakeLog::error($ex);
         throw $ex;
     }
     return true;
 }
开发者ID:Onasusweb,项目名称:PluginManager,代码行数:43,代码来源:PluginBehavior.php

示例9: changeStatus

 public function changeStatus(Model $Model, $status, $id = null, $force = false)
 {
     if ($id === null) {
         $id = $Model->getID();
     }
     if ($id === false) {
         return false;
     }
     $force = true;
     $Model->id = $id;
     if (!$Model->exists()) {
         throw new NotFoundException();
     }
     if ($force !== true) {
         $modelData = $Model->read();
         if ($modelData[$Model->alias]['status'] === $status) {
             CakeLog::write(LOG_WARNING, __d('webshop', 'The status of %1$s with id %2$d is already set to %3$s. Not making a change', strtolower(Inflector::humanize(Inflector::underscore($Model->name))), $id, $status), array('webshop'));
             return false;
         }
     } else {
         CakeLog::write(LOG_WARNING, __d('webshop', 'Status change of %1$s with id %2$d is being forced to %3$s', strtolower(Inflector::humanize(Inflector::underscore($Model->name))), $id, $status), array('webshop'));
     }
     $Model->saveField('status', $status);
     CakeLog::write(LOG_INFO, __d('webshop', 'Changed status of %1$s with id %2$d to %3$s', strtolower(Inflector::humanize(Inflector::underscore($Model->name))), $id, $status), array('webshop'));
     $eventData = array();
     $eventData[Inflector::underscore($Model->name)]['id'] = $id;
     $eventData[Inflector::underscore($Model->name)]['status'] = $status;
     $overallEvent = new CakeEvent($Model->name . '.statusChanged', $this, $eventData);
     $specificEvent = new CakeEvent($Model->name . '.statusChangedTo' . Inflector::camelize($status), $this, $eventData);
     CakeEventManager::instance()->dispatch($overallEvent);
     CakeEventManager::instance()->dispatch($specificEvent);
     return true;
 }
开发者ID:cvo-technologies,项目名称:croogo-webshop-plugin,代码行数:33,代码来源:StatusBehavior.php

示例10: saveBlogFrameSetting

 /**
  * save blog
  *
  * @param array $data received post data
  * @return mixed On success Model::$data if its not empty or true, false on failure
  * @throws InternalErrorException
  */
 public function saveBlogFrameSetting($data)
 {
     $this->loadModels(['BlogFrameSetting' => 'Blogs.BlogFrameSetting']);
     //トランザクションBegin
     $dataSource = $this->getDataSource();
     $dataSource->begin();
     try {
         //バリデーション
         if (!$this->validateBlogFrameSetting($data)) {
             $dataSource->rollback();
             return false;
         }
         //登録処理
         if (!($resultData = $this->save(null, false))) {
             throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         }
         //トランザクションCommit
         $dataSource->commit();
     } catch (Exception $ex) {
         //トランザクションRollback
         $dataSource->rollback();
         CakeLog::error($ex);
         throw $ex;
     }
     return $resultData;
 }
开发者ID:Onasusweb,项目名称:Blogs,代码行数:33,代码来源:BlogFrameSetting.php

示例11: after_add

 /**
  * after_countup
  *
  * @param mixed $event
  */
 public function after_add($event)
 {
     CakeLog::write('info', sprintf("Slide added. id=%s key=%s", $event->data['id'], $event->data['key']));
     $this->SimpleQueue = ClassRegistry::init('SQS.SimpleQueue');
     $this->SimpleQueue->send('extract', array('id' => $event->data['id'], 'key' => $event->data['key']));
     return true;
 }
开发者ID:nicefirework,项目名称:open-slideshare,代码行数:12,代码来源:SlideListener.php

示例12: call

 public static function call($action, $parameters = null)
 {
     $ch = curl_init(YouniqueAPIURL . $action);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     if (YOUNIQUE_TESTSERVER) {
         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 100);
         curl_setopt($ch, CURLOPT_TIMEOUT, 100);
     } else {
         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
         curl_setopt($ch, CURLOPT_TIMEOUT, 20);
     }
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-YNQ-NOSESSION: true'));
     if (!empty($parameters)) {
         curl_setopt($ch, CURLOPT_POST, true);
         curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($parameters));
     }
     $result = curl_exec($ch);
     curl_close($ch);
     $object = json_decode($result);
     if (is_object($object) && (!empty($object->result) || is_array($object->result))) {
         return $object->result;
     } else {
         /**
          * Results of exception viewable in log and error page.
          * Development only @see younique_api.ctp
          */
         if (YOUNIQUE_TESTSERVER) {
             CakeLog::debug('API Error Action: ' . $action);
             CakeLog::debug(var_export($result, true));
         }
         throw new YouniqueApiException(array('http_result' => $result, 'http_action' => $action));
     }
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:34,代码来源:YouniqueAPI.php

示例13: onLoginEvents

 public function onLoginEvents($event)
 {
     $safe = Configure::read('Audit.trustHttpForwardedFor');
     if ($safe === null) {
         $safe = false;
     }
     $controller = $event->subject;
     $user_id = $source_id = AuthComponent::user('id');
     if (empty($user_id)) {
         $user_id = $this->_guessUserId($controller);
     }
     $host = env('HTTP_HOST');
     $ua = env('HTTP_USER_AGENT');
     $referer = $controller->request->referer();
     $server_name = env('SERVER_NAME');
     $server_port = env('SERVER_PORT');
     $remote_addr = $controller->request->clientIp($safe);
     $request_scheme = env('REQUEST_SCHEME');
     $request_time = env('REQUEST_TIME');
     $session_id = session_id();
     $audit = compact('user_id', 'source_id', 'host', 'ua', 'referer', 'server_name', 'server_port', 'remote_addr', 'request_time', 'request_time_float', 'session_id');
     $audit['event'] = $event->name;
     $SessionAudit = ClassRegistry::init('Audit.SessionAudit');
     $SessionAudit->create();
     $result = $SessionAudit->save(array('SessionAudit' => $audit));
     if (!$result) {
         CakeLog::critical('Unable to log session audit records');
         $event->result = false;
         $event->stopPropagation();
     }
     return $event;
 }
开发者ID:xintesa,项目名称:audit,代码行数:32,代码来源:AuditEventHandler.php

示例14: parse

 public function parse(DOMElement $node)
 {
     $manager = IdmlDeclarationManager::getInstance();
     foreach ($node->childNodes as $child) {
         if ($child->nodeType != XML_ELEMENT_NODE) {
             continue;
         }
         if ($child->nodeName == $this->groupTemplateName) {
             $classname = 'Idml' . $this->groupTemplateName;
             // something like 'IdmlParagraphStyleGroup'
             $obj = new $classname();
             $name = $obj->parse($child);
             $manager->addDeclaredStyleGroup($name, $obj);
             $this->children[] = $name;
         } else {
             if ($child->nodeName == $this->styleTemplateName) {
                 $classname = 'Idml' . $this->styleTemplateName;
                 // something like 'IdmlParagraphStyle'
                 $obj = new $classname();
                 $obj->parse($child);
                 $name = $obj->idmlKeyValues['Self'];
                 $manager->addDeclaredStyle($name, $obj);
                 $this->children[] = $name;
             } else {
                 CakeLog::debug("[IdmlDeclaredStyleGroup::parse] Unhandled tag <{$child->nodeName}>");
             }
         }
     }
     return $node->hasAttribute('Self') ? $node->getAttribute('Self') : '';
 }
开发者ID:skypeter1,项目名称:webapps,代码行数:30,代码来源:IdmlDeclaredStyleGroup.php

示例15: setup

 /**
  * setup
  * 
  * @param Model $model
  * @param array $config 
  */
 public function setup(Model $model, $config = array())
 {
     // catch and adjust old $config parameter names that would have been used rarely and were
     // confusingly named:-
     //  - the "check_cache" parameter has been renamed to "cache_config_name_check"
     //  - the "default_cache" parameter has been renamed to "cache_config_name_default"
     if (isset($config['check_cache'])) {
         $config['cache_config_name_check'] = $config['check_cache'];
         unset($config['check_cache']);
         CakeLog::warning('Use of deprecated Autocache config parameter detected', 'check_cache');
     }
     if (isset($config['default_cache'])) {
         $config['cache_config_name_default'] = $config['default_cache'];
         unset($config['default_cache']);
         CakeLog::warning('Use of deprecated Autocache config parameter detected', 'default_cache');
     }
     // > cache_config_name_check - determines if we bother checking if the supplied
     // cache configuration name is valid - prevents the developer thinking they are
     // caching when they are not - will throw a cache expection if fails this check
     //
     // > cache_config_name_default - is the default cache name, which by default is
     // the string "default" - confused?  You just need to make sure you have an
     // appropriate Cache::config('default',array(...)) in your bootstrap.php
     // or core.php
     //
     // > dummy_datasource - name of the dummy data source in the database.php file
     // should look something like this:-
     // public $autocache = array('datasource' => 'AutocacheSource');
     $this->runtime = array_merge(array('cache_config_name_check' => Configure::read('debug') > 0 ? true : false, 'cache_config_name_default' => 'default', 'dummy_datasource' => 'autocache'), (array) $config);
 }
开发者ID:ndejong,项目名称:CakephpAutocachePlugin,代码行数:36,代码来源:AutocacheBehavior.php


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