From e07df3a91e56f97e86f84d8e966fdc1204392058 Mon Sep 17 00:00:00 2001 From: TheWitness Date: Thu, 29 Jan 2026 14:23:09 -0500 Subject: [PATCH 1/6] Light PSR Changes --- functions.php | 9 +-- maint.php | 173 ++++++++++++++++++++++++-------------------------- setup.php | 16 ++--- 3 files changed, 92 insertions(+), 106 deletions(-) diff --git a/functions.php b/functions.php index 44a91a9..ab981f8 100644 --- a/functions.php +++ b/functions.php @@ -68,8 +68,7 @@ function plugin_maint_check_servcheck_test(int $host): bool { * @return bool True if host is in active maintenance schedule, false otherwise */ function plugin_maint_check_host(int $type, int $host): bool { - $schedules = db_fetch_assoc_prepared( - 'SELECT * + $schedules = db_fetch_assoc_prepared('SELECT * FROM plugin_maint_hosts WHERE TYPE = ? AND (host = ? OR host = 0)', @@ -99,8 +98,7 @@ function plugin_maint_check_host(int $type, int $host): bool { * @return bool True if schedule is active now, false otherwise */ function plugin_maint_check_schedule(int $schedule): bool { - $sc = db_fetch_row_prepared( - 'SELECT * + $sc = db_fetch_row_prepared('SELECT * FROM plugin_maint_schedules WHERE enabled = \'on\' AND id = ?', [$schedule], @@ -134,8 +132,7 @@ function plugin_maint_check_schedule(int $schedule): bool { $sc['stime'] = $starttimelocal->getTimestamp(); $sc['etime'] = $endtimelocal->getTimestamp(); // save next interval so not need to recalculate - db_execute_prepared( - 'UPDATE plugin_maint_schedules + db_execute_prepared('UPDATE plugin_maint_schedules SET stime = ?, etime = ? WHERE id = ?', [$sc['stime'], $sc['etime'], $schedule], diff --git a/maint.php b/maint.php index 29d839b..e7a336d 100644 --- a/maint.php +++ b/maint.php @@ -148,8 +148,7 @@ function schedule_update(): void { foreach ($selected_items as $id) { $stime = intval(time() / 60) * 60; $etime = $stime + 3600; - db_execute_prepared( - 'UPDATE plugin_maint_schedules + db_execute_prepared('UPDATE plugin_maint_schedules SET stime = ?, etime = ? WHERE id = ? LIMIT 1', @@ -271,17 +270,18 @@ function form_actions(): void { if ($selected_items != false) { if (get_request_var('drp_action') == '1') { // associate for ($i = 0; ($i < count($selected_items)); $i++) { - db_execute_prepared( - 'REPLACE INTO plugin_maint_hosts (type, host, schedule) + db_execute_prepared('REPLACE INTO plugin_maint_hosts + (type, host, schedule) VALUES (?, ?, ?)', [MAINT_HOST_TYPE_HOSTS, $selected_items[$i], get_request_var('id')], ); } } elseif (get_request_var('drp_action') == '2') { // disassociate for ($i = 0; ($i < count($selected_items)); $i++) { - db_execute_prepared( - 'DELETE FROM plugin_maint_hosts - WHERE type = ? AND host = ? AND schedule = ?', + db_execute_prepared('DELETE FROM plugin_maint_hosts + WHERE type = ? + AND host = ? + AND schedule = ?', [MAINT_HOST_TYPE_HOSTS, $selected_items[$i], get_request_var('id')], ); } @@ -299,17 +299,18 @@ function form_actions(): void { if ($selected_items != false) { if (get_request_var('drp_action') == '1') { // associate for ($i = 0; ($i < count($selected_items)); $i++) { - db_execute_prepared( - 'REPLACE INTO plugin_maint_hosts (type, host, schedule) + db_execute_prepared('REPLACE INTO plugin_maint_hosts + (type, host, schedule) VALUES (?, ?, ?)', [MAINT_HOST_TYPE_WEBSEER, $selected_items[$i], get_request_var('id')], ); } } elseif (get_request_var('drp_action') == '2') { // disassociate for ($i = 0; ($i < count($selected_items)); $i++) { - db_execute_prepared( - 'DELETE FROM plugin_maint_hosts - WHERE type = ? AND host = ? AND schedule = ?', + db_execute_prepared('DELETE FROM plugin_maint_hosts + WHERE type = ? + AND host = ? + AND schedule = ?', [MAINT_HOST_TYPE_WEBSEER, $selected_items[$i], get_request_var('id')], ); } @@ -327,17 +328,18 @@ function form_actions(): void { if ($selected_items != false) { if (get_request_var('drp_action') == '1') { // associate for ($i = 0; ($i < count($selected_items)); $i++) { - db_execute_prepared( - 'REPLACE INTO plugin_maint_hosts (type, host, schedule) + db_execute_prepared('REPLACE INTO plugin_maint_hosts + (type, host, schedule) VALUES (?, ?, ?)', [MAINT_HOST_TYPE_SERVCHECK, $selected_items[$i], get_request_var('id')], ); } } elseif (get_request_var('drp_action') == '2') { // disassociate for ($i = 0; ($i < count($selected_items)); $i++) { - db_execute_prepared( - 'DELETE FROM plugin_maint_hosts - WHERE type = ? AND host = ? AND schedule = ?', + db_execute_prepared('DELETE FROM plugin_maint_hosts + WHERE type = ? + AND host = ? + AND schedule = ?', [MAINT_HOST_TYPE_SERVCHECK, $selected_items[$i], get_request_var('id')], ); } @@ -359,10 +361,9 @@ function form_actions(): void { if (isset_request_var('id')) { $list_name = html_escape( - db_fetch_cell_prepared( - 'SELECT name - FROM plugin_maint_schedules - WHERE id = ?', + db_fetch_cell_prepared('SELECT name + FROM plugin_maint_schedules + WHERE id = ?', [get_request_var('id')], ), ); @@ -377,8 +378,7 @@ function form_actions(): void { // ==================================================== $list .= '
  • ' . html_escape( - db_fetch_cell_prepared( - 'SELECT name + db_fetch_cell_prepared('SELECT name FROM plugin_maint_schedules WHERE id=?', [$matches[1]], @@ -393,7 +393,7 @@ function form_actions(): void { form_start('maint.php'); - html_start_box($actions[get_request_var('drp_action')] . " $list_name", '60%', '', '3', 'center', ''); + html_start_box($actions[get_request_var('drp_action')] . " $list_name", '60%', false, 3, 'center', ''); if (cacti_sizeof($array)) { if (get_request_var('drp_action') == '1') { // update @@ -445,8 +445,7 @@ function form_actions(): void { input_validate_input_number($matches[1]); // ==================================================== - $description = db_fetch_cell_prepared( - 'SELECT description + $description = db_fetch_cell_prepared('SELECT description FROM host WHERE id = ?', [$matches[1]], @@ -461,7 +460,7 @@ function form_actions(): void { form_start('maint.php'); - html_start_box($assoc_actions[get_request_var('drp_action')] . ' ' . __('Device(s)', 'maint'), '60%', '', '3', 'center', ''); + html_start_box($assoc_actions[get_request_var('drp_action')] . ' ' . __('Device(s)', 'maint'), '60%', false, 3, 'center', ''); if (cacti_sizeof($array)) { if (get_request_var('drp_action') == '1') { // associate @@ -514,8 +513,7 @@ function form_actions(): void { input_validate_input_number($matches[1]); // ==================================================== - $description = db_fetch_cell_prepared( - 'SELECT display_name + $description = db_fetch_cell_prepared('SELECT display_name FROM plugin_webseer_urls WHERE id = ?', [$matches[1]], @@ -530,7 +528,7 @@ function form_actions(): void { form_start('maint.php'); - html_start_box($assoc_actions[get_request_var('drp_action')] . ' ' . __('Webseer(s)', 'maint'), '60%', '', '3', 'center', ''); + html_start_box($assoc_actions[get_request_var('drp_action')] . ' ' . __('Webseer(s)', 'maint'), '60%', false, 3, 'center', ''); if (cacti_sizeof($array)) { if (get_request_var('drp_action') == '1') { // associate @@ -583,8 +581,7 @@ function form_actions(): void { input_validate_input_number($matches[1]); // ==================================================== - $description = db_fetch_cell_prepared( - 'SELECT display_name + $description = db_fetch_cell_prepared('SELECT display_name FROM plugin_servcheck_test WHERE id = ?', [$matches[1]], @@ -599,7 +596,7 @@ function form_actions(): void { form_start('maint.php'); - html_start_box($assoc_actions[get_request_var('drp_action')] . ' ' . __('Servcheck(s)', 'maint'), '60%', '', '3', 'center', ''); + html_start_box($assoc_actions[get_request_var('drp_action')] . ' ' . __('Servcheck(s)', 'maint'), '60%', false, 3, 'center', ''); if (cacti_sizeof($array)) { if (get_request_var('drp_action') == '1') { // associate @@ -656,12 +653,12 @@ function form_actions(): void { */ function get_header_label(): string { if (!isempty_request_var('id')) { - $list = db_fetch_row_prepared( - 'SELECT * + $list = db_fetch_row_prepared('SELECT * FROM plugin_maint_schedules WHERE id = ?', [get_filter_request_var('id')], ); + $header_label = __esc('[edit: %s]', $list['name'], 'maint'); } else { $header_label = __('[new]', 'maint'); @@ -727,9 +724,9 @@ function schedule_edit(): void { maint_tabs(); if (isset_request_var('id')) { - $id = get_request_var('id'); - $maint_item_data = db_fetch_row_prepared( - 'SELECT * + $id = get_request_var('id'); + + $maint_item_data = db_fetch_row_prepared('SELECT * FROM plugin_maint_schedules WHERE id = ?', [$id], @@ -744,7 +741,7 @@ function schedule_edit(): void { if (get_request_var('tab') == 'general') { form_start('maint.php', 'maint'); - html_start_box(__('General Settings %s', htmlspecialchars($header_label), 'maint'), '100%', '', '3', 'center', ''); + html_start_box(__('General Settings %s', htmlspecialchars($header_label), 'maint'), '100%', false, 3, 'center', ''); $form_array = [ 'general_header' => [ @@ -923,7 +920,7 @@ function schedules(): void { form_start('maint.php', 'chk'); - html_start_box(__('Maintenance Schedules', 'maint'), '100%', '', '2', 'center', 'maint.php?tab=general&action=edit'); + html_start_box(__('Maintenance Schedules', 'maint'), '100%', false, 3, 'center', 'maint.php?tab=general&action=edit'); html_header_checkbox( [ @@ -1111,7 +1108,7 @@ function clearFilter() { @@ -1195,15 +1192,14 @@ function clearFilter() { } // Include (UNION) Any - $locations = db_fetch_assoc_prepared( - "SELECT * - FROM ( - SELECT DISTINCT IF(IFNULL(location,'') = '', ?, location) AS location - FROM (SELECT location FROM host WHERE id = id $sql_where GROUP BY location) AS host - UNION ALL - SELECT location FROM (SELECT ? AS location ) AS tableany - ) tableunion - ORDER BY location", + $locations = db_fetch_assoc_prepared("SELECT * + FROM ( + SELECT DISTINCT IF(IFNULL(location,'') = '', ?, location) AS location + FROM (SELECT location FROM host WHERE id = id $sql_where GROUP BY location) AS host + UNION ALL + SELECT location FROM (SELECT ? AS location ) AS tableany + ) tableunion + ORDER BY location", array_merge([MAINT_HOST_FILTER_LOC_NONE], $sql_where_params, [MAINT_HOST_FILTER_LOC_ANY]), ); @@ -1263,16 +1259,15 @@ function clearFilter() { } $sql_statement = "SELECT ht.id, ht.name - FROM host_template AS ht - WHERE ht.id IN (SELECT host_template_id FROM host WHERE id = id $sql_where) - ORDER BY ht.name"; + FROM host_template AS ht + WHERE ht.id IN (SELECT host_template_id FROM host WHERE id = id $sql_where) + ORDER BY ht.name"; $host_templates = db_fetch_assoc_prepared($sql_statement, $sql_where_params); - $hosts_no_templates = db_fetch_assoc_prepared( - "SELECT id - FROM host WHERE host_template_id = 0 $sql_where - LIMIT 1", + $hosts_no_templates = db_fetch_assoc_prepared("SELECT id + FROM host WHERE host_template_id = 0 $sql_where + LIMIT 1", $sql_where_params, ); @@ -1435,8 +1430,7 @@ function clearFilter() { if ($schedule_created) { $sql_params = array_merge([get_request_var('id')], $sql_where_params); - $total_rows = db_fetch_cell_prepared( - "SELECT COUNT(DISTINCT h.id) + $total_rows = db_fetch_cell_prepared("SELECT COUNT(DISTINCT h.id) FROM host AS h LEFT JOIN (SELECT DISTINCT host_id FROM thold_data) AS td ON h.id = td.host_id @@ -1519,7 +1513,7 @@ function clearFilter() { print $nav; - html_start_box('', '100%', '', '3', 'center', ''); + html_start_box('', '100%', false, 3, 'center', ''); html_header_sort_checkbox($display_text, get_request_var('sort_column'), get_request_var('sort_direction'), false, 'maint.php?action=edit&tab=hosts&id=' . get_request_var('id')); @@ -1535,12 +1529,13 @@ function clearFilter() { $names = ''; } - $lists = db_fetch_assoc_prepared( - 'SELECT name + $lists = db_fetch_assoc_prepared('SELECT name FROM plugin_maint_schedules INNER JOIN plugin_maint_hosts ON plugin_maint_schedules.id = plugin_maint_hosts.schedule - WHERE type = ? AND host = ? AND plugin_maint_schedules.id != ?', + WHERE type = ? + AND host = ? + AND plugin_maint_schedules.id != ?', [MAINT_HOST_TYPE_HOSTS, $host['id'], get_request_var('id')], ); @@ -1638,7 +1633,7 @@ function webseer_urls(string $header_label): void { $rows = get_request_var('rows'); } - html_start_box(__esc("Associated Web URL's %s", $header_label, 'maint'), '100%', '', '3', 'center', ''); + html_start_box(__esc("Associated Web URL's %s", $header_label, 'maint'), '100%', false, 3, 'center', ''); ?> @@ -1693,21 +1688,21 @@ function applyFilter() { strURL += '&header=false'; loadPageNoHeader(strURL); } - + function clearFilter() { strURL = 'maint.php?tab=webseer&action=edit&id=&clear=true&header=false'; loadPageNoHeader(strURL); } - + $(function() { $('#rows, #associated').change(function() { applyFilter(); }); - + $('#clear').click(function() { clearFilter(); }); - + $('#form_webseer').submit(function(event) { event.preventDefault(); applyFilter(); @@ -1742,13 +1737,12 @@ function clearFilter() { if ($schedule_created) { $sql_params = array_merge([get_request_var('id'), MAINT_HOST_TYPE_WEBSEER], $sql_where_params); - $total_rows = db_fetch_cell_prepared( - "SELECT COUNT(*) + $total_rows = db_fetch_cell_prepared("SELECT COUNT(*) FROM plugin_webseer_urls AS u LEFT JOIN plugin_maint_hosts AS pmh - ON (u.id = pmh.host - AND pmh.type = ? - AND pmh.schedule = ?) + ON u.id = pmh.host + AND pmh.type = ? + AND pmh.schedule = ? $sql_where", $sql_params, ); @@ -1759,9 +1753,9 @@ function clearFilter() { pmh.type AS maint_type FROM plugin_webseer_urls AS u LEFT JOIN plugin_maint_hosts AS pmh - ON (u.id = pmh.host - AND pmh.type = ? - AND pmh.schedule = ?) + ON u.id = pmh.host + AND pmh.type = ? + AND pmh.schedule = ? $sql_where LIMIT " . ($rows * (get_request_var('page') - 1)) . ',' . $rows; @@ -1778,7 +1772,7 @@ function clearFilter() { print $nav; - html_start_box('', '100%', '', '3', 'center', ''); + html_start_box('', '100%', false, 3, 'center', ''); $display_text = [ __('Description', 'maint'), @@ -1803,8 +1797,7 @@ function clearFilter() { $names = ''; } - $lists = db_fetch_assoc_prepared( - 'SELECT name + $lists = db_fetch_assoc_prepared('SELECT name FROM plugin_maint_schedules INNER JOIN plugin_maint_hosts ON plugin_maint_schedules.id = plugin_maint_hosts.schedule @@ -1944,7 +1937,7 @@ function clearFilter() { @@ -2022,13 +2015,12 @@ function clearFilter() { if ($schedule_created) { $sql_params = array_merge([get_request_var('id'), MAINT_HOST_TYPE_SERVCHECK], $sql_where_params); - $total_rows = db_fetch_cell_prepared( - "SELECT COUNT(*) + $total_rows = db_fetch_cell_prepared("SELECT COUNT(*) FROM plugin_servcheck_test AS t LEFT JOIN plugin_maint_hosts AS pmh - ON (t.id = pmh.host - AND pmh.type = ? - AND pmh.schedule = ?) + ON t.id = pmh.host + AND pmh.type = ? + AND pmh.schedule = ? $sql_where", $sql_params, ); @@ -2039,9 +2031,9 @@ function clearFilter() { pmh.type AS maint_type FROM plugin_servcheck_test AS t LEFT JOIN plugin_maint_hosts AS pmh - ON (t.id = pmh.host - AND pmh.type = ? - AND pmh.schedule = ?) + ON t.id = pmh.host + AND pmh.type = ? + AND pmh.schedule = ? $sql_where LIMIT " . ($rows * (get_request_var('page') - 1)) . ',' . $rows; @@ -2058,7 +2050,7 @@ function clearFilter() { print $nav; - html_start_box('', '100%', '', '3', 'center', ''); + html_start_box('', '100%', false, 3, 'center', ''); $display_text = [ __('Description', 'maint'), @@ -2083,8 +2075,7 @@ function clearFilter() { $names = ''; } - $lists = db_fetch_assoc_prepared( - 'SELECT name + $lists = db_fetch_assoc_prepared('SELECT name FROM plugin_maint_schedules INNER JOIN plugin_maint_hosts ON plugin_maint_schedules.id = plugin_maint_hosts.schedule diff --git a/setup.php b/setup.php index 8b495a9..20cff71 100644 --- a/setup.php +++ b/setup.php @@ -298,8 +298,8 @@ function maint_device_action_prepare(array $save): array { } // Load schedules to choose from - $schedules = db_fetch_assoc('SELECT id, name, enabled, mtype, stime, etime, minterval - FROM plugin_maint_schedules + $schedules = db_fetch_assoc('SELECT id, name, enabled, mtype, stime, etime, minterval + FROM plugin_maint_schedules ORDER BY name'); $select = " - + $save_html @@ -462,6 +464,8 @@ function form_actions(): void { html_start_box($assoc_actions[get_request_var('drp_action')] . ' ' . __('Device(s)', 'maint'), '60%', false, 3, 'center', ''); + $save_html = ''; + if (cacti_sizeof($array)) { if (get_request_var('drp_action') == '1') { // associate print " @@ -494,7 +498,7 @@ function form_actions(): void { - + $save_html @@ -530,6 +534,8 @@ function form_actions(): void { html_start_box($assoc_actions[get_request_var('drp_action')] . ' ' . __('Webseer(s)', 'maint'), '60%', false, 3, 'center', ''); + $save_html = ''; + if (cacti_sizeof($array)) { if (get_request_var('drp_action') == '1') { // associate print " @@ -562,7 +568,7 @@ function form_actions(): void { - + $save_html @@ -1788,7 +1794,7 @@ function clearFilter() { if (cacti_sizeof($urls)) { foreach ($urls as $url) { form_alternate_row('line' . $url['id']); - form_selectable_cell(filter_value($url['display_name'], get_request_var('filter')), $url['id'], 250); + form_selectable_cell(filter_value($url['display_name'], get_request_var('filter')), $url['id'], '250'); form_selectable_cell(round(($url['id']), 2), $url['id']); if ($url['associated'] != '') { @@ -2066,7 +2072,7 @@ function clearFilter() { if (cacti_sizeof($tests)) { foreach ($tests as $test) { form_alternate_row('line' . $test['id']); - form_selectable_cell(filter_value($test['display_name'], get_request_var('filter')), $test['id'], 250); + form_selectable_cell(filter_value($test['display_name'], get_request_var('filter')), $test['id'], '250'); form_selectable_cell(round(($test['id']), 2), $test['id']); if ($test['associated'] != '') { From 5e1c3db82f5dd7b95401ee7c3383c1655a3ea6a4 Mon Sep 17 00:00:00 2001 From: TheWitness Date: Thu, 29 Jan 2026 14:34:09 -0500 Subject: [PATCH 3/6] Fixing some PHPStan issues --- maint.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/maint.php b/maint.php index 2a6177f..2f96c43 100644 --- a/maint.php +++ b/maint.php @@ -397,6 +397,8 @@ function form_actions(): void { html_start_box($actions[get_request_var('drp_action')] . " $list_name", '60%', false, 3, 'center', ''); + $save_html = ''; + if (cacti_sizeof($array)) { if (get_request_var('drp_action') == '1') { // update print " @@ -604,6 +606,8 @@ function form_actions(): void { html_start_box($assoc_actions[get_request_var('drp_action')] . ' ' . __('Servcheck(s)', 'maint'), '60%', false, 3, 'center', ''); + $save_html = ''; + if (cacti_sizeof($array)) { if (get_request_var('drp_action') == '1') { // associate print " @@ -636,7 +640,7 @@ function form_actions(): void { - + $save_html From 7adcac981d032bc5ed35f8c0ac9d92ec59d66ad0 Mon Sep 17 00:00:00 2001 From: TheWitness Date: Thu, 29 Jan 2026 14:40:58 -0500 Subject: [PATCH 4/6] One more matrix OS --- .github/workflows/plugin-ci-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/plugin-ci-workflow.yml b/.github/workflows/plugin-ci-workflow.yml index af4c80e..634160c 100644 --- a/.github/workflows/plugin-ci-workflow.yml +++ b/.github/workflows/plugin-ci-workflow.yml @@ -38,7 +38,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.1', '8.2', '8.3'] + php: ['8.1', '8.2', '8.3', '8.4'] os: [ubuntu-latest] services: From a6f62bd2439052a170b7f446850bd60b5f8aae4c Mon Sep 17 00:00:00 2001 From: TheWitness Date: Thu, 29 Jan 2026 14:47:13 -0500 Subject: [PATCH 5/6] Attempt to incorporate org secrets --- .github/workflows/plugin-ci-workflow.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/plugin-ci-workflow.yml b/.github/workflows/plugin-ci-workflow.yml index 634160c..eb60cb7 100644 --- a/.github/workflows/plugin-ci-workflow.yml +++ b/.github/workflows/plugin-ci-workflow.yml @@ -47,8 +47,8 @@ jobs: env: MYSQL_ROOT_PASSWORD: cactiroot MYSQL_DATABASE: cacti - MYSQL_USER: cactiuser - MYSQL_PASSWORD: cactiuser + MYSQL_USER: ${{ secrets.CACTI_MYSQL_USER }} + MYSQL_PASSWORD: ${{ secrets.CACTI_MYSQL_PASSWORD }} ports: - 3306:3306 options: >- @@ -110,9 +110,9 @@ jobs: MYSQL_AUTH_USR: '--defaults-file=~/.my.cnf' run: | mysql $MYSQL_AUTH_USR -e 'CREATE DATABASE IF NOT EXISTS cacti;' - mysql $MYSQL_AUTH_USR -e "CREATE USER IF NOT EXISTS 'cactiuser'@'localhost' IDENTIFIED BY 'cactiuser';" - mysql $MYSQL_AUTH_USR -e "GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost';" - mysql $MYSQL_AUTH_USR -e "GRANT SELECT ON mysql.time_zone_name TO 'cactiuser'@'localhost';" + mysql $MYSQL_AUTH_USR -e "CREATE USER IF NOT EXISTS '${{ secrets.CACTI_MYSQL_USER }}'@'localhost' IDENTIFIED BY '${{ secrets.CACTI_MYSQL_PASSWORD }}';" + mysql $MYSQL_AUTH_USR -e "GRANT ALL PRIVILEGES ON cacti.* TO '${{ secrets.CACTI_MYSQL_USER }}'@'localhost';" + mysql $MYSQL_AUTH_USR -e "GRANT SELECT ON mysql.time_zone_name TO '${{ secrets.CACTI_MYSQL_USER }}'@'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 @@ -136,8 +136,8 @@ jobs: cat ${{ github.workspace }}/cacti/include/config.php.dist | \ sed -r "s/localhost/127.0.0.1/g" | \ sed -r "s/'cacti'/'cacti'/g" | \ - sed -r "s/'cactiuser'/'cactiuser'/g" | \ - sed -r "s/'cactiuser'/'cactiuser'/g" > ${{ github.workspace }}/cacti/include/config.php + sed -r "s/'cactiuser'/'${{ secrets.CACTI_MYSQL_USER }}'/g" | \ + sed -r "s/'cactiuser'/'${{ secrets.CACTI_MYSQL_USER }}'/g" > ${{ github.workspace }}/cacti/include/config.php sudo chmod 664 ${{ github.workspace }}/cacti/include/config.php - name: Configure Apache From 5a008df4956de56936e2c0329980510bb09ea61a Mon Sep 17 00:00:00 2001 From: TheWitness Date: Thu, 29 Jan 2026 14:51:43 -0500 Subject: [PATCH 6/6] Reverting secrets changes for now --- .github/workflows/plugin-ci-workflow.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/plugin-ci-workflow.yml b/.github/workflows/plugin-ci-workflow.yml index eb60cb7..634160c 100644 --- a/.github/workflows/plugin-ci-workflow.yml +++ b/.github/workflows/plugin-ci-workflow.yml @@ -47,8 +47,8 @@ jobs: env: MYSQL_ROOT_PASSWORD: cactiroot MYSQL_DATABASE: cacti - MYSQL_USER: ${{ secrets.CACTI_MYSQL_USER }} - MYSQL_PASSWORD: ${{ secrets.CACTI_MYSQL_PASSWORD }} + MYSQL_USER: cactiuser + MYSQL_PASSWORD: cactiuser ports: - 3306:3306 options: >- @@ -110,9 +110,9 @@ jobs: MYSQL_AUTH_USR: '--defaults-file=~/.my.cnf' run: | mysql $MYSQL_AUTH_USR -e 'CREATE DATABASE IF NOT EXISTS cacti;' - mysql $MYSQL_AUTH_USR -e "CREATE USER IF NOT EXISTS '${{ secrets.CACTI_MYSQL_USER }}'@'localhost' IDENTIFIED BY '${{ secrets.CACTI_MYSQL_PASSWORD }}';" - mysql $MYSQL_AUTH_USR -e "GRANT ALL PRIVILEGES ON cacti.* TO '${{ secrets.CACTI_MYSQL_USER }}'@'localhost';" - mysql $MYSQL_AUTH_USR -e "GRANT SELECT ON mysql.time_zone_name TO '${{ secrets.CACTI_MYSQL_USER }}'@'localhost';" + mysql $MYSQL_AUTH_USR -e "CREATE USER IF NOT EXISTS 'cactiuser'@'localhost' IDENTIFIED BY 'cactiuser';" + mysql $MYSQL_AUTH_USR -e "GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost';" + 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 @@ -136,8 +136,8 @@ jobs: cat ${{ github.workspace }}/cacti/include/config.php.dist | \ sed -r "s/localhost/127.0.0.1/g" | \ sed -r "s/'cacti'/'cacti'/g" | \ - sed -r "s/'cactiuser'/'${{ secrets.CACTI_MYSQL_USER }}'/g" | \ - sed -r "s/'cactiuser'/'${{ secrets.CACTI_MYSQL_USER }}'/g" > ${{ github.workspace }}/cacti/include/config.php + sed -r "s/'cactiuser'/'cactiuser'/g" | \ + sed -r "s/'cactiuser'/'cactiuser'/g" > ${{ github.workspace }}/cacti/include/config.php sudo chmod 664 ${{ github.workspace }}/cacti/include/config.php - name: Configure Apache