Check requrements
This commit is contained in:
parent
abb80b89af
commit
1319b4349a
24
record.php
24
record.php
@ -1,13 +1,6 @@
|
|||||||
#!/usr/bin/php
|
#!/usr/bin/php
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Settings
|
|
||||||
if (!file_exists(__DIR__.'/config.json'))
|
|
||||||
logger(1, 'Config file not found', 1, true);
|
|
||||||
|
|
||||||
if (!$_set = @json_decode(@file_get_contents(__DIR__.'/config.json')))
|
|
||||||
logger(1, 'Unable to load or parse configuration file', 1, true);
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------- */
|
/* -------------------------------------------------------------- */
|
||||||
|
|
||||||
// Basic functions
|
// Basic functions
|
||||||
@ -21,10 +14,13 @@ function logger($tabs = 1, $txt, $lvl = 1, $exit = false)
|
|||||||
exit;
|
exit;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function is_dir_empty($dir) {
|
|
||||||
|
function is_dir_empty($dir)
|
||||||
|
{
|
||||||
if (!is_readable($dir)) return NULL;
|
if (!is_readable($dir)) return NULL;
|
||||||
return (count(scandir($dir)) == 2);
|
return (count(scandir($dir)) == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function notify($sub, $msg, $loglevel = 1)
|
function notify($sub, $msg, $loglevel = 1)
|
||||||
{
|
{
|
||||||
global $_set;
|
global $_set;
|
||||||
@ -35,6 +31,18 @@ function notify($sub, $msg, $loglevel = 1)
|
|||||||
logger($loglevel, 'Unable to send notification E-mail');
|
logger($loglevel, 'Unable to send notification E-mail');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check requirements
|
||||||
|
if (!function_exists('curl_init'))
|
||||||
|
logger(1, 'cURL is required but not available', 1, true);
|
||||||
|
if (!function_exists('json_decode'))
|
||||||
|
logger(1, 'json_decode is required but not available', 1, true);
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
if (!file_exists(__DIR__.'/config.json'))
|
||||||
|
logger(1, 'Config file not found', 1, true);
|
||||||
|
if (!$_set = @json_decode(@file_get_contents(__DIR__.'/config.json')))
|
||||||
|
logger(1, 'Unable to load or parse configuration file', 1, true);
|
||||||
|
|
||||||
// Loop indefinitely
|
// Loop indefinitely
|
||||||
while (true) :
|
while (true) :
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user