Merge branch 'MDL-38161' of git://github.com/stronk7/moodle

This commit is contained in:
Dan Poltawski
2013-02-26 10:40:51 +08:00
8 changed files with 33 additions and 29 deletions
+5 -3
View File
@@ -1,17 +1,19 @@
Description of XHProf 0.9.2 library/viewer import into Moodle
Removed:
Removed (commit #1):
* .arcconfig - Definitions for arcanist/phabricator removed completely
* composer.json - Composer's definition removed completely
* examples - examples dir removed completely
* extension - extension dir removed completely
* package.xml - PECL package definition removed completely
* xhprof_html/docs - documentation dir removed completely
Added:
Added (commit #2 - always taken from current moodle.git master):
* index.html - prevent directory browsing on misconfigured servers
* xhprof_moodle.php - containing all the stuff needed to run the xhprof profiler within Moodle
* readme_moodle.txt - this file ;-)
Our changes: Look for "moodle" in code
Our changes: Look for "moodle" in code (commit #3 - always mimic from current moodle.git master):
* xhprof_html/index.php ----|
* xhprof_html/callgraph.php -|=> Changed to use own DB iXHProfRuns implementation (moodle_xhprofrun)
* xhprof_html/typeahead.php -|
+5 -6
View File
@@ -29,12 +29,12 @@
* @author Changhao Jiang ([email protected])
*/
// start moodle modification: moodleize this script
// Start moodle modification: moodleize this script.
require_once(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php');
require_once($CFG->libdir . '/xhprof/xhprof_moodle.php');
require_login();
require_capability('moodle/site:config', context_system::instance());
// end moodle modification
// End moodle modification.
// by default assume that xhprof_html & xhprof_lib directories
// are at the same level.
@@ -85,11 +85,10 @@ if (!array_key_exists($type, $xhprof_legal_image_types)) {
$type = $params['type'][1]; // default image type.
}
// start moodle modification: use own XHProfRuns implementation
//$xhprof_runs_impl = new XHProfRuns_Default();
require_once($GLOBALS['XHPROF_LIB_ROOT'].'/../xhprof_moodle.php');
// Start moodle modification: use own XHProfRuns implementation.
// $xhprof_runs_impl = new XHProfRuns_Default();
$xhprof_runs_impl = new moodle_xhprofrun();
// end moodle modification
// End moodle modification.
if (!empty($run)) {
// single run call graph image generation
+3 -5
View File
@@ -13,13 +13,11 @@
* limitations under the License.
*/
/* start moodle modification: add basic, smaller, font specs */
/* Start moodle modification: add basic, smaller, font specs */
body, p, table, li {
font: normal normal normal 13px/1.231 arial, helvetica, clean, sans-serif;
font: normal normal normal 13px/1.231 arial, helvetica, clean, sans-serif;
}
/* end moodle modification */
/* End moodle modification */
td.sorted {
color:#0000FF;
+5 -5
View File
@@ -31,12 +31,12 @@
// Changhao Jiang
//
// start moodle modification: moodleize this script
// Start moodle modification: moodleize this script.
require_once(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php');
require_once($CFG->libdir . '/xhprof/xhprof_moodle.php');
require_login();
require_capability('moodle/site:config', context_system::instance());
// end moodle modification
// End moodle modification.
// by default assume that xhprof_html & xhprof_lib directories
// are at the same level.
@@ -87,10 +87,10 @@ $vbbar = ' class="vbbar"';
$vrbar = ' class="vrbar"';
$vgbar = ' class="vgbar"';
// start moodle modification: use own XHProfRuns implementation
//$xhprof_runs_impl = new XHProfRuns_Default()
// Start moodle modification: use own XHProfRuns implementation.
// $xhprof_runs_impl = new XHProfRuns_Default();
$xhprof_runs_impl = new moodle_xhprofrun();
// end moodle modification
// End moodle modification.
displayXHProfReport($xhprof_runs_impl, $params, $source, $run, $wts,
$symbol, $sort, $run1, $run2);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

+5 -6
View File
@@ -21,12 +21,12 @@
* Changhao Jiang
*/
// start moodle modification: moodleize this script
// Start moodle modification: moodleize this script.
require_once(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php');
require_once($CFG->libdir . '/xhprof/xhprof_moodle.php');
require_login();
require_capability('moodle/site:config', context_system::instance());
// end moodle modification
// End moodle modification.
// by default assume that xhprof_html & xhprof_lib directories
// are at the same level.
@@ -34,10 +34,9 @@ $GLOBALS['XHPROF_LIB_ROOT'] = dirname(__FILE__) . '/../xhprof_lib';
require_once $GLOBALS['XHPROF_LIB_ROOT'].'/display/xhprof.php';
// start moodle modification: use own XHProfRuns implementation
//$xhprof_runs_impl = new XHProfRuns_Default();
require_once($GLOBALS['XHPROF_LIB_ROOT'].'/../xhprof_moodle.php');
// Start moodle modification: use own XHProfRuns implementation.
// $xhprof_runs_impl = new XHProfRuns_Default();
$xhprof_runs_impl = new moodle_xhprofrun();
// end moodle modification
// End moodle modification.
require_once $GLOBALS['XHPROF_LIB_ROOT'].'/display/typeahead_common.php';
@@ -25,6 +25,7 @@ $xhprof_legal_image_types = array(
"jpg" => 1,
"gif" => 1,
"png" => 1,
"svg" => 1, // support scalable vector graphic
"ps" => 1,
);
@@ -68,6 +69,9 @@ function xhprof_generate_mime_header($type, $length) {
case 'png':
$mime = 'image/png';
break;
case 'svg':
$mime = 'image/svg+xml'; // content type for scalable vector graphic
break;
case 'ps':
$mime = 'application/postscript';
default:
@@ -103,11 +107,11 @@ function xhprof_generate_image_by_dot($dot_script, $type) {
2 => array("pipe", "w")
);
// start moodle modification: use $CFG->pathtodot for executing this
//$cmd = " dot -T".$type;
// Start moodle modification: use $CFG->pathtodot for executing this.
// $cmd = " dot -T".$type;
global $CFG;
$cmd = (!empty($CFG->pathtodot) ? $CFG->pathtodot : 'dot') . ' -T' . $type;
// end moodle modification
// End moodle modification.
$process = proc_open($cmd, $descriptorspec, $pipes, "/tmp", array());
if (is_resource($process)) {
+3 -1
View File
@@ -149,7 +149,9 @@ class XHProfRuns_Default implements iXHProfRuns {
function list_runs() {
if (is_dir($this->dir)) {
echo "<hr/>Existing runs:\n<ul>\n";
foreach (glob("{$this->dir}/*.{$this->suffix}") as $file) {
$files = glob("{$this->dir}/*.{$this->suffix}");
usort($files, create_function('$a,$b', 'return filemtime($b) - filemtime($a);'));
foreach ($files as $file) {
list($run,$source) = explode('.', basename($file));
echo '<li><a href="' . htmlentities($_SERVER['SCRIPT_NAME'])
. '?run=' . htmlentities($run) . '&source='