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


PHP Yii::endProfile方法代码示例

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


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

示例1: actionIndex

 public function actionIndex()
 {
     $this->failIfNotAJsonRpcRequest();
     Yii::beginProfile('service.request');
     $request = $result = null;
     try {
         $request = json_decode(file_get_contents('php://input'), true);
         $this->failIfRequestIsInvalid($request);
         try {
             $class = new ReflectionClass($this->controller);
             if (!$class->hasMethod($request['method'])) {
                 throw new JsonRpcException("Method not found", -32601);
             }
             $method = $class->getMethod($request['method']);
             ob_start();
             Yii::beginProfile('service.request.action');
             $result = $method->invokeArgs($this->controller, isset($request['params']) ? $request['params'] : null);
             Yii::endProfile('service.request.action');
             $output = ob_get_clean();
             if ($output) {
                 Yii::log($output, CLogger::LEVEL_INFO, 'service.output');
             }
         } catch (Exception $e) {
             Yii::log($e, CLogger::LEVEL_ERROR, 'service.error');
             throw new JsonRpcException($e->getMessage(), -32603);
         }
         if (!empty($request['id'])) {
             echo json_encode(array('jsonrpc' => '2.0', 'id' => $request['id'], 'result' => $output));
         }
     } catch (JsonRpcException $e) {
         echo json_encode(array('jsonrpc' => '2.0', 'id' => isset($request['id']) ? $request['id'] : null, 'error' => $e->getErrorAsArray()));
     }
     Yii::endProfile('service.request');
 }
开发者ID:blindest,项目名称:Yii-CMS-2.0,代码行数:34,代码来源:JsonRpcAction.php

示例2: process

 /**
  * @param  DataEntityProvider[] $providers
  * @param  ActionData           $actionData
  * @param  array                $packed
  * @param  array                $providedKeys
  *
  * @return mixed
  */
 public static function process($providers, &$actionData, &$packed, &$providedKeys)
 {
     $result = [];
     $providedKeys = [];
     foreach ($providers as $i => $provider) {
         $profileKey = "DataProviderProcessor: {$i}";
         Yii::beginProfile($profileKey);
         //! @todo Add check for correct class names here
         /** @var DataEntityProvider $instance */
         $instance = Yii::createObject($provider);
         $providerResult = $instance->getEntities($actionData);
         $keys = [];
         array_walk($providerResult, function ($materials, $regionKey) use(&$keys) {
             $result = [];
             array_walk($materials, function ($data, $materialIndex) use(&$result) {
                 $result[$materialIndex] = array_keys($data);
             });
             $keys[$regionKey] = $result;
         });
         $providedKeys[$i] = $keys;
         $result = ArrayHelper::merge($result, $providerResult);
         $packed[$i] = $instance->pack();
         Yii::endProfile($profileKey);
     }
     return $result;
 }
开发者ID:DevGroup-ru,项目名称:dotplant-monster,代码行数:34,代码来源:DataProviderProcessor.php

示例3: getData

 public function getData()
 {
     \Yii::beginProfile('admin-menu');
     if ($this->isLoaded) {
         return (array) $this->groups;
     }
     $paths[] = \Yii::getAlias('@common/config/admin/menu.php');
     $paths[] = \Yii::getAlias('@app/config/admin/menu.php');
     foreach (\Yii::$app->extensions as $code => $data) {
         if ($data['alias']) {
             foreach ($data['alias'] as $code => $path) {
                 $adminMenuFile = $path . '/config/admin/menu.php';
                 if (file_exists($adminMenuFile)) {
                     $menuGroups = (array) (include_once $adminMenuFile);
                     $this->groups = ArrayHelper::merge($this->groups, $menuGroups);
                 }
             }
         }
     }
     foreach ($paths as $path) {
         if (file_exists($path)) {
             $menuGroups = (array) (include_once $path);
             $this->groups = ArrayHelper::merge($this->groups, $menuGroups);
         }
     }
     ArrayHelper::multisort($this->groups, 'priority');
     $this->isLoaded = true;
     \Yii::endProfile('admin-menu');
     return (array) $this->groups;
 }
开发者ID:Liv1020,项目名称:cms,代码行数:30,代码来源:Menu.php

示例4: actionUpdate

 public function actionUpdate($fid = 0, $gid = 0, $sort = '')
 {
     $timer = new CountTimer();
     $cacheToken = 'cache-update';
     Yii::beginProfile($cacheToken);
     ob_start();
     // 生成版块列表缓存
     $this->forward('forum/forumlist', false);
     // 生成帖子列表缓存
     $sortArr = array('', 'new', 'marrow', 'top');
     $fids = $this->_getFids($fid);
     $uids = $this->_getUidsByGid($gid);
     foreach ($sortArr as $sort) {
         foreach ($fids as $fid) {
             foreach ($uids as $uid) {
                 $_GET = array_merge($_GET, array('hacker_uid' => $uid, 'boardId' => $fid, 'page' => 1, 'pageSize' => 10, 'sortby' => $sort));
                 $res = $this->forward('forum/topiclist', false);
                 ob_clean();
             }
         }
     }
     ob_end_clean();
     var_dump($timer->stop());
     Yii::endProfile($cacheToken);
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:25,代码来源:CacheController.php

示例5: init

 public function init()
 {
     $this->defaultAttributes = $this->attributes;
     \Yii::beginProfile("Init: " . $this->className());
     $this->initSettings();
     \Yii::endProfile("Init: " . $this->className());
 }
开发者ID:skeeks-cms,项目名称:cms,代码行数:7,代码来源:Component.php

示例6: combineBundles

 /**
  * @param Event $event
  */
 public function combineBundles(Event $event)
 {
     if (!$this->enabled) {
         return;
     }
     $token = 'Combine bundles for page';
     \Yii::beginProfile($token, __METHOD__);
     $this->bundles = $this->owner->assetBundles;
     $this->setAssetManager($this->owner->getAssetManager());
     // Assemble monolith assets
     foreach ($this->bundles as $name => $bundle) {
         // If this is monolith bundle
         if (ArrayHelper::getValue($bundle->publishOptions, 'monolith', false)) {
             // If it already processed and have no dependency
             if (empty($bundle->depends) && ArrayHelper::getValue($bundle->publishOptions, 'accProcessed', false)) {
                 $this->registerMonolith($bundle);
             } else {
                 $this->assembleMonolith([$name => $bundle], $bundle->jsOptions, $bundle->cssOptions);
             }
         }
     }
     // Assemble rest of the assets
     $this->assembleMonolith($this->bundles);
     $this->owner->assetBundles = [];
     \Yii::endProfile($token, __METHOD__);
 }
开发者ID:tquant,项目名称:yii2-asset-combiner,代码行数:29,代码来源:AssetCombinerBehavior.php

示例7: run

    /**
     * @return string
     */
    public function run()
    {
        if (YII_ENV == 'prod') {
            try {
                \Yii::beginProfile("Run: " . $this->_token);
                $content = $this->_run();
                \Yii::endProfile("Run: " . $this->_token);
            } catch (\Exception $e) {
                $content = \Yii::t('app', 'Error widget {class}', ['class' => $this->className()]) . " (" . $this->descriptor->name . "): " . $e->getMessage();
            }
        } else {
            \Yii::beginProfile("Run: " . $this->_token);
            $content = $this->_run();
            \Yii::endProfile("Run: " . $this->_token);
        }
        \Yii::$app->cmsToolbar->initEnabled();
        if (\Yii::$app->cmsToolbar->editWidgets == Cms::BOOL_Y && \Yii::$app->cmsToolbar->enabled) {
            $pre = "";
            /*$pre = Html::tag('pre', Json::encode($this->attributes), [
                  'style' => 'display: none;'
              ]);*/
            $id = 'sx-infoblock-' . $this->getId();
            $this->getView()->registerJs(<<<JS
new sx.classes.toolbar.EditViewBlock({'id' : '{$id}'});
JS
);
            return Html::tag('div', $pre . (string) $content, ['class' => 'skeeks-cms-toolbar-edit-view-block', 'id' => $id, 'title' => \Yii::t('app', "Double-click on the block will open the settings manager"), 'data' => ['id' => $this->getId(), 'config-url' => $this->getEditUrl()]]);
        }
        return $content;
    }
开发者ID:Liv1020,项目名称:cms,代码行数:33,代码来源:Widget.php

示例8: runProfilingSampleLoop

 private function runProfilingSampleLoop()
 {
     Yii::beginProfile('dummy method');
     for ($i = 0; $i < 100; $i++) {
         $a = 1;
     }
     Yii::endProfile('dummy method');
 }
开发者ID:shiki,项目名称:yii-firephp,代码行数:8,代码来源:SiteController.php

示例9: today

 /**
  * Returns amount of today comments.
  * 
  * @return int Number of today comments.
  * @since 0.1.0
  */
 public function today()
 {
     $token = 'comment.today';
     \Yii::beginProfile($token);
     $dateTime = new \DateTime();
     $dateTime->sub(new \DateInterval('P1D'));
     $amount = (int) $this->count('created >= :today', array(':today' => $dateTime->format(\DateTime::ISO8601)));
     \Yii::endProfile($token);
     return $amount;
 }
开发者ID:DavBfr,项目名称:BlogMVC,代码行数:16,代码来源:Comment.php

示例10: tryToRunMethod

 /**
  * @return mixed
  * @throws Exception
  */
 protected function tryToRunMethod()
 {
     $method = $this->getHandler();
     Yii::beginProfile('service.request.action');
     $output = $this->runMethod($method, $this->getParams($method));
     Yii::endProfile('service.request.action');
     Yii::info($method, 'service.output');
     Yii::info($output, 'service.output');
     return $output;
 }
开发者ID:nizsheanez,项目名称:yii2-json-rpc,代码行数:14,代码来源:Action.php

示例11: actionIndex

 public function actionIndex()
 {
     Yii::beginProfile('wishlist');
     $criteria = PropertyWishlistApi::getCriteriaObjectForUser(Yii::app()->user->id);
     $count = Property::model()->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = Yii::app()->params['resultsPerPage'];
     $pages->applyLimit($criteria);
     $properties = PropertyWishlistApi::searchWithCriteria($criteria);
     //	$projects = ProjectWishlistApi::getWishlistProjectsByUserId(Yii::app()->user->id);
     $this->render('index', array('properties' => $properties, 'count' => $count, 'pages' => $pages));
     Yii::endProfile('wishlist');
 }
开发者ID:romeo14,项目名称:wallfeet,代码行数:13,代码来源:WishlistController.php

示例12: actionIndex

 public function actionIndex()
 {
     Yii::trace('example trace message', 'example');
     Yii::log('info', CLogger::LEVEL_INFO, 'example');
     Yii::log('error', CLogger::LEVEL_ERROR, 'example');
     Yii::log('trace', CLogger::LEVEL_TRACE, 'example');
     Yii::log('warning', CLogger::LEVEL_WARNING, 'example');
     Yii::beginProfile('preg_replace', 'example');
     for ($i = 0; $i < 10000; $i++) {
         preg_replace('~^[ a-z]+~', '', 'test it');
     }
     Yii::endProfile('preg_replace', 'example');
     echo 'done';
 }
开发者ID:moohwaan,项目名称:yii-application-cookbook-2nd-edition-code,代码行数:14,代码来源:LogController.php

示例13: actionView

 public function actionView($id)
 {
     Yii::beginProfile('message_view');
     $message = PmbApi::getMessageById($id);
     if (!$message) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     if ($message->from_user_id != Yii::app()->user->id && $message->to_user_id != Yii::app()->user->id) {
         $this->redirect('/messages');
     }
     $read = PmbApi::markRead(array($id));
     $unread = PmbApi::getUnreadInboxCount(Yii::app()->user->id);
     $this->render('view', array('message' => $message, 'unread' => $unread, 'id' => $id));
     Yii::endProfile('message_view');
 }
开发者ID:romeo14,项目名称:wallfeet,代码行数:15,代码来源:PmbController.php

示例14: init

 public function init()
 {
     parent::init();
     if ($this->module) {
         //            $this->migrateUp();
         //            $this->loadClassMap();
         //            $this->loadControllerMap();
         //            $this->loadViewPathMap();
         //            $this->loadCustomConfig();
         foreach (['loadClassMap', 'loadCustomConfig', 'migrateUp'] as $func) {
             \Yii::beginProfile(get_called_class() . '->' . $func, __METHOD__);
             $this->{$func}();
             \Yii::endProfile(get_called_class() . '->' . $func, __METHOD__);
         }
     }
 }
开发者ID:yinheark,项目名称:yincart2,代码行数:16,代码来源:Module.php

示例15: init

 public function init()
 {
     Yii::beginProfile(__CLASS__);
     $path = Yii::getPathOfAlias('app.widgets.NewsSocials.libs.share42');
     $assetsUrl = app()->getAssetManager()->publish($path, FALSE, -1, YII_DEBUG);
     js($assetsUrl . '/share42.js', CClientScript::POS_END);
     // Обрезаю description
     if (!empty($this->params['data-description'])) {
         $this->params['data-description'] = strip_tags($this->params['data-description']);
         if (mb_strlen($this->params['data-description']) > $this->charLimit) {
             $this->params['data-description'] = characterLimiter($this->params['data-description'], $this->charLimit, ' ...');
         }
     }
     echo CHtml::openTag('div', $this->params + array('class' => 'share42init')) . CHtml::closeTag('div');
     Yii::endProfile(__CLASS__);
 }
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:16,代码来源:NewsSocials.php


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