Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Functions | Variables
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")
mdie
mdie($msg='', $errorcode=1)
Print an error to STDOUT and exit with a non-zero code.
Definition: weblib.php:2776