$file = $storagedir . "/write_text.txt";
file_put_contents($file, $hash);
$check = file_get_contents($file);
unlink($file);
if ($check !== $hash) {
    exit("FAIL - test write to disk returned a different string ('{$hash}' vs '{$check}')");
}
# Check free disk space is sufficient.
$avail = disk_total_space($storagedir);
$free = disk_free_space($storagedir);
if ($free / $avail < 0.1) {
    exit("FAIL - less than 10% disk space free.");
}
// Check write access to sql_log
if ($mysql_log_transactions) {
    $mysql_log_dir = dirname($mysql_log_location);
    if (!is_writeable($mysql_log_dir) || file_exists($mysql_log_location) && !is_writeable($mysql_log_location)) {
        exit("FAIL - invalid \$mysql_log_location specified in config file: " . $mysql_log_location);
    }
}
// Check write access to debug_log
if ($debug_log) {
    if (!isset($debug_log_location)) {
        $debug_log_location = get_debug_log_dir() . "/debug.txt";
    }
    $debug_log_dir = dirname($debug_log_location);
    if (!is_writeable($debug_log_dir) || file_exists($debug_log_location) && !is_writeable($debug_log_location)) {
        exit("FAIL - invalid \$debug_log_location specified in config file: " . $debug_log_location);
    }
}
exit("OK");
예제 #2
0
function debug($text)
{
    # Output some text to a debug file.
    # For developers only
    global $debug_log, $debug_log_location;
    if (!$debug_log) {
        return true;
    }
    # Do not execute if switched off.
    # Cannot use the general.php: get_temp_dir() method here since general may not have been included.
    if (isset($debug_log_location)) {
        $debugdir = dirname($debug_log_location);
        if (!is_dir($debugdir)) {
            mkdir($debugdir, 0755, true);
        }
        $f = fopen($debug_log_location, "a");
    } else {
        $f = fopen(get_debug_log_dir() . "/debug.txt", "a");
    }
    fwrite($f, date("Y-m-d H:i:s") . " " . $text . "\n");
    fclose($f);
    return true;
}
예제 #3
0
function debug($text)
{
    # Output some text to a debug file.
    # For developers only
    global $debug_log;
    if (!$debug_log) {
        return true;
    }
    # Do not execute if switched off.
    # Cannot use the general.php: get_temp_dir() method here since general may not have been included.
    $f = fopen(get_debug_log_dir() . "/debug.txt", "a");
    fwrite($f, $text . "\n");
    fclose($f);
    return true;
}