当前位置: 首页>>代码示例>>PHP>>正文


PHP logfile函数代码示例

本文整理汇总了PHP中logfile函数的典型用法代码示例。如果您正苦于以下问题:PHP logfile函数的具体用法?PHP logfile怎么用?PHP logfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了logfile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: exec_query

/**
 * Execute an sql query in the database. The correct database connection
 * will be chosen and the query will be logged with the success status.
 * 
 * @param $query query to execute as string
 */
function exec_query($query)
{
    global $conn, $pdo_conn, $errors, $db_layer;
    $success = false;
    if ($db_layer == "pdo") {
        if (is_object($pdo_conn)) {
            $pdo_query = $pdo_conn->prepare($query);
            $success = $pdo_query->execute(array());
            $errorInfo = serialize($pdo_query->errorInfo());
        } else {
            $errorInfo = "No connection object.";
        }
    } else {
        if (is_object($conn)) {
            $success = $conn->Query($query);
            $errorInfo = serialize($conn->Error());
        } else {
            $errorInfo = "No connection object.";
        }
    }
    logfile($query);
    if (!$success) {
        logfile($errorInfo);
        $errors = true;
    }
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:32,代码来源:install.php

示例2: error_log_print

function error_log_print($errno, $errstr, $errfile, $errline)
{
    $backtrace = (new Exception())->getTraceAsString();
    $err = "Error #{$errno}: '{$errstr}' at line {$errline} of file {$errfile}. Debug Backtrace:\r\n{$backtrace}\r\n";
    logfile('err', $err);
    //Printing out
    global $DEBUG_MODE;
    if ($DEBUG_MODE) {
        echo "An error occurred:<br><pre>{$err}</pre><br>(logged as above)";
    } else {
        echo getErrPage();
    }
}
开发者ID:t-web,项目名称:doeqs_new,代码行数:13,代码来源:errors.php

示例3: exec_query

/**
 * Execute an sql query in the database. The correct database connection
 * will be chosen and the query will be logged with the success status.
 * 
 * @param $query query to execute as string
 */
function exec_query($query)
{
    global $conn, $pdo_conn, $kga, $errors, $executed_queries;
    $success = false;
    if ($kga['server_conn'] == "pdo") {
        if (is_object($pdo_conn)) {
            $pdo_query = $pdo_conn->prepare($query);
            $success = $pdo_query->execute(array());
        } else {
            $errorInfo = "No connection object.";
        }
    } else {
        if (is_object($conn)) {
            $success = $conn->Query($query);
        } else {
            $errorInfo = "No connection object.";
        }
    }
    logfile($query);
    if (!$success) {
        logfile($errorInfo);
        $errors = true;
    }
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:30,代码来源:db_restore.php

示例4: logfile

                logfile("cleanup.log", "Database cleanup for table {$table}: deleted {$count} entries");
            }
        } else {
            if ($prompt) {
                print_message("No orphaned rows found in table {$table}.");
            }
        }
    }
    // Cleanup duplicate entries in the device_graphs table
    foreach (dbFetchRows("SELECT * FROM `device_graphs`") as $entry) {
        $graphs[$entry['device_id']][$entry['graph']][] = $entry['device_graph_id'];
    }
    foreach ($graphs as $device_id => $device_graph) {
        foreach ($device_graph as $graph => $data) {
            if (count($data) > 1) {
                // More than one entry for a single graph type for this device, let's clean up.
                // Leave the first entry intact, chop it off the array
                $device_graph_ids = array_slice($data, 1);
                if ($prompt) {
                    $answer = print_prompt(count($device_graph_ids) . " duplicate graph rows of type {$graph} for device {$device_id} will be deleted");
                }
                if ($answer) {
                    $table_status = dbDelete('device_graphs', "`device_graph_id` IN (?)", array($device_graph_ids));
                    print_debug("Deleted " . count($device_graph_ids) . " duplicate graph rows of type {$graph} for device {$device_id}");
                    logfile("cleanup.log", "Deleted " . count($device_graph_ids) . " duplicate graph rows of type {$graph} for device {$device_id}");
                }
            }
        }
    }
}
// EOF
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:db_cleanup.php

示例5: chdir

 * @copyright  (C) 2006-2015 Adam Armstrong
 *
 */
chdir(dirname($argv[0]));
$scriptname = basename($argv[0]);
include_once "includes/defaults.inc.php";
include_once "config.php";
$options = getopt("d");
if (isset($options['d'])) {
    array_shift($argv);
}
// for compatability
include_once "includes/definitions.inc.php";
include "includes/functions.inc.php";
$entry = explode(",", $argv[1]);
logfile('SNMPTRAP: ' . $argv[1]);
#print_vars($entry);
$device = @dbFetchRow("SELECT * FROM devices WHERE `hostname` = ?", array($entry['0']));
if (!$device['device_id']) {
    $device = @dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = ? AND I.port_id = A.port_id", array($entry['0']));
}
if (!$device['device_id']) {
    exit;
}
$file = $config['install_dir'] . "/includes/snmptrap/" . $entry['1'] . ".inc.php";
if (is_file($file)) {
    include "{$file}";
} else {
    echo "未知的陷阱 ({$file})";
}
// EOF
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:snmptrap.php

示例6: print_debug

                }
            }
            print_debug("Timing housekeeping: deleted {$rows} entries (per-device)");
            logfile("housekeeping.log", "Timing: deleted {$rows} entries older than " . format_unixtime($cutoff) . " (per-device)");
            $rows = dbDelete('perf_times', $where);
            if ($rows === FALSE) {
                // Use LIMIT with big tables
                print_debug("Performance table (per-run) is too big, using LIMIT for delete entries");
                $rows = 0;
                $i = 1000;
                while ($i && $rows < $count_run) {
                    $iter = dbDelete('perf_times', $where . ' LIMIT 1000000');
                    if ($iter === FALSE) {
                        break;
                    }
                    $rows += $iter;
                    $i--;
                }
            }
            print_debug("Timing housekeeping: deleted {$rows} entries (per-run)");
            logfile("housekeeping.log", "Timing: deleted {$rows} entries older than " . format_unixtime($cutoff) . " (per-run)");
        }
    } else {
        if ($prompt) {
            print_message("No perfomance entries found older than " . format_unixtime($cutoff));
        }
    }
} else {
    print_message("Timing housekeeping disabled in configuration or less than 24h.");
}
// EOF
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:timing.inc.php

示例7: get_http_request

function get_http_request($request)
{
    global $config;
    if (OBS_HTTP_REQUEST === FALSE) {
        print_debug("HTTP requests skipped since previous request exit with timeout.");
        return FALSE;
    }
    $response = '';
    $opts = array('http' => array('timeout' => '15'));
    if (isset($config['http_proxy']) && $config['http_proxy']) {
        $opts['http']['proxy'] = 'tcp://' . $config['http_proxy'];
        $opts['http']['request_fulluri'] = TRUE;
    }
    // Basic proxy auth
    if (isset($config['proxy_user']) && $config['proxy_user'] && isset($config['proxy_password'])) {
        $auth = base64_encode($config['proxy_user'] . ':' . $config['proxy_password']);
        $opts['http']['header'] = 'Proxy-Authorization: Basic ' . $auth;
    }
    $start = utime();
    $context = stream_context_create($opts);
    $response = file_get_contents($request, FALSE, $context);
    $runtime = utime() - $start;
    if (OBS_DEBUG) {
        if (OBS_DEBUG < 2 && strpos($request, 'update.observium.org')) {
            $request = preg_replace('/&stats=.+/', '&stats=***', $request);
        }
        print_message(PHP_EOL . 'REQUEST[%y' . $request . '%n]' . PHP_EOL . 'RUNTIME[' . ($runtime > 3 ? '%r' : '%g') . round($runtime, 4) . 's%n]', 'console');
        if (OBS_DEBUG > 1) {
            print_message("RESPONSE[\n" . $response . "\n]", 'console', FALSE);
        }
    }
    // Set OBS_HTTP_REQUEST for skip all other requests
    if (!defined('OBS_HTTP_REQUEST')) {
        if ($response === FALSE) {
            define('OBS_HTTP_REQUEST', FALSE);
            print_debug(__FUNCTION__ . '() exit with timeout. Access to outside localnet is blocked by firewall or network problems. Check proxy settings.');
            logfile(__FUNCTION__ . '() exit with timeout. Access to outside localnet is blocked by firewall or network problems. Check proxy settings.');
        } else {
            define('OBS_HTTP_REQUEST', TRUE);
        }
    }
    // FIXME. what if first request fine, but second broken?
    //else if ($response === FALSE)
    //{
    //  if (function_exists('runkit_constant_redefine')) { runkit_constant_redefine('OBS_HTTP_REQUEST', FALSE); }
    //}
    return $response;
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:48,代码来源:common.inc.php

示例8: print_debug

             if ($file_data['mtime'] < $cutoff) {
                 print_debug("File modification time is " . format_unixtime($file_data['mtime']) . " - deleting");
                 logfile("housekeeping.log", "File {$file} modification time is " . format_unixtime($file_data['mtime']) . " - deleting");
                 unlink($file);
                 $count_notmodified++;
             }
         }
         // Not using finfo functions from PHP, whatever I tried always resulted in application/octet-stream. Dumb thing.
         if ($config['housekeeping']['rrd']['invalid'] && file_exists($file)) {
             if (!file_exists($config['file'])) {
                 print_debug("Magic 'file' binary not found in configured path!");
             } else {
                 $filetype = $this_data = trim(external_exec($config['file'] . " -b " . $file));
                 if (substr($filetype, 0, 10) != "RRDTool DB") {
                     print_debug("Invalid file type for {$file} ({$filetype}) - deleting");
                     logfile("housekeeping.log", "File {$file} has invalid type: {$filetype} - deleting");
                     unlink($file);
                     $count_notvalid++;
                 }
             }
         }
     }
 }
 if ($prompt && $cutoff) {
     if ($count_notmodified) {
         print_message("Deleted {$count_notmodified} not modified RRD files older than " . format_unixtime($cutoff));
     } else {
         print_message("No RRD files found last modified before " . format_unixtime($cutoff));
     }
 }
 if ($prompt && $config['housekeeping']['rrd']['invalid']) {
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:rrd.inc.php

示例9: isPingable

/**
 * Checks device availability by icmp echo response
 * If flag OBS_PING_SKIP passed, pings skipped and returns 0.001 (1ms)
 *
 * @param string $hostname Device hostname or IP address
 * @param int Flags. Supported OBS_DNS_A, OBS_DNS_AAAA and OBS_PING_SKIP
 * @return float Average response time for used retries count (default retries is 3)
 */
function isPingable($hostname, $flags = OBS_DNS_ALL)
{
    global $config;
    $ping_debug = isset($config['ping']['debug']) && $config['ping']['debug'];
    $try_a = is_flag_set(OBS_DNS_A, $flags);
    if (is_flag_set(OBS_PING_SKIP, $flags)) {
        return 0.001;
        // Ping is skipped, just return 1ms
    }
    $timeout = isset($config['ping']['timeout']) ? (int) $config['ping']['timeout'] : 500;
    if ($timeout < 50) {
        $timeout = 50;
    } else {
        if ($timeout > 2000) {
            $timeout = 2000;
        }
    }
    $retries = isset($config['ping']['retries']) ? (int) $config['ping']['retries'] : 3;
    if ($retries < 1) {
        $retries = 3;
    } else {
        if ($retries > 10) {
            $retries = 10;
        }
    }
    $sleep = floor(1000000 / $retries);
    // interval between retries, max 1 sec
    if ($ip_version = get_ip_version($hostname)) {
        // Ping by IP
        if ($ip_version === 6) {
            $cmd = $config['fping6'] . " -t {$timeout} -c 1 -q {$hostname} 2>&1";
        } else {
            if (!$try_a) {
                if ($ping_debug) {
                    logfile('debug.log', __FUNCTION__ . "() | DEVICE: {$hostname} | Passed IPv4 address but device use IPv6 transport");
                }
                print_debug('Into function ' . __FUNCTION__ . '() passed IPv4 address (' . $hostname . 'but device use IPv6 transport');
                return 0;
            }
            // Forced check for actual IPv4 address
            $cmd = $config['fping'] . " -t {$timeout} -c 1 -q {$hostname} 2>&1";
        }
    } else {
        // First try IPv4
        $ip = $try_a ? gethostbyname($hostname) : FALSE;
        // Do not check IPv4 if transport IPv6
        if ($ip && $ip != $hostname) {
            $cmd = $config['fping'] . " -t {$timeout} -c 1 -q {$ip} 2>&1";
        } else {
            $ip = gethostbyname6($hostname, OBS_DNS_AAAA);
            // Second try IPv6
            if ($ip) {
                $cmd = $config['fping6'] . " -t {$timeout} -c 1 -q {$ip} 2>&1";
            } else {
                // No DNS records
                if ($ping_debug) {
                    logfile('debug.log', __FUNCTION__ . "() | DEVICE: {$hostname} | NO DNS record found");
                }
                return 0;
            }
        }
    }
    for ($i = 1; $i <= $retries; $i++) {
        $output = external_exec($cmd);
        if ($GLOBALS['exec_status']['exitcode'] === 0) {
            // normal $output = '8.8.8.8 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 1.21/1.21/1.21'
            $tmp = explode('/', $output);
            $ping = $tmp[7];
            if (!$ping) {
                $ping = 0.001;
            }
            // Protection from zero (exclude false status)
        } else {
            $ping = 0;
        }
        if ($ping) {
            break;
        }
        if ($ping_debug) {
            logfile('debug.log', __FUNCTION__ . "() | DEVICE: {$hostname} | FPING OUT ({$i}): " . $output[0]);
            if ($i == $retries) {
                $mtr = $config['mtr'] . " -r -n -c 5 {$ip}";
                logfile('debug.log', __FUNCTION__ . "() | DEVICE: {$hostname} | MTR OUT:\n" . external_exec($mtr));
            }
        }
        if ($i < $retries) {
            usleep($sleep);
        }
    }
    return $ping;
}
开发者ID:Natolumin,项目名称:observium,代码行数:99,代码来源:functions.inc.php

示例10: zef_edit_comment

/**
 * Just edit the comment an entry. This is used for editing the comment
 * of a running entry.
 * 
 * @param $zef_ID id of the timesheet entry
 * @param $comment_type new type of the comment
 * @param $comment the comment text
 */
function zef_edit_comment($zef_ID, $comment_type, $comment)
{
    global $kga, $conn;
    $zef_ID = MySQL::SQLValue($zef_ID, MySQL::SQLVALUE_NUMBER);
    $comment_type = MySQL::SQLValue($comment_type);
    $comment = MySQL::SQLValue($comment);
    $table = $kga['server_prefix'] . "zef";
    $filter['zef_ID'] = $zef_ID;
    $values['zef_comment_type'] = $comment_type;
    $values['zef_comment'] = $comment;
    $query = MySQL::BuildSQLUpdate($table, $values, $filter);
    logfile($query);
    return $conn->Query($query);
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:22,代码来源:db_layer_mysql.php

示例11: print_prompt

        if ($prompt) {
            $answer = print_prompt("{$count} eventlog entries older than " . format_unixtime($cutoff) . " will be deleted");
        }
        if ($answer) {
            $rows = dbDelete('eventlog', $where);
            if ($rows === FALSE) {
                // Use LIMIT with big tables
                print_debug("Event log table is too big, using LIMIT to delete entries");
                $rows = 0;
                $i = 1000;
                while ($i && $rows < $count) {
                    $iter = dbDelete('eventlog', $where . ' LIMIT 1000000');
                    if ($iter === FALSE) {
                        break;
                    }
                    $rows += $iter;
                    $i--;
                }
            }
            print_debug("Event log housekeeping: deleted {$rows} entries");
            logfile("housekeeping.log", "Event log: deleted {$rows} entries older than " . format_unixtime($cutoff));
        }
    } else {
        if ($prompt) {
            print_message("No event log entries found older than " . format_unixtime($cutoff));
        }
    }
} else {
    print_message("Event log housekeeping is disabled in configuration or less than 24h.");
}
// EOF
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:eventlog.inc.php

示例12: age_to_unixtime

 * @package    observium
 * @subpackage housekeeping
 * @author     Adam Armstrong <adama@observium.org>
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$cutoff = age_to_unixtime($config['housekeeping']['deleted_ports']['age']);
if ($cutoff) {
    $where = "`deleted` = 1 AND UNIX_TIMESTAMP(`ifLastChange`) < {$cutoff}";
    $ports = dbFetchRows("SELECT `port_id` FROM `ports` WHERE {$where}");
    $count = count($ports);
    if ($count) {
        if ($prompt) {
            $answer = print_prompt("{$count} ports marked as deleted before " . format_unixtime($cutoff) . " will be deleted");
        }
        if ($answer) {
            foreach ($ports as $entry) {
                delete_port($entry['port_id']);
            }
            print_debug("Deleted ports housekeeping: deleted {$count} entries");
            logfile("housekeeping.log", "Deleted ports: deleted {$count} entries older than " . format_unixtime($cutoff));
        }
    } else {
        if ($prompt) {
            print_message("No ports found marked as deleted before " . format_unixtime($cutoff));
        }
    }
} else {
    print_message("Deleted ports housekeeping disabled in configuration.");
}
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:ports.inc.php

示例13: get_dev_attrib

global $valid, $agent_sensors;
if ($device['os_group'] == "unix") {
    echo "Observium UNIX Agent: ";
    // Use port configured in config (or defaults)
    $agent_port = $config['unix-agent']['port'];
    // ... Unless user configured a port for this specific device, and it's valid (numeric and within 16-bit port range)
    $override_port = get_dev_attrib($device, 'agent_port');
    if (is_numeric($override_port) && $override_port < 65536) {
        $agent_port = $override_port;
    }
    $agent_start = utime();
    $agent_socket = "tcp://" . $device['hostname'] . ":" . $agent_port;
    $agent = @stream_socket_client($agent_socket, $errno, $errstr, 10);
    if (!$agent) {
        print_warning("Connection to UNIX agent on " . $agent_socket . " failed. ERROR: " . $errno . " " . $errstr);
        logfile("UNIX-AGENT: Connection on " . $agent_socket . " failed. ERROR: " . $errno . " " . $errstr);
    } else {
        $agent_raw = stream_get_contents($agent);
    }
    $agent_end = utime();
    $agent_time = round(($agent_end - $agent_start) * 1000);
    if (!empty($agent_raw)) {
        echo "execution time: " . $agent_time . "ms";
        rrdtool_update_ng($device, 'agent', array('time' => $agent_time));
        $graphs['agent'] = TRUE;
        foreach (explode("<<<", $agent_raw) as $section) {
            list($section, $data) = explode(">>>", $section);
            $sa = '';
            $sb = '';
            $sc = '';
            # DO -NOT- ADD NEW CASES BELOW -- use <<<app-$foo>>> in your application script
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:unix-agent.inc.php

示例14: array

$comment_types = array($kga['lang']['ctype0'], $kga['lang']['ctype1'], $kga['lang']['ctype2']);
// ==================
// = security check =
// ==================
if (isset($_REQUEST['axAction']) && !is_array($_REQUEST['axAction']) && $_REQUEST['axAction'] != "") {
    $axAction = strip_tags($_REQUEST['axAction']);
} else {
    $axAction = '';
}
$axValue = isset($_REQUEST['axValue']) ? strip_tags($_REQUEST['axValue']) : '';
$id = isset($_REQUEST['id']) ? strip_tags($_REQUEST['id']) : null;
// ============================================
// = initialize currently displayed timespace =
// ============================================
$timespace = get_timespace();
$in = $timespace[0];
$out = $timespace[1];
if (isset($_REQUEST['first_day'])) {
    $in = (int) $_REQUEST['first_day'];
}
if (isset($_REQUEST['last_day'])) {
    $out = mktime(23, 59, 59, date("n", $_REQUEST['last_day']), date("j", $_REQUEST['last_day']), date("Y", $_REQUEST['last_day']));
}
if ($axAction != "reloadLogfile") {
    logfile("KSPI axAction (" . (array_key_exists('customer', $kga) ? $kga['customer']['knd_name'] : $kga['usr']['usr_name']) . "): " . $axAction);
}
// prevent IE from caching the response
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:31,代码来源:kspi.php

示例15: CollectData

function CollectData($bill_id)
{
    $port_list = dbFetchRows("SELECT * FROM `bill_ports` as P, `ports` as I, `devices` as D WHERE P.bill_id=? AND I.port_id = P.port_id AND D.device_id = I.device_id", array($bill_id));
    print_r($port_list);
    $now = dbFetchCell("SELECT NOW()");
    foreach ($port_list as $port_data) {
        $port_id = $port_data['port_id'];
        $host = $port_data['hostname'];
        $port = $port_data['port'];
        echo "\nPolling " . $port_data['ifDescr'] . " on " . $port_data['hostname'] . "\n";
        $port_data['in_measurement'] = getValue($port_data['hostname'], $port_data['port'], $port_data['ifIndex'], "In");
        $port_data['out_measurement'] = getValue($port_data['hostname'], $port_data['port'], $port_data['ifIndex'], "Out");
        $last_data = getLastPortCounter($port_id, in);
        if ($last_data['state'] == "ok") {
            $port_data['last_in_measurement'] = $last_data[counter];
            $port_data['last_in_delta'] = $last_data[delta];
            if ($port_data['in_measurement'] > $port_data['last_in_measurement']) {
                $port_data['in_delta'] = $port_data['in_measurement'] - $port_data['last_in_measurement'];
            } else {
                $port_data['in_delta'] = $port_data['last_in_delta'];
            }
        } else {
            $port_data['in_delta'] = '0';
        }
        dbInsert(array('port_id' => $port_id, 'timestamp' => $now, 'counter' => $port_data['in_measurement'], 'delta' => $port_data['in_delta']), 'port_in_measurements');
        $last_data = getLastPortCounter($port_id, out);
        if ($last_data[state] == "ok") {
            $port_data['last_out_measurement'] = $last_data[counter];
            $port_data['last_out_delta'] = $last_data[delta];
            if ($port_data['out_measurement'] > $port_data['last_out_measurement']) {
                $port_data['out_delta'] = $port_data['out_measurement'] - $port_data['last_out_measurement'];
            } else {
                $port_data['out_delta'] = $port_data['last_out_delta'];
            }
        } else {
            $port_data['out_delta'] = '0';
        }
        dbInsert(array('port_id' => $port_id, 'timestamp' => $now, 'counter' => $port_data['out_measurement'], 'delta' => $port_data['out_delta']), 'port_out_measurements');
        $delta = $delta + $port_data['in_delta'] + $port_data['out_delta'];
        $in_delta = $in_delta + $port_data['in_delta'];
        $out_delta = $out_delta + $port_data['out_delta'];
    }
    $last_data = getLastMeasurement($bill_id);
    if ($last_data[state] == "ok") {
        $prev_delta = $last_data[delta];
        $prev_in_delta = $last_data[in_delta];
        $prev_out_delta = $last_data[out_delta];
        $prev_timestamp = $last_data[timestamp];
        $period = dbFetchCell("SELECT UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) - UNIX_TIMESTAMP('" . mres($prev_timestamp) . "')");
    } else {
        $prev_delta = '0';
        $period = '0';
        $prev_in_delta = '0';
        $prev_out_delta = '0';
    }
    if ($delta < '0') {
        $delta = $prev_delta;
        $in_delta = $prev_in_delta;
        $out_delta = $prev_out_delta;
    }
    if ($period < "0") {
        logfile("BILLING: negative period! id:{$bill_id} period:{$period} delta:{$delta} in_delta:{$in_delta} out_delta:{$out_delta}");
    } else {
        dbInsert(array('bill_id' => $bill_id, 'timestamp' => $now, 'period' => $period, 'delta' => $delta, 'in_delta' => $in_delta, 'out_delta' => $out_delta), 'bill_data');
    }
}
开发者ID:REAP720801,项目名称:librenms,代码行数:66,代码来源:poll-billing.php


注:本文中的logfile函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。