兼容php5.2

pull/109/head
midoks 5 years ago
parent d988286eba
commit 9110b52b65
  1. 15
      plugins/xhprof/lib/xhprof_lib/utils/xhprof_runs.php

@ -55,7 +55,6 @@ interface iXHProfRuns {
public function save_run($xhprof_data, $type, $run_id = null);
}
/**
* XHProfRuns_Default is the default implementation of the
* iXHProfRuns interface for saving/fetching XHProf runs.
@ -97,10 +96,10 @@ class XHProfRuns_Default implements iXHProfRuns {
$dir = sys_get_temp_dir();
xhprof_error("Warning: Must specify directory location for XHProf runs. ".
xhprof_error("Warning: Must specify directory location for XHProf runs. " .
"Trying {$dir} as default. You can either pass the " .
"directory location as an argument to the constructor ".
"for XHProfRuns_Default() or set xhprof.output_dir ".
"directory location as an argument to the constructor " .
"for XHProfRuns_Default() or set xhprof.output_dir " .
"ini param.");
}
}
@ -145,13 +144,17 @@ class XHProfRuns_Default implements iXHProfRuns {
return $run_id;
}
function list_runs_callback($a, $b) {
return filemtime($b) - filemtime($a);
}
function list_runs() {
if (is_dir($this->dir)) {
echo "<hr/>Existing runs:\n<ul>\n";
$files = glob("{$this->dir}/*.{$this->suffix}");
usort($files, function($a, $b) {return filemtime($b) - filemtime($a);});
usort($files, 'list_runs_callback');
foreach ($files as $file) {
list($run,$source) = explode('.', basename($file));
list($run, $source) = explode('.', basename($file));
echo '<li><a href="' . htmlentities($_SERVER['SCRIPT_NAME'])
. '?run=' . htmlentities($run) . '&source='
. htmlentities($source) . '">'

Loading…
Cancel
Save