MDL-71705 libraries: Moodle customizations.

This commit is contained in:
Ilya Tregubov 2021-12-09 14:19:33 +02:00
parent 6f069f5272
commit 5e11de3af9
7 changed files with 51 additions and 7 deletions

View File

@ -158,7 +158,7 @@
<location>xhprof</location>
<name>XHProf</name>
<license>Apache</license>
<version>2.2.3</version>
<version>2.3.5</version>
<licenseversion>2.0</licenseversion>
</library>
<library>

View File

@ -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;

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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';

View File

@ -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)) {