本文整理汇总了PHP中Varien_Profiler::disable方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Profiler::disable方法的具体用法?PHP Varien_Profiler::disable怎么用?PHP Varien_Profiler::disable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Profiler
的用法示例。
在下文中一共展示了Varien_Profiler::disable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadStackLogFromProfiler
/**
* @return Aoe_Profiler_Model_Run
*/
public function loadStackLogFromProfiler()
{
Varien_Profiler::disable();
$this->stackLog = Varien_Profiler::getStackLog();
$this->_hasDataChanges = true;
return $this;
}
示例2: renderProfilerOutputToFile
/**
* Renders Magento page with profiler output to file
* Useful when profiling cli scripts
*
* @param string $title
* @return string|bool The filename where the profile data was stored or false if there was an error.
*/
public function renderProfilerOutputToFile($title = 'Aoe_Profiler')
{
// Disable further profiling
Varien_Profiler::disable();
// Render HTML
Mage::getDesign()->setArea('frontend');
Mage::app()->getLayout()->setArea('frontend');
$head = Mage::app()->getLayout()->createBlock('adminhtml/page_head');
/* @var $head Mage_Page_Block_Html_Head */
$head->setTitle($title);
$head->addJs('prototype/prototype.js');
$head->addJs('scriptaculous/builder.js');
$head->addJs('scriptaculous/effects.js');
$head->addJs('scriptaculous/dragdrop.js');
$head->addJs('scriptaculous/controls.js');
$head->addJs('scriptaculous/slider.js');
$head->addJs('mage/translate.js');
$profilerBlock = Mage::app()->getLayout()->createBlock('core/profiler');
$profilerBlock->setTitle($title);
$profilerBlock->setForceRender(TRUE);
$content = "<html><head>{$head->toHtml()}</head><body>{$profilerBlock->toHtml()}</body></html>";
// Save HTML to file
$profileDir = Mage::getStoreConfig(self::XML_PATH_PROFILE_DIR, 0) ?: Mage::getBaseDir('var') . DS . 'profile';
if (!is_dir($profileDir)) {
if (!@mkdir($profileDir, 0777)) {
Mage::log("Aoe_Profiler could not mkdir: {$profileDir}");
return FALSE;
}
}
list($ms, $time) = explode(' ', microtime());
list(, $ms) = explode('.', $ms);
$fileName = $profileDir . DS . "{$time}-{$ms}.html";
if (!@file_put_contents($fileName, $content)) {
Mage::log("Aoe_Profiler could not write profiler file: {$fileName}");
return FALSE;
}
return $fileName;
}
示例3: loadStackLogFromProfiler
/**
* @return Aoe_Profiler_Model_Stack
*/
public function loadStackLogFromProfiler()
{
Varien_Profiler::disable();
$this->stackLog = Varien_Profiler::getStackLog();
return $this;
}