Skip to content
Snippets Groups Projects
Commit a5ea92e2 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

hotline #128992 : enlarge your performances

parent d1c65f6a
Branches
Tags
2 merge requests!3903Hotline,!3896hotline #128992 : enlarge your performances
Pipeline #12686 passed with stage
in 52 minutes and 58 seconds
- ticket #128992 : Amélioration des performances
\ No newline at end of file
......@@ -20,30 +20,29 @@
*/
class ZendAfi_Controller_Plugin_XHProfile extends Zend_Controller_Plugin_Abstract {
const WITHOUT_AUTH_KEY = 'xhprof_without_authentication';
protected
$_without_authentication = false,
$_enabled = false;
public function setRootUrl($url) {
$this->_root_url = $url;
return $this;
public function __construct($config) {
if ($config && null !== $config->get(static::WITHOUT_AUTH_KEY))
$this->_without_authentication = true;
}
public function preDispatch(Zend_Controller_Request_Abstract $request) {
if (! (Class_Users::isCurrentUserSuperAdmin() || ZendAfi_Auth_Others::getInstance()->isSuperAdminLogged()))
public function preDispatch(Zend_Controller_Request_Abstract $request) {
if (!$this->_canProfile($request))
return;
if (function_exists('xhprof_enable')) {
$view=new ZendAfi_Controller_Action_Helper_View();
$view = new ZendAfi_Controller_Action_Helper_View();
Class_ScriptLoader::getInstance()
->addJQueryReady('if($("a.hx_prof").length) return false; $("<li><a class=\"hx_prof\" href=\"#\">Profile XHProf</a></li>")
Class_ScriptLoader::getInstance()
->addJQueryReady('if($("a.hx_prof").length) return false; $("<li><a class=\"hx_prof\" href=\"#\">Profile XHProf</a></li>")
.attr("onclick", "window.open(\''.$view->url(["xhprof" => 1]).'\', \'_blank\')")
.appendTo(\'body .menu_admin_front .dev_tools\')');
}
if (!$request->getParam('xhprof', false))
return;
$this->_enabled = true;
xhprof_enable();
......@@ -54,9 +53,6 @@ class ZendAfi_Controller_Plugin_XHProfile extends Zend_Controller_Plugin_Abstrac
if (!$this->_enabled)
return;
$view=new ZendAfi_Controller_Action_Helper_View();
$xhprof_data = xhprof_disable();
require_once "xhprof/xhprof_lib/utils/xhprof_lib.php";
require_once "xhprof/xhprof_lib/utils/xhprof_runs.php";
......@@ -67,6 +63,12 @@ class ZendAfi_Controller_Plugin_XHProfile extends Zend_Controller_Plugin_Abstrac
->setRedirect(BASE_URL."/xhprof/xhprof_html/index.php?run={$run_id}&source=xhprof_testing\n")
->clearBody();
}
}
?>
\ No newline at end of file
protected function _canProfile($request) {
return ($this->_without_authentication
|| ZendAfi_Auth_Others::getInstance()->isSuperAdminLogged())
&& function_exists('xhprof_enable')
&& $request->getParam('xhprof', false);
}
}
......@@ -334,6 +334,7 @@ class Bokeh_Engine {
->registerPlugin(new ZendAfi_Controller_Plugin_PhpParser())
->registerPlugin(new ZendAfi_Controller_Plugin_FeaturesTracking())
->registerPlugin(new ZendAfi_Controller_Plugin_LastSearch())
->registerPlugin(new ZendAfi_Controller_Plugin_XHProfile($this->_config))
->setParam('useDefaultControllerAlways', false);
}
......@@ -344,11 +345,6 @@ class Bokeh_Engine {
->setBaseURL(BASE_URL);
$this->setupRoutes($this->_front_controller, $this->_config);
if (! (Class_Users::isCurrentUserSuperAdmin() || ZendAfi_Auth_Others::getInstance()->isSuperAdminLogged()))
return $this;
$this->_front_controller->registerPlugin(new ZendAfi_Controller_Plugin_XHProfile());
return $this;
}
......
Subproject commit aad764a8e1f92d102da4e194ea564c398d20d7be
Subproject commit de6da8ef5032cf1c9dc2876a955c7ec91c894328
......@@ -544,7 +544,7 @@ class CatalogueTestOAISpec extends ModelTestCase {
class CatalogueGetNoticesByPreferencesNotRandomTest extends ModelTestCase {
protected $_cache_key = '872ab9cb2f42608b8678ef562af208ae';
protected $_cache_key = '5be5b882d00792a8bcf7299b575bb175';
public function setUp() {
parent::setUp();
......
......@@ -254,7 +254,7 @@ class SitoViewHelperCachedTest extends SitoViewHelperTestCase {
/** @test */
public function cacheShouldBeUse() {
$value = (new Storm_Cache())->getCache()->load('faf677dfb74eb163c47d535bd09a43f3');
$value = (new Storm_Cache())->getCache()->load('2834982d0d27025a7755ea93669e9537');
$this->assertNotEquals(false, $value);
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment