diff --git a/lib/thirdpartylibs.xml b/lib/thirdpartylibs.xml index f325724bcc1..7f9d7d3a24b 100644 --- a/lib/thirdpartylibs.xml +++ b/lib/thirdpartylibs.xml @@ -158,7 +158,7 @@ xhprof XHProf Apache - 2.2.3 + 2.3.5 2.0 diff --git a/lib/xhprof/readme_moodle.txt b/lib/xhprof/readme_moodle.txt index 16e0f575f22..5d2fba90e5b 100644 --- a/lib/xhprof/readme_moodle.txt +++ b/lib/xhprof/readme_moodle.txt @@ -1,4 +1,4 @@ -Description of XHProf 2.2.3 library/viewer import into Moodle +Description of XHProf 2.3.5 library/viewer import into Moodle Removed (commit #1): * examples - examples dir removed completely @@ -40,4 +40,4 @@ TODO: 20201012 - MDL-67081 - Brendan Heywood (brendanheywood): Support selective profiles from CLI 20201210 - MDL-70297 - Ilya Tregubov (ilyatregubov): Upgrade to 2.2.3 release; 20210209 - MDL-70525 - Tomo Tsuyuki (tomotsuyuki): Allow huge number of values - +20211209 - MDL-71705 - Ilya Tregubov (ilyatregubov): Upgrade to 2.3.5 release; diff --git a/lib/xhprof/xhprof_html/callgraph.php b/lib/xhprof/xhprof_html/callgraph.php index 22d1c2f261f..5076eab9ef5 100644 --- a/lib/xhprof/xhprof_html/callgraph.php +++ b/lib/xhprof/xhprof_html/callgraph.php @@ -29,6 +29,15 @@ * @author Changhao Jiang (cjiang@facebook.com) */ +// 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()); +raise_memory_limit(MEMORY_HUGE); +\core\session\manager::write_close(); +// End moodle modification. + // by default assume that xhprof_html & xhprof_lib directories // are at the same level. $GLOBALS['XHPROF_LIB_ROOT'] = dirname(__FILE__) . '/../xhprof_lib'; @@ -78,7 +87,10 @@ if (!array_key_exists($type, $xhprof_legal_image_types)) { $type = $params['type'][1]; // default image type. } -$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. if (!empty($run)) { // single run call graph image generation diff --git a/lib/xhprof/xhprof_html/css/xhprof.css b/lib/xhprof/xhprof_html/css/xhprof.css index c3abf8622b7..250b9903fc3 100644 --- a/lib/xhprof/xhprof_html/css/xhprof.css +++ b/lib/xhprof/xhprof_html/css/xhprof.css @@ -13,6 +13,12 @@ * limitations under the License. */ +/* Start moodle modification: add basic, smaller, font specs */ +body, p, table, li { + font: normal normal normal 13px/1.231 arial, helvetica, clean, sans-serif; +} +/* End moodle modification */ + td.sorted { color:#0000FF; } diff --git a/lib/xhprof/xhprof_html/index.php b/lib/xhprof/xhprof_html/index.php index f21d32fd5d0..80e7821fe92 100644 --- a/lib/xhprof/xhprof_html/index.php +++ b/lib/xhprof/xhprof_html/index.php @@ -31,6 +31,15 @@ // Changhao Jiang // +// 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()); +raise_memory_limit(MEMORY_HUGE); +\core\session\manager::write_close(); +// End moodle modification. + // by default assume that xhprof_html & xhprof_lib directories // are at the same level. $GLOBALS['XHPROF_LIB_ROOT'] = dirname(__FILE__) . '/../xhprof_lib'; @@ -80,7 +89,10 @@ $vbbar = ' class="vbbar"'; $vrbar = ' class="vrbar"'; $vgbar = ' class="vgbar"'; -$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. displayXHProfReport($xhprof_runs_impl, $params, $source, $run, $wts, $symbol, $sort, $run1, $run2); diff --git a/lib/xhprof/xhprof_html/typeahead.php b/lib/xhprof/xhprof_html/typeahead.php index ba98e0c383d..54022257430 100644 --- a/lib/xhprof/xhprof_html/typeahead.php +++ b/lib/xhprof/xhprof_html/typeahead.php @@ -21,12 +21,22 @@ * Changhao Jiang */ +// 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()); +\core\session\manager::write_close(); +// End moodle modification. + // by default assume that xhprof_html & xhprof_lib directories // are at the same level. $GLOBALS['XHPROF_LIB_ROOT'] = dirname(__FILE__) . '/../xhprof_lib'; require_once $GLOBALS['XHPROF_LIB_ROOT'].'/display/xhprof.php'; -$xhprof_runs_impl = new XHProfRuns_Default(); +// Start moodle modification: use own XHProfRuns implementation. +$xhprof_runs_impl = new moodle_xhprofrun(); +// End moodle modification. require_once $GLOBALS['XHPROF_LIB_ROOT'].'/display/typeahead_common.php'; diff --git a/lib/xhprof/xhprof_lib/utils/callgraph_utils.php b/lib/xhprof/xhprof_lib/utils/callgraph_utils.php index 90f4c31a202..3a70aa0b06e 100644 --- a/lib/xhprof/xhprof_lib/utils/callgraph_utils.php +++ b/lib/xhprof/xhprof_lib/utils/callgraph_utils.php @@ -107,7 +107,11 @@ function xhprof_generate_image_by_dot($dot_script, $type) { 2 => array("pipe", "w") ); - $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. $process = proc_open( $cmd, $descriptorspec, $pipes, sys_get_temp_dir(), array( 'PATH' => getenv( 'PATH' ) ) ); if (is_resource($process)) {