Skip to content
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
14 changes: 8 additions & 6 deletions .github/workflows/plugin-ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ jobs:
ini-values: "post_max_size=256M, max_execution_time=60, date.timezone=America/New_York"

- name: Check PHP version
run: php -v
run: |
php -v
echo "PHP_BINARY=$(command -v php)" >> "$GITHUB_ENV"

- name: Run apt-get update
run: sudo apt-get update

- name: Install System Dependencies
run: sudo apt-get install -y apache2 snmp snmpd rrdtool fping libapache2-mod-php${{ matrix.php }}
run: sudo apt-get install -y apache2 snmp snmpd rrdtool fping

- name: Start SNMPD Agent and Test
run: |
Expand Down Expand Up @@ -115,7 +117,7 @@ jobs:
mysql $MYSQL_AUTH_USR -e "GRANT SELECT ON mysql.time_zone_name TO 'cactiuser'@'localhost';"
mysql $MYSQL_AUTH_USR -e "FLUSH PRIVILEGES;"
mysql $MYSQL_AUTH_USR cacti < ${{ github.workspace }}/cacti/cacti.sql
mysql $MYSQL_AUTH_USR -e "INSERT INTO settings (name, value) VALUES ('path_php_binary', '/usr/bin/php')" cacti
mysql $MYSQL_AUTH_USR -e "INSERT INTO settings (name, value) VALUES ('path_php_binary', '$PHP_BINARY')" cacti

- name: Validate composer files
run: |
Expand Down Expand Up @@ -163,12 +165,12 @@ jobs:
- name: Install Cacti via CLI
run: |
cd ${{ github.workspace }}/cacti
sudo php cli/install_cacti.php --accept-eula --install --force
sudo "$PHP_BINARY" cli/install_cacti.php --accept-eula --install --force

- name: Install Thold Plugin
run: |
cd ${{ github.workspace }}/cacti
sudo php cli/plugin_manage.php --plugin=thold --install --enable
sudo "$PHP_BINARY" cli/plugin_manage.php --plugin=thold --install --enable

# - name: import Thold Plugin Sample Data
# run: |
Expand Down Expand Up @@ -209,7 +211,7 @@ jobs:
- name: Run Cacti Poller
run: |
cd ${{ github.workspace }}/cacti
sudo php poller.php --poller=1 --force --debug
sudo "$PHP_BINARY" poller.php --poller=1 --force --debug
if ! grep -q "SYSTEM STATS" log/cacti.log; then
echo "Cacti poller did not finish successfully"
cat log/cacti.log
Expand Down
86 changes: 43 additions & 43 deletions thold_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,55 +493,55 @@ function thold_expression_boolean_rpn($operator, &$stack) {
array_push($stack, '0');
} else {
switch($operator) {
case 'LT':
if ($v1 < $v2) {
array_push($stack, '1');
} else {
array_push($stack, '0');
}
case 'LT':
if ($v1 < $v2) {
array_push($stack, '1');
} else {
array_push($stack, '0');
}

break;
case 'GT':
if ($v1 > $v2) {
array_push($stack, '1');
} else {
array_push($stack, '0');
}
break;
case 'GT':
if ($v1 > $v2) {
array_push($stack, '1');
} else {
array_push($stack, '0');
}

break;
case 'LE':
if ($v1 <= $v2) {
array_push($stack, '1');
} else {
array_push($stack, '0');
}
break;
case 'LE':
if ($v1 <= $v2) {
array_push($stack, '1');
} else {
array_push($stack, '0');
}

break;
case 'GE':
if ($v1 >= $v2) {
array_push($stack, '1');
} else {
array_push($stack, '0');
}
break;
case 'GE':
if ($v1 >= $v2) {
array_push($stack, '1');
} else {
array_push($stack, '0');
}

break;
case 'EQ':
if ($v1 == $v2) {
array_push($stack, '1');
} else {
array_push($stack, '0');
}
break;
case 'EQ':
if ($v1 == $v2) {
array_push($stack, '1');
} else {
array_push($stack, '0');
}

break;
case 'NE':
if ($v1 != $v2) {
array_push($stack, '1');
} else {
array_push($stack, '0');
}
break;
case 'NE':
if ($v1 != $v2) {
array_push($stack, '1');
} else {
array_push($stack, '0');
}

break;
}
break;
}
}
}
}
Expand Down
Loading