public static function OnPageStart() { if(!defined("PERFMON_STOP")) { $end_time = COption::GetOptionInt("perfmon", "end_time"); if(time() > $end_time) { CPerfomanceKeeper::SetActive(false); if(COption::GetOptionString("perfmon", "total_mark_value", "") == "measure"); COption::SetOptionString("perfmon", "total_mark_value", "calc"); } else { global $DB, $APPLICATION; // define("PERFMON_STARTED", $DB->ShowSqlStat); $DB->ShowSqlStat = true; $APPLICATION->ShowIncludeStat = true; global $perfmonErrors; $perfmonErrors = array(); if(COption::GetOptionString("perfmon", "warning_log") === "Y") set_error_handler("perfmonErrorHandler"); } } }
public static function OnPageStart() { if (!defined("PERFMON_STOP")) { $end_time = COption::GetOptionInt("perfmon", "end_time"); if (time() > $end_time) { CPerfomanceKeeper::SetActive(false); if (COption::GetOptionString("perfmon", "total_mark_value", "") == "measure") { } COption::SetOptionString("perfmon", "total_mark_value", "calc"); } else { self::setDebugModeOn(); global $perfmonErrors; $perfmonErrors = array(); if (COption::GetOptionString("perfmon", "warning_log") === "Y") { set_error_handler("perfmonErrorHandler"); } register_shutdown_function(array("CPerfomanceKeeper", "writeToDatabase")); } } }
$arAllOptions = array(array("max_display_url", GetMessage("PERFMON_OPTIONS_MAX_DISPLAY_URL"), array("text", 6)), array("warning_log", GetMessage("PERFMON_OPTIONS_WARNING_LOG"), array("checkbox")), array("cache_log", GetMessage("PERFMON_OPTIONS_CACHE_LOG"), array("checkbox")), array("sql_log", GetMessage("PERFMON_OPTIONS_SQL_LOG"), array("checkbox")), array("sql_backtrace", GetMessage("PERFMON_OPTIONS_SQL_BACKTRACE"), array("checkbox")), array("slow_sql_log", GetMessage("PERFMON_OPTIONS_SLOW_SQL_LOG"), array("checkbox"), GetMessage("PERFMON_OPTIONS_SLOW_SQL_NOTE")), array("slow_sql_time", GetMessage("PERFMON_OPTIONS_SLOW_SQL_TIME"), array("text", 6))); $aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("MAIN_TAB_SET"), "ICON" => "perfmon_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_SET")), array("DIV" => "edit2", "TAB" => GetMessage("MAIN_TAB_RIGHTS"), "ICON" => "perfmon_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_RIGHTS"))); $tabControl = new CAdminTabControl("tabControl", $aTabs); CModule::IncludeModule($module_id); if ($REQUEST_METHOD == "POST" && strlen($Update . $Apply . $RestoreDefaults) > 0 && $RIGHT == "W" && check_bitrix_sessid()) { require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/perfmon/prolog.php"; if ($_REQUEST["clear_data"] === "y") { CPerfomanceComponent::Clear(); CPerfomanceSQL::Clear(); CPerfomanceHit::Clear(); CPerfomanceError::Clear(); CPerfomanceCache::Clear(); } if (array_key_exists("ACTIVE", $_REQUEST)) { $ACTIVE = intval($_REQUEST["ACTIVE"]); CPerfomanceKeeper::SetActive($ACTIVE > 0, time() + $ACTIVE); } if (strlen($RestoreDefaults) > 0) { COption::RemoveOption("perfmon"); } else { foreach ($arAllOptions as $arOption) { $name = $arOption[0]; $val = $_REQUEST[$name]; if ($arOption[2][0] == "checkbox" && $val != "Y") { $val = "N"; } COption::SetOptionString("perfmon", $name, $val, $arOption[1]); } } ob_start(); $Update = $Update . $Apply;
$RIGHT = $APPLICATION->GetGroupRight("perfmon"); if (!$USER->IsAdmin() || $RIGHT < "W") { $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); } if ($_SERVER["REQUEST_METHOD"] == "POST" && $_REQUEST["activity"] != "" && check_bitrix_sessid()) { if (array_key_exists("ACTIVE", $_REQUEST)) { $ACTIVE = intval($_REQUEST["ACTIVE"]); CPerfomanceKeeper::SetActive($ACTIVE > 0, time() + $ACTIVE); } LocalRedirect("/bitrix/admin/perfmon_activity.php?lang=" . LANGU); } $APPLICATION->SetTitle(GetMessage("PERFMON_ACTIVITY_TITLE")); require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php"; $interval = COption::GetOptionInt("perfmon", "end_time") - time(); if ($interval <= 0) { CPerfomanceKeeper::SetActive(false); $ACTIVE = false; } else { $ACTIVE = CPerfomanceKeeper::IsActive(); } ?> <form name="clear_form" method="post" action="<?php echo $APPLICATION->GetCurPage(); ?> "> <?php echo bitrix_sessid_post(); ?> <input type="hidden" name="lang" value="<?php echo LANGUAGE_ID;