mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
Merge branch 'MDL-30966-print-object_22_STABLE' of git://github.com/mudrd8mz/moodle into MOODLE_22_STABLE
This commit is contained in:
commit
f35cacdc83
1 changed files with 13 additions and 6 deletions
|
@ -1957,19 +1957,26 @@ function count_login_failures($mode, $username, $lastlogin) {
|
||||||
/// GENERAL HELPFUL THINGS ///////////////////////////////////
|
/// GENERAL HELPFUL THINGS ///////////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dump a given object's information in a PRE block.
|
* Dumps a given object's information for debugging purposes
|
||||||
*
|
*
|
||||||
* Mostly just used for debugging.
|
* When used in a CLI script, the object's information is written to the standard
|
||||||
|
* error output stream. When used in a web script, the object is dumped to a
|
||||||
|
* pre-formatted block with the "notifytiny" CSS class.
|
||||||
*
|
*
|
||||||
* @param mixed $object The data to be printed
|
* @param mixed $object The data to be printed
|
||||||
* @return void OUtput is echo'd
|
* @return void output is echo'd
|
||||||
*/
|
*/
|
||||||
function print_object($object) {
|
function print_object($object) {
|
||||||
echo '<pre class="notifytiny">';
|
|
||||||
// we may need a lot of memory here
|
// we may need a lot of memory here
|
||||||
raise_memory_limit(MEMORY_EXTRA);
|
raise_memory_limit(MEMORY_EXTRA);
|
||||||
echo s(print_r($object, true));
|
|
||||||
echo '</pre>';
|
if (CLI_SCRIPT) {
|
||||||
|
fwrite(STDERR, print_r($object, true));
|
||||||
|
fwrite(STDERR, PHP_EOL);
|
||||||
|
} else {
|
||||||
|
echo html_writer::tag('pre', s(print_r($object, true)), array('class' => 'notifytiny'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue