Simple Linux Panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mdserver-web/plugins/php-apt/conf/app_start.php

54 lines
1.3 KiB

11 months ago
<?php
4 months ago
if (isset($_GET['mw_opcache_reset']) && $_GET['mw_opcache_reset'] == 'ok') {
opcache_reset();
11 months ago
}
define('XHProf_Name', 'mdd');
/**
* xhprof 配置,便于调试快速找到问题
*/
function app_xhprof_start() {
4 months ago
$root = '{$ROOT_PATH}';
$lib = $root . '/server/xhprof/xhprof_lib/utils/xhprof_lib.php';
if (file_exists($lib)) {
include_once $lib;
include_once $root . '/server/xhprof/xhprof_lib/utils/xhprof_runs.php';
xhprof_enable();
}
11 months ago
}
function app_xhprof_end() {
4 months ago
$root = '{$ROOT_PATH}';
$lib = $root . '/server/xhprof';
if (! file_exists($lib)) {
return;
}
11 months ago
4 months ago
//保存xhprof数据
$xhprof_data = xhprof_disable();
$xhprof_runs = new XHProfRuns_Default();
11 months ago
4 months ago
$run_id = $xhprof_runs->save_run($xhprof_data, 'xhprof_foo');
11 months ago
4 months ago
$profiler_url = sprintf('http://{$LOCAL_IP}:5858/index.php?run=%s&source=xhprof_foo', $run_id);
echo "<script language='javascript'>window.open('{$profiler_url}')</script>";
// echo '<a href="' . $profiler_url . '" target="_blank">Profiler output</a>';
11 months ago
}
if (extension_loaded('xhprof')
4 months ago
&& isset($_GET[XHProf_Name]) && $_GET[XHProf_Name] == 'ok' &&
(! in_array($_SERVER['SCRIPT_NAME'], ['/xhprof_html/callgraph.php',
'/xhprof_html/index.php']))) {
app_xhprof_start();
include_once $_SERVER['SCRIPT_FILENAME'];
app_xhprof_end();
exit;
11 months ago
}
?>