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


PHP Varien_Profiler::enable方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     parent::__construct();
     Mage::setIsDeveloperMode(true);
     //always enable developer mode when run through the shell.
     if ($this->getArg('profiler') == '1') {
         Varien_Profiler::enable();
     }
 }
开发者ID:tormit,项目名称:Ho_Import,代码行数:9,代码来源:hoimport.php

示例2: enableProfiling

 public function enableProfiling(Varien_Event_Observer $event)
 {
     if (!Mage::helper('developertoolbar')->isEnabledForCurrentIp()) {
         return;
     }
     // TODO: Enable/disable based on config setting? Perhaps cookie set by frontend toolbar?
     Varien_Profiler::enable();
     // Enable query profiling on read + write connection
     $resource = Mage::getSingleton('core/resource');
     $resource->getConnection('core_write')->getProfiler()->setEnabled(true);
     $resource->getconnection('core_read')->getProfiler()->setEnabled(true);
 }
开发者ID:andyjoneski,项目名称:magento-developer-toolbar,代码行数:12,代码来源:Observer.php

示例3: setup

 /**
  * Handle the initial setup, including profiling and bootstrapping the
  * Magento environment
  *
  * @return void
  * 
  **/
 public function setup()
 {
     // We need to profiler to be enabled to get nice profiling information, duh!
     Varien_Profiler::enable();
     // Can't be bothered to look up what this does,
     // but it sounds like the kind of thing which should be in here.
     // We're developers aren't we!
     Mage::setIsDeveloperMode(true);
     // Bootstrap that environment! This does loads of
     // stuff and is pretty neccessary
     Mage::app('', 'store');
 }
开发者ID:ngreimel,项目名称:magentleman,代码行数:19,代码来源:Magentleman.php

示例4: enableProfiler

 public static function enableProfiler($status = true)
 {
     self::$_profilerEnabled = $status;
     if (!$status) {
         return;
     }
     require_once MagentoDebugger::getProjectDir() . '/lib/Varien/Profiler.php';
     //require_once(self::getDebuggerDir() . '/libs/Varien/Profiler.php');
     Varien_Profiler::enable();
     $serverKey = MagentoDebugger::getKeyFromString(isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'console');
     $time = time();
     self::$_uniqId = $time . '_' . uniqid();
     self::$_jsonLog = MagentoDebugger::getDebuggerVarDir() . '/profiler/' . $serverKey . '.' . self::$_uniqId;
     $url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : 'Not specified';
     $profilerHeader = array('time' => $time, 'url' => $url, 'key' => self::$_uniqId);
     file_put_contents(self::$_jsonLog . '.jshe', json_encode($profilerHeader));
 }
开发者ID:helirexi,项目名称:magento_debugger_backend,代码行数:17,代码来源:debugger.php

示例5: initMagento

 /**
  * Init a working magento environment
  */
 protected function initMagento()
 {
     if (version_compare(phpversion(), '5.2.0', '<') === true) {
         $this->log("Magento requires php 5.2.0 or later version", Project::MSG_ERR);
         exit;
     }
     $mageFilename = $this->getMagentoRootDir() . DS . 'app' . DS . 'Mage.php';
     if (!file_exists($mageFilename)) {
         $this->log($mageFilename . " was not found", Project::MSG_ERR);
         exit;
     }
     require_once $mageFilename;
     Varien_Profiler::enable();
     Mage::setIsDeveloperMode(true);
     ini_set('display_errors', 1);
     umask(0);
     Mage::app();
 }
开发者ID:flyw,项目名称:magento-cn,代码行数:21,代码来源:SyncWithDbTask.php

示例6: header

$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
$maintenanceFile = 'maintenance.flag';
if (!file_exists($mageFilename)) {
    if (is_dir('downloader')) {
        header("Location: downloader");
    } else {
        echo $mageFilename . " was not found";
    }
    exit;
}
if (file_exists($maintenanceFile)) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}
require_once $mageFilename;
Varien_Profiler::enable();
// if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
// }
ini_set('display_errors', 1);
umask(0);
/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
Mage::run($mageRunCode, $mageRunType);
//    $url = Mage::app()->getRequest()->getRequestString();
//    $times = Varien_Profiler::getTimers();
//    $data = array();
//    foreach ($times as $k=>$v) {
//        if (strpos($k, "EVENT") !== false) {
开发者ID:AleksNesh,项目名称:magento,代码行数:31,代码来源:index.php

示例7: profilePre

 public function profilePre($o)
 {
     $ca = $o->getEvent()->getControllerAction();
     if ($this->_canProfile($ca) === FALSE) {
         return $o;
     }
     Mage::getSingleton('core/resource')->getConnection('core_write')->getProfiler()->setEnabled(TRUE);
     Varien_Profiler::enable();
 }
开发者ID:electricjesus,项目名称:sage-pay-suite-ce,代码行数:9,代码来源:Observer.php

示例8: getMagento

 /**
  * Instantiates and sets up Magento.  By default, use the admin scopeCode so we run
  * inside of the administration context.
  *
  * @param string $scopeCode 
  * @param string $scopeId 
  * @return Mage_Core_Model_App
  * @author Nicholas Vahalik <nick@classyllama.com>
  */
 public static function getMagento($scopeCode = 'admin', $scopeId = 'store')
 {
     /**
      * Our local copy of the Magento Application Object
      * 
      * @see Mage_Core_Model_App
      */
     static $_magento;
     if (!$_magento) {
         // Did we get a directory from an environment variable?
         $wizMagentoRoot = Wiz::getMagentoRoot();
         // No dice. :-(
         if ($wizMagentoRoot === FALSE) {
             die('Please specify a Magento root directory by setting WIZ_MAGE_ROOT.' . PHP_EOL);
         }
         chdir($wizMagentoRoot);
         /**
          * Attempt to bootstrap Magento.
          */
         $compilerConfig = 'includes/config.php';
         if (file_exists($compilerConfig)) {
             include $compilerConfig;
         }
         require 'app/Mage.php';
         umask(0);
         // If someone passes a scope code via he CLI, then use that.
         foreach (array('store', 'website') as $scope) {
             if (($argScopeCode = Wiz::getWiz()->getArg($scope)) !== FALSE) {
                 // If --store is specified, but not provided, use the default.
                 $scopeCode = $argScopeCode === TRUE ? '' : $argScopeCode;
                 $scopeId = $scope;
                 break;
             }
         }
         // We only want to enable profiling if it has been turned on within the
         // configuration AND if the --profile argument was passed into the command.
         if (Mage::getStoreConfig('dev/debug/profiler') && Wiz::getWiz()->getArg('profile')) {
             Varien_Profiler::enable();
         }
         $_magento = Mage::app($scopeCode, $scopeId);
     }
     return $_magento;
 }
开发者ID:nvahalik,项目名称:Wiz,代码行数:52,代码来源:Wiz.php


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