mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-63031 administration: Allow plugins to define trace storage
This will allow the use of other storage systems implemented in plugins. It also allows for disabling the built in DB based profiling, which will be useful when using an external target to not waste DB storage.
This commit is contained in:
parent
6e8235c7d3
commit
05f6ed0034
@ -380,6 +380,12 @@ $CFG->admin = 'admin';
|
||||
// profilingallowme, profilingallowall, profilinglifetime
|
||||
// $CFG->earlyprofilingenabled = true;
|
||||
//
|
||||
// Disable database storage for profile data.
|
||||
// When using an exernal plugin to store profiling data it is often
|
||||
// desirable to not store the data in the database.
|
||||
//
|
||||
// $CFG->disableprofilingtodatabase = true;
|
||||
//
|
||||
// Force displayed usernames
|
||||
// A little hack to anonymise user names for all students. If you set these
|
||||
// then all non-teachers will always see these for every person.
|
||||
|
@ -882,14 +882,29 @@ class moodle_xhprofrun implements iXHProfRuns {
|
||||
$rec = new stdClass();
|
||||
$rec->runid = $this->runid;
|
||||
$rec->url = $this->url;
|
||||
$rec->data = base64_encode(gzcompress(serialize($xhprof_data), 9));
|
||||
$rec->totalexecutiontime = $this->totalexecutiontime;
|
||||
$rec->totalcputime = $this->totalcputime;
|
||||
$rec->totalcalls = $this->totalcalls;
|
||||
$rec->totalmemory = $this->totalmemory;
|
||||
$rec->timecreated = $this->timecreated;
|
||||
|
||||
$DB->insert_record('profiling', $rec);
|
||||
// Send to database with compressed and endoded data.
|
||||
if (empty($CFG->disableprofilingtodatabase)) {
|
||||
$rec->data = base64_encode(gzcompress(serialize($xhprof_data), 9));
|
||||
$DB->insert_record('profiling', $rec);
|
||||
}
|
||||
|
||||
// Send raw data to plugins.
|
||||
$rec->data = $xhprof_data;
|
||||
|
||||
// Allow a plugin to take the trace data and process it.
|
||||
if ($pluginsfunction = get_plugins_with_function('store_profiling_data')) {
|
||||
foreach ($pluginsfunction as $plugintype => $plugins) {
|
||||
foreach ($plugins as $pluginfunction) {
|
||||
$pluginfunction($rec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUNIT_TEST) {
|
||||
// Calculate export variables.
|
||||
|
Loading…
x
Reference in New Issue
Block a user