Remove legacy function calls (#12651)

* massive inlines

* fix style and wtf

* remove rrdtool.inc.php include

* fix CommonFunctions namespace issues

* looking for missing class space, fix undefined class issues

* style fixes
This commit is contained in:
Tony Murray
2021-03-28 17:25:30 -05:00
committed by GitHub
parent 1695f86af8
commit 1c379dcd05
832 changed files with 2023 additions and 2596 deletions

View File

@@ -44,7 +44,7 @@ if (isset($options['h'])) {
$params = $device_ids;
} else {
$where = 'AND `hostname` LIKE ?';
$params = [str_replace('*', '%', mres($options['h']))];
$params = [str_replace('*', '%', $options['h'])];
}
}
$devices = dbFetchRows("SELECT * FROM `devices` WHERE status = 1 AND disabled = 0 $where ORDER BY `hostname` ASC", $params);

View File

@@ -128,25 +128,25 @@ function print_help()
$options = getopt('b:s:h:i:f:np:t:q:');
if (! empty($options['s'])) {
$host_glob = str_replace('*', '%', mres($options['s']));
$host_glob = str_replace('*', '%', $options['s']);
$nameType = 'sysName';
}
if (! empty($options['h'])) {
$host_glob = str_replace('*', '%', mres($options['h']));
$host_glob = str_replace('*', '%', $options['h']);
$nameType = 'hostname';
}
if (array_key_exists('n', $options)) {
$create_bill = true;
}
if (! empty($options['t'])) {
$bill_type = mres($options['t']);
$bill_type = $options['t'];
}
if (! empty($options['q'])) {
$bill_cdr = mres($options['q']);
$bill_cdr = $options['q'];
}
$bill_name = str_replace('*', '%', mres($options['b']));
$intf_glob = str_replace('*', '%', mres($options['i']));
$bill_name = str_replace('*', '%', $options['b']);
$intf_glob = str_replace('*', '%', $options['i']);
// Exit if no bill
if (empty($bill_name)) {

View File

@@ -59,7 +59,7 @@ $tmp_path = Config::get('temp_dir', '/tmp');
if ($hostname === 'all') {
$hostname = '*';
}
$files = glob(get_rrd_dir($hostname) . '/*.rrd');
$files = glob(Rrd::dirFromHost($hostname) . '/*.rrd');
$converted = 0;
$skipped = 0;
@@ -99,8 +99,8 @@ foreach ($files as $file) {
}
echo "Converting $file: ";
$command = "$rrdtool dump $file > $random &&
sed -i 's/<step>\([0-9]*\)/<step>$step/' $random &&
$command = "$rrdtool dump $file > $random &&
sed -i 's/<step>\([0-9]*\)/<step>$step/' $random &&
sed -i 's/<minimal_heartbeat>\([0-9]*\)/<minimal_heartbeat>$heartbeat/' $random &&
$rrdtool restore -f $random $file &&
rm -f $random";

View File

@@ -6,8 +6,8 @@ require realpath(__DIR__ . '/..') . '/includes/init.php';
$options = getopt('h:p:');
$hosts = str_replace('*', '%', mres($options['h']));
$ports = str_replace('*', '%', mres($options['p']));
$hosts = str_replace('*', '%', $options['h']);
$ports = str_replace('*', '%', $options['p']);
if (empty($hosts) && empty($ports)) {
echo "-h <device hostname wildcard> Device(s) to match (all is a valid arg)\n";