| 201 | | function out($text) { |
|---|
| 202 | | //echo $text."\n"; |
|---|
| 203 | | } |
|---|
| 204 | | |
|---|
| 205 | | function outn($text) { |
|---|
| 206 | | //echo $text; |
|---|
| 207 | | } |
|---|
| 208 | | |
|---|
| 209 | | function error($text) { |
|---|
| 210 | | echo "[ERROR] ".$text."\n"; |
|---|
| 211 | | } |
|---|
| 212 | | |
|---|
| 213 | | function fatal($text, $extended_text="", $type="FATAL") { |
|---|
| 214 | | global $db; |
|---|
| 215 | | |
|---|
| 216 | | echo "[$type] ".$text." ".$extended_text."\n"; |
|---|
| 217 | | |
|---|
| 218 | | if(!DB::isError($db)) { |
|---|
| 219 | | $nt = notifications::create($db); |
|---|
| 220 | | $nt->add_critical('cron_manager', $type, $text, $extended_text); |
|---|
| 221 | | } |
|---|
| 222 | | |
|---|
| 223 | | exit(1); |
|---|
| 224 | | } |
|---|
| 225 | | |
|---|
| 226 | | function debug($text) { |
|---|
| 227 | | global $debug; |
|---|
| 228 | | |
|---|
| 229 | | if ($debug) echo "[DEBUG-preDB] ".$text."\n"; |
|---|
| | 201 | if (!function_exists('out')) { |
|---|
| | 202 | function out($text) { |
|---|
| | 203 | //echo $text."\n"; |
|---|
| | 204 | } |
|---|
| | 205 | } |
|---|
| | 206 | |
|---|
| | 207 | if (!function_exists('outn')) { |
|---|
| | 208 | function outn($text) { |
|---|
| | 209 | //echo $text; |
|---|
| | 210 | } |
|---|
| | 211 | } |
|---|
| | 212 | |
|---|
| | 213 | if (!function_exists('error')) { |
|---|
| | 214 | function error($text) { |
|---|
| | 215 | echo "[ERROR] ".$text."\n"; |
|---|
| | 216 | } |
|---|
| | 217 | } |
|---|
| | 218 | |
|---|
| | 219 | if (!function_exists('fatal')) { |
|---|
| | 220 | function fatal($text, $extended_text="", $type="FATAL") { |
|---|
| | 221 | global $db; |
|---|
| | 222 | |
|---|
| | 223 | echo "[$type] ".$text." ".$extended_text."\n"; |
|---|
| | 224 | |
|---|
| | 225 | if(!DB::isError($db)) { |
|---|
| | 226 | $nt = notifications::create($db); |
|---|
| | 227 | $nt->add_critical('cron_manager', $type, $text, $extended_text); |
|---|
| | 228 | } |
|---|
| | 229 | |
|---|
| | 230 | exit(1); |
|---|
| | 231 | } |
|---|
| | 232 | } |
|---|
| | 233 | |
|---|
| | 234 | if (!function_exists('debug')) { |
|---|
| | 235 | function debug($text) { |
|---|
| | 236 | global $debug; |
|---|
| | 237 | |
|---|
| | 238 | if ($debug) echo "[DEBUG-preDB] ".$text."\n"; |
|---|
| | 239 | } |
|---|