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


PHP Yii::trace方法代码示例

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


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

示例1: assignInternalStaffAuth

 /**
  * Adds the current LDAP-authenticated user to the 'internal_staff_auth' permissions group.
  */
 public function assignInternalStaffAuth()
 {
     $logger = \Yii::getLogger();
     $logger->init();
     $logger->flushInterval = 1;
     $logger->traceLevel = 0;
     $this->setIsNewRecord(True);
     $this->item_name = "internal_staff_auth";
     $this->user_id = (string) strval($this->user_id);
     if (intval($this->user_id) > 0) {
         $this->created_at = time();
         $this->created_by = "system";
         $this->updated_by = "system";
         $this->save();
     }
     $msg = "gms: assignInternalStaffAuth() for UserId: " . $this->user_id;
     \Yii::trace($msg . " (YT)", __METHOD__);
     //Use the convenience method 'TRACE'
     $logger->log($msg . " (LG)", 4);
     if (!empty($this->getErrors())) {
         $errs = $this->getErrors();
         foreach ($errs as $err) {
             foreach ($err as $item) {
                 $msg = "gms: ERR in assignInternalStaffAuth() -- " . $item;
                 //\Yii::trace($msg . " (YT)", __METHOD__);    //Use the convenience method 'TRACE'
                 //$logger->log($msg . " (LG)", 4);
             }
         }
     }
     $logger->flush();
     return null;
 }
开发者ID:gregsanders,项目名称:stories,代码行数:35,代码来源:authassignment.php

示例2: run

 public function run()
 {
     Yii::trace(get_class($this) . '.run()');
     $controller = parent::run();
     $json = isset($this->request->json) ? $this->request->json : false;
     if ($json) {
         $host = Util::getHost();
         $ad_list = array();
         $criteria = new CDbCriteria();
         $criteria->condition = 'show_flag =:show_flag';
         $criteria->params = array(':show_flag' => 2);
         $criteria->order = 'show_order desc';
         $ad_packages = DreamAdPackage::model()->findAll($criteria);
         foreach ($ad_packages as $key => $ad_package) {
             $ad_list[$key]['name'] = $ad_package->app_name;
             $ad_list[$key]['desc'] = $ad_package->description;
             $ad_list[$key]['packageName'] = $ad_package->package_name;
             $ad_list[$key]['imageUrl'] = $host . $ad_package->icon_url;
             $apkUrl = strpos($ad_package->download_url, '://') ? $ad_package->download_url : $host . $ad_package->download_url;
             $ad_list[$key]['apkUrl'] = $apkUrl;
             $ad_list[$key]['size'] = Util::formatFileSize($ad_package->file_size);
             $ad_list[$key]['buttonName'] = '下载';
         }
         if ($ad_list) {
             $this->response->json = array_values($ad_list);
         } else {
             $this->response->json = null;
         }
         return $this->response->code = 200;
     }
     return $this->response->code = 500;
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:32,代码来源:RootAction.php

示例3: checkAccess

 /**
  * Performs access check for the specified user.
  * @param string $itemName the name of the operation that need access check
  * @param mixed $userId the user ID. This should can be either an integer and a string representing
  * the unique identifier of a user. See {@link IWebUser::getId}.
  * @param array $params name-value pairs that would be passed to biz rules associated
  * with the tasks and roles assigned to the user.
  * @return boolean whether the operations can be performed by the user.
  */
 public function checkAccess($itemName, $userId, $params = array())
 {
     if (!isset($this->_items[$itemName])) {
         return false;
     }
     $item = $this->_items[$itemName];
     Yii::trace('Checking permission "' . $item->getName() . '"', 'system.web.auth.CPhpAuthManager');
     if ($this->executeBizRule($item->getBizRule(), $params, $item->getData())) {
         if (in_array($itemName, $this->defaultRoles)) {
             return true;
         }
         if (isset($this->_assignments[$userId][$itemName])) {
             $assignment = $this->_assignments[$userId][$itemName];
             if ($this->executeBizRule($assignment->getBizRule(), $params, $assignment->getData())) {
                 return true;
             }
         }
         foreach ($this->_children as $parentName => $children) {
             if (isset($children[$itemName]) && $this->checkAccess($parentName, $userId, $params)) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:avtograd,项目名称:yii,代码行数:34,代码来源:CPhpAuthManager.php

示例4: release

 public function release($dbConfig = false)
 {
     //		ob_flush();
     //		ob_clean();
     \Yii::trace('application release called.dbConfig=' . VarDumper::dumpAsString($dbConfig), __METHOD__);
     if ($dbConfig) {
         /**
          * 关闭非持久化的数据库连接
          */
         $keys = array_keys($dbConfig);
         if ($keys) {
             foreach ($keys as $item) {
                 $dbObject = \Yii::$app->get($item);
                 if ($dbObject instanceof \yii\db\Connection) {
                     if (!isset($dbObject->attributes[\PDO::ATTR_PERSISTENT])) {
                         if ($dbObject->getIsActive()) {
                             \Yii::trace('db ' . VarDumper::dumpAsString($dbObject) . 'close.', __METHOD__);
                             $dbObject->close();
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:highestgoodlikewater,项目名称:yii2-liuxy-extension,代码行数:25,代码来源:Application.php

示例5: run

 public function run()
 {
     $nav = $content = '';
     $first = true;
     $type = rtrim($this->type, 's');
     foreach ($this->items as $id => $item) {
         if (is_array($item['content'])) {
             $id = "{$this->id}-{$id}";
             $opts = $first ? array('class' => 'active') : array();
             $opts['class'] = isset($opts['class']) ? $opts['class'] . ' dropdown' : 'dropdown';
             $dropdown = array();
             foreach ($item['content'] as $subId => $subTab) {
                 Yii::trace(CVarDumper::dumpAsString($subTab));
                 $subOpts = array();
                 $subOpts['id'] = "{$id}-{$subId}";
                 $subOpts['class'] = 'tab-pane';
                 $content .= CHtml::tag('div', $subOpts, $subTab['content']);
                 $dropdown[$subTab['title']] = '#' . $subOpts['id'];
             }
             Yii::trace(CVarDumper::dumpAsString($dropdown));
             $nav .= CHtml::tag('li', $opts, BHtml::dropdownToggle($item['title']) . BHtml::dropdownMenu($dropdown, array('linkOptions' => array('data-toggle' => 'tab'))));
         } else {
             $id = "{$this->id}-{$id}";
             $opts = $first ? array('class' => 'active') : array();
             $nav .= CHtml::tag('li', $opts, CHtml::link($item['title'], "#{$id}", array('data-toggle' => $type)));
             $opts['id'] = $id;
             $opts['class'] = isset($opts['class']) ? $opts['class'] . ' tab-pane' : 'tab-pane';
             $content .= CHtml::tag('div', $opts, $item['content']);
         }
         $first = false;
     }
     echo CHtml::tag('div', $this->htmlOptions, CHtml::tag('ul', $this->navOptions, $nav) . CHtml::tag('div', array('class' => 'tab-content'), $content));
     BHtml::registerBootstrapJs();
 }
开发者ID:rzamarripa,项目名称:masoftproyectos,代码行数:34,代码来源:BTabs.php

示例6: findAllAsArray

 /**
  * Finds all active records satisfying the specified condition but returns them as array
  *
  * See {@link find()} for detailed explanation about $condition and $params.
  * @param mixed $condition query condition or criteria.
  * @param array $params parameters to be bound to an SQL statement.
  * @return array list of active records satisfying the specified condition. An empty array is returned if none is found.
  */
 public function findAllAsArray($condition = '', $params = array())
 {
     Yii::trace(get_class($this) . '.findAll()', 'system.db.ar.CActiveRecord');
     $criteria = $this->getCommandBuilder()->createCriteria($condition, $params);
     return $this->query($criteria, true, false);
     //Notice the third parameter 'false'
 }
开发者ID:withhope,项目名称:HIT-Survey,代码行数:15,代码来源:LSActiveRecord.php

示例7: run

 public function run()
 {
     Yii::trace(get_class($this) . '.run()');
     $controller = parent::run();
     $json = isset($this->request->json) ? $this->request->json : false;
     $app_code = isset($this->request->appCode) ? $this->request->appCode : false;
     $app_version = isset($this->request->appVersion) ? $this->request->appVersion : false;
     if ($json && $app_code && $app_version) {
         //push type 1:push 2:screen
         $push_type = isset($json->type) ? $json->type : 1;
         //检查当前应用是否有推送任务
         $push_ids = DreamPushAppRelative::model()->checkPushStatus($app_code, $push_type);
         //获取当前有效的广告推送任务
         $push_ads = DreamPushTask::model()->getPushTasks($push_ids, $push_type);
         //get baidu cpd AD
         $uuid = isset($json->uuid) ? $json->uuid : false;
         $imei = isset($json->imei) ? $json->imei : false;
         if ($app_version >= 200) {
             if ($uuid || $imei) {
                 $push_ads = Util::getBaiduAd($uuid, $imei, $push_ads);
             }
         }
         if ($push_ads) {
             $this->response->push = array_values($push_ads);
         } else {
             $this->response->push = null;
         }
         return $this->response->code = 200;
     }
     return $this->response->code = 500;
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:31,代码来源:PushAction.php

示例8: invoke

 /**
  * 控制器执行主逻辑函数
  *
  * @return mixed $value 返回最终需要执行完的结果
  */
 public function invoke()
 {
     Yii::trace(Yii::t('api', 'Begin to process {class}::{function}', array('{class}' => get_class($this), '{function}' => __FUNCTION__)), "miniyun.api");
     // 调用父类初始化函数,注册自定义的异常和错误处理逻辑
     parent::init();
     // keys,是作为参数的键值,进行请求合法验证
     $keys = array('Filename', 'key');
     # 重新序列化参数
     $post = array();
     foreach ($_POST as $key => $value) {
         if ($key == "Filename") {
             $name = explode("_part_", $value);
             $post[$key] = $name[0];
         } else {
             $post[$key] = $value;
         }
     }
     if (MSecurity::verification($keys, $post) == false) {
         Yii::log(Yii::t('api', "Request is Error, verification error"), CLogger::LEVEL_ERROR, "miniyun.api");
         throw new MException(Yii::t('api', MConst::INVLID_REQUEST . "3"), MConst::UPLOAD_FILE_FAILS);
     }
     // 处理创建文件
     if (!MUtils::create(DOCUMENT_CACHE, $_POST, $_FILES)) {
         throw new MException(Yii::t('api', MConst::INVLID_REQUEST . "4"), MConst::UPLOAD_FILE_FAILS);
     }
 }
开发者ID:youngsun45,项目名称:miniyun,代码行数:31,代码来源:MPartUploadController.php

示例9: saveInlineCodeToFile

 /**
  * Сохранить инлайновые скрипты в указанной позиции в общий файл.
  * Довольно бесполезная фича, единственная цель которой - избавить тело страницы
  * от инлайновых скриптов.
  * 
  * @param  int $position
  */
 protected function saveInlineCodeToFile($position = self::POS_HEAD)
 {
     $code = $this->owner->getInlineCode($position);
     if (!$code) {
         return;
     }
     $this->owner->startCounters('saving-inline');
     if (!$this->inlineScriptSizeThreshold || strlen($code) >= $this->inlineScriptSizeThreshold) {
         $fileName = 'inline-' . $this->owner->hash($code) . '.js';
         $inlineFile = Yii::app()->assetManager->basePath . DIRECTORY_SEPARATOR . $fileName;
         $inlineUrl = Yii::app()->assetManager->baseUrl . DIRECTORY_SEPARATOR . $fileName;
         if ($result = file_exists($inlineFile)) {
             Yii::trace('Inline script at ' . $position . ' is already saved in ' . $inlineFile);
         } else {
             Yii::trace('Saving inline script at ' . $position . ' into ' . $inlineFile);
             $result = file_put_contents($inlineFile, $code);
         }
         if ($result) {
             $this->owner->registerScriptFile($inlineUrl, $position);
             $this->owner->clearInlineCode($position);
         }
     } else {
         Yii::trace('Inline script at ' . $position . ' is too small.');
     }
     $this->owner->stopCounters('saving-inline');
 }
开发者ID:herroffizier,项目名称:yiisset,代码行数:33,代码来源:InlineScriptBehavior.php

示例10: removeTestPlayers

 private function removeTestPlayers()
 {
     $sql = "DELETE FROM `players` WHERE `email` LIKE 'test1%@test.test'";
     \Yii::trace("******** Delete test players: {$sql}");
     $res = \Yii::$app->db->createCommand($sql)->execute();
     \Yii::trace("Deleted _{$res}_ players");
 }
开发者ID:AndriyK,项目名称:team,代码行数:7,代码来源:CronController.php

示例11: getLocalizedRootNode

 public function getLocalizedRootNode()
 {
     $localizedRoot = 'root_' . \Yii::$app->language;
     \Yii::trace('localizedRoot: ' . $localizedRoot, __METHOD__);
     $page = Tree::findOne([Tree::ATTR_NAME_ID => $localizedRoot, Tree::ATTR_ACTIVE => Tree::ACTIVE, Tree::ATTR_VISIBLE => Tree::VISIBLE]);
     return $page;
 }
开发者ID:rochdi80tn,项目名称:yii2-pages-module,代码行数:7,代码来源:Module.php

示例12: run

 public function run()
 {
     Yii::trace(get_class($this) . '.run()');
     $controller = parent::run();
     $json = isset($this->request->json) ? $this->request->json : false;
     if ($json) {
         $offset = isset($json->offset) ? $json->offset : 0;
         $pageSize = isset($json->pageSize) ? $json->pageSize : 10;
         $keyword = isset($json->keyword) ? $json->keyword : false;
         $result = DreamNovel::model()->getNovelSearch($keyword, $offset, $pageSize);
         $ls_count = $result['count'];
         if ($keyword) {
             $is_query = DreamNovelQuery::model()->find('query=:query', array(':query' => $keyword));
             if ($is_query) {
                 $ls_count = $is_query->counts;
                 $is_query->results = $ls_count;
                 $is_query->counts = $ls_count + 1;
                 $is_query->save(false);
             } else {
                 $new_query = new DreamNovelQuery();
                 $new_query->query = $keyword;
                 $new_query->results = $result['count'];
                 $new_query->counts = 1;
                 $new_query->save(false);
             }
         }
         $this->response->counts = $ls_count;
         return $this->response->novel_list = $result['data'];
     }
     return $this->response->code = 500;
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:31,代码来源:NovelSearchAction.php

示例13: open

 /**
  * Establishes a DB connection.
  * It does nothing if a DB connection has already been established.
  * @return \Redis
  * @throws Exception if connection fails
  */
 public function open()
 {
     if ($this->_socket !== null) {
         return;
     }
     $connection = ($this->unixSocket ?: $this->hostname . ':' . $this->port) . ', database=' . $this->database;
     \Yii::trace('Opening redis DB connection: ' . $connection, __METHOD__);
     $this->_socket = new \Redis();
     if ($this->unixSocket) {
         if ($this->persist) {
             $this->_socket->pconnect($this->unixSocket, $this->port, $this->dataTimeout);
         } else {
             $this->_socket->connect($this->unixSocket, $this->port, $this->dataTimeout);
         }
     } else {
         if ($this->persist) {
             $this->_socket->pconnect($this->hostname, $this->port, $this->dataTimeout);
         } else {
             $this->_socket->connect($this->hostname, $this->port, $this->dataTimeout);
         }
     }
     if (isset($this->password)) {
         if ($this->_socket->auth($this->password) === false) {
             throw new Exception('Redis authentication failed!');
         }
     }
     $this->_socket->select($this->database);
     return $this->_socket;
 }
开发者ID:insolita,项目名称:yii2-redisman,代码行数:35,代码来源:PhpredisConnection.php

示例14: run

 public function run()
 {
     Url::remember('', $this->generateKey());
     // create temporary file
     $model = $this->_model;
     $twigCode = $model ? $model->value : null;
     $tmpFile = \Yii::getAlias('@runtime') . '/' . md5($twigCode);
     file_put_contents($tmpFile, $twigCode);
     $render = new ViewRenderer();
     try {
         $html = $render->render('renderer.twig', $tmpFile, []);
     } catch (\Twig_Error $e) {
         \Yii::$app->session->addFlash('warning', $e->getMessage());
         $html = '';
     }
     if (\Yii::$app->user->can(self::ACCESS_ROLE)) {
         $link = Html::a('prototype module', $model ? $this->generateEditRoute($model->id) : $this->generateCreateRoute());
         if ($this->enableFlash) {
             \Yii::$app->session->addFlash($html ? 'success' : 'info', "Edit contents in {$link}, key: <code>{$this->generateKey()}</code>");
         }
         if (!$model && $this->renderEmpty) {
             $html = $this->renderEmpty();
         }
     }
     \Yii::trace('Twig widget rendered', __METHOD__);
     return $html;
 }
开发者ID:dmstr,项目名称:yii2-prototype-module,代码行数:27,代码来源:TwigWidget.php

示例15: book

 public function book()
 {
     //if we don't have a hotel OR we moved to another hotel
     if ($this->getCurrent() == null || $this->getCurrent()->hotel->id != $this->hotel->getId()) {
         //if we don't have a hotel AND we moved to another hotel
         if ($this->getCurrent() != null and $this->getCurrent()->hotel->id != $this->hotel->getId()) {
             Yii::trace('Trying to restore hotelBooker from db', 'HotelBookerComponent.book');
             $this->hotelBooker = HotelBooker::model()->findByAttributes(array('hotelResultKey' => $this->hotel->getId()));
             if ($this->hotelBooker) {
                 $this->hotelBooker->setHotelBookerComponent($this);
                 Yii::trace('Done', 'HotelBookerComponent.book');
             } else {
                 Yii::trace('No such record', 'HotelBookerComponent.book');
             }
         }
         if ($this->hotelBooker == null) {
             Yii::trace('New hotelBooker to db', 'HotelBookerComponent.book');
             $this->hotelBooker = new HotelBooker();
             $this->hotelBooker->hotelResultKey = $this->hotel->getId();
             $this->hotelBooker->hotel = $this->hotel;
             $this->hotelBooker->status = 'enterCredentials';
             $this->hotelBooker->setHotelBookerComponent($this);
             $this->hotelBooker->save();
         }
     }
     //        Yii::trace(CVarDumper::dumpAsString($this->hotelBooker->getErrors()), 'HotelBookerComponent.book');
     if (!$this->hotelBooker->id) {
         $this->hotelBooker->id = $this->hotelBooker->primaryKey;
     }
     Yii::app()->user->setState('hotelResultKey', $this->hotelBooker->hotel->id);
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:31,代码来源:HotelBookerComponent.php


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