Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
mailout-debugger.php File Reference

Print an error to STDOUT and exit with a non-zero code. More...

Functions

 mdie ($msg='', $errorcode=1)
 

Variables

 $fh
 
 $stdin = fopen('php://stdin', 'r')
 
if(!file_exists(__DIR__.'/mailout-debugger.enable')) $tmpdir =sys_get_temp_dir()
 
if(isset( $_SERVER[ 'REMOTE_ADDR'])) if(isset($_ENV['TMPDIR']) &&is_dir($_ENV['TMPDIR'])) $tmpfile = $tmpdir . '/moodle-mailout.log'
 

Detailed Description

Print an error to STDOUT and exit with a non-zero code.

For commandline scripts. Default errorcode is 1.

Very useful for perl-like error-handling:

do_something() or mdie("Something went wrong");

Parameters
string$msgError message
integer$errorcodeError code to emit

Variable Documentation

◆ $fh

$fh
Initial value:
= fopen($tmpfile, 'a+', false)
or mdie("Error openning $tmpfile on append\n")