Skip to content
This repository was archived by the owner on Jan 15, 2021. It is now read-only.

Fix deprecations and correct issue with command line args #114

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions cacti/scripts/ss_get_by_ssh.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,15 @@ function usage($message) {
# ============================================================================
function parse_cmdline( $args ) {
$options = array();
while (list($tmp, $p) = each($args)) {
foreach ($args as $tmp => $p) {
if (strpos($p, '--') === 0) {
$param = substr($p, 2);
$value = null;
$nextparam = current($args);
if ($nextparam !== false && strpos($nextparam, '--') !==0) {
list($tmp, $value) = each($args);
$value = $nextparam = null;
if (isset($args[$tmp + 1])) {
$nextparam = $args[$tmp + 1];
}
if (!empty($nextparam) && strpos($nextparam, '--') !== 0) {
$value = $nextparam;
}
$options[$param] = $value;
}
Expand Down Expand Up @@ -1606,4 +1608,3 @@ function vmstat_cachefile ( $options ) {
function vmstat_cmdline ( $options ) {
return "cat /proc/vmstat";
}

13 changes: 7 additions & 6 deletions cacti/scripts/ss_get_mysql_stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,15 @@ function usage($message) {
# ============================================================================
function parse_cmdline( $args ) {
$options = array();
while (list($tmp, $p) = each($args)) {
foreach ($args as $tmp => $p) {
if (strpos($p, '--') === 0) {
$param = substr($p, 2);
$value = null;
$nextparam = current($args);
if ($nextparam !== false && strpos($nextparam, '--') !==0) {
list($tmp, $value) = each($args);
$value = $nextparam = null;
if (isset($args[$tmp + 1])) {
$nextparam = $args[$tmp + 1];
}
if (!empty($nextparam) && strpos($nextparam, '--') !== 0) {
$value = $nextparam;
}
$options[$param] = $value;
}
Expand Down Expand Up @@ -1414,4 +1416,3 @@ function debug($val) {
$debug_log = FALSE;
}
}