Skip to content

Commit bf55698

Browse files
fix: address copilot review feedback on PR Cacti#283
- LICENSE: remove stale conflict markers - database.php: restore backward-compat optional param on syslog_db_fetch_insert_id - js/functions.js: fix missing var declaration, #test->#term, prop('disabled'), remove empty .each() - CI workflow: authenticate MySQL healthcheck, remove password echo - populate script: INSERT -> REPLACE INTO for idempotent reruns - README.md: fix malformed code fence - locales: add exit after redirect, fix sed -i for macOS compat - es-ES.po: fix 'Cactus' -> 'Cacti', 'Depuraración' -> 'Depuración' Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
1 parent fd31cd7 commit bf55698

File tree

10 files changed

+22
-21
lines changed

10 files changed

+22
-21
lines changed

.github/workflows/plugin-ci-workflow.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
ports:
5353
- 3306:3306
5454
options: >-
55-
--health-cmd="mysqladmin ping"
55+
--health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -pcactiroot"
5656
--health-interval=10s
5757
--health-timeout=5s
5858
--health-retries=3
@@ -104,7 +104,6 @@ jobs:
104104
- name: Create MySQL Config
105105
run: |
106106
echo -e "[client]\nuser = root\npassword = cactiroot\nhost = 127.0.0.1\n" > ~/.my.cnf
107-
cat ~/.my.cnf
108107
109108
- name: Initialize Cacti Database
110109
env:

.github/workflows/populate_syslog_incoming.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
ITERATIONS=100
66

77

8-
SQL_ALERT_RULE_INSERT="INSERT INTO syslog_alert (id,hash,name,severity,method,level,num,type,enabled,repeat_alert,open_ticket,message,body,user,date,email,notify,command,notes)
8+
SQL_ALERT_RULE_INSERT="REPLACE INTO syslog_alert (id,hash,name,severity,method,level,num,type,enabled,repeat_alert,open_ticket,message,body,user,date,email,notify,command,notes)
99
VALUES (1,'8f440030d3425e37cb66e5df54902bb0','interface down alert',1,0,1,1,'messageb','on',0,'','interface down','admin',1767376990,NULL,0,NULL,NULL);"
1010

11-
SQL_REMOVAL_RULE_INSERT="INSERT INTO syslog_remove (id,hash,name,type,enabled,method,message,user,date,notes)
11+
SQL_REMOVAL_RULE_INSERT="REPLACE INTO syslog_remove (id,hash,name,type,enabled,method,message,user,date,notes)
1212
VALUES (1,'0faf589f7b6b7da1bcec40b92340487d','exploded','messageb','on','del',
1313
'the box exploded','admin',1767376604,NULL);"
1414

LICENSE

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,4 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277277
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278278
POSSIBILITY OF SUCH DAMAGES.
279279

280-
<<<<<<< Updated upstream
281-
=======
282280
END OF TERMS AND CONDITIONS
283-
>>>>>>> Stashed changes

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ To use a dedicated DB first create a database in mysql and assign a user you wil
8686
$use_cacti_db = true;
8787
```
8888

89-
to
89+
to
9090

91-
``console
91+
```console
9292
$use_cacti_db = false;
9393
```
9494

database.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,12 @@ function syslog_db_fetch_assoc_prepared($sql, $params = array(), $log = TRUE) {
174174
*
175175
* @return the id of the last auto incriment row that was created
176176
*/
177-
function syslog_db_fetch_insert_id() {
178-
global $syslog_cnn;
179-
return db_fetch_insert_id($syslog_cnn);
177+
function syslog_db_fetch_insert_id($syslog_cnn = null) {
178+
if ($syslog_cnn === null) {
179+
global $syslog_cnn;
180+
}
181+
182+
return db_fetch_insert_id($syslog_cnn);
180183
}
181184

182185
/**

js/functions.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Clear filter for statistics view
1212
*/
1313
function clearFilterStats() {
14-
strURL = 'syslog.php?tab=stats&clear=1&header=false';
14+
var strURL = 'syslog.php?tab=stats&clear=1&header=false';
1515
loadPageNoHeader(strURL);
1616
}
1717

@@ -196,7 +196,7 @@ function initSyslogMain(config) {
196196
$(this).multiselect('widget').find(':checkbox:first').each(function() {
197197
$(this).prop('checked', true);
198198
});
199-
$('#test').trigger('keyup');
199+
$('#term').trigger('keyup');
200200
},
201201
checkAll: function() {
202202
$(this).multiselect('widget').find(':checkbox').not(':first').each(function() {
@@ -253,7 +253,7 @@ function initSyslogMain(config) {
253253
if (checked > 0) {
254254
$(this).multiselect('widget').find(':checkbox:first').each(function() {
255255
$(this).click();
256-
$(this).prop('disable', true);
256+
$(this).prop('disabled', true);
257257
});
258258
}
259259
}
@@ -658,7 +658,7 @@ function initSyslogAutocomplete(formName, callback, onChange) {
658658
}, 800);
659659
});
660660

661-
$('ul[id^="ui-id"] > li').each().on('mouseenter', function() {
661+
$('ul[id^="ui-id"] > li').on('mouseenter', function() {
662662
$(this).addClass('ui-state-hover');
663663
}).on('mouseleave', function() {
664664
$(this).removeClass('ui-state-hover');

locales/LC_MESSAGES/index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@
2323
*/
2424

2525
header('Location:../index.php');
26+
exit;
2627

locales/build_gettext.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ cd ${BASE_PATH}
5454

5555
${XGETTEXT_BIN} --no-wrap --copyright-holder="The Cacti Group" --package-name="Cacti" --package-version=`cat include/cacti_version` --msgid-bugs-address="developers@cacti.net" -F -k__gettext -k__ -k__n:1,2 -k__x:1c,2 -k__xn:1c,2,3 -k__esc -k__esc_n:1,2 -k__esc_x:1c,2 -k__esc_xn:1c,2,3 -k__date -o locales/po/cacti.pot `find . -maxdepth 2 -name \*.php`
5656

57-
sed -i 's/FULL NAME <EMAIL@ADDRESS\>/Cacti Developers <developers@cacti.net>/g' locales/po/cacti.pot
58-
sed -i 's/LANGUAGE <LL@li.org>/Cacti Developers <developers@cacti.net>/g' locales/po/cacti.pot
59-
sed -i 's/CHARSET/UTF-8/g' locales/po/cacti.pot
57+
sed -i '' 's/FULL NAME <EMAIL@ADDRESS\>/Cacti Developers <developers@cacti.net>/g' locales/po/cacti.pot
58+
sed -i '' 's/LANGUAGE <LL@li.org>/Cacti Developers <developers@cacti.net>/g' locales/po/cacti.pot
59+
sed -i '' 's/CHARSET/UTF-8/g' locales/po/cacti.pot
6060

6161
# Merge any changes to POT file into language files
6262
echo "Merging updates to language files..."

locales/index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@
2323
*/
2424

2525
header('Location:../index.php');
26+
exit;
2627

locales/po/es-ES.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ msgstr ""
2020

2121
#: functions.php:72
2222
msgid "Save Failed. Remote Data Collectors in Sync Mode are not allowed to Save Rules. Save from the Main Cacti Server instead."
23-
msgstr "Error al guardar. Los recopiladores de datos remotos en modo de sincronización no pueden guardar reglas. En su lugar, guarde desde el servidor principal de Cactus."
23+
msgstr "Error al guardar. Los recopiladores de datos remotos en modo de sincronización no pueden guardar reglas. En su lugar, guarde desde el servidor principal de Cacti."
2424

2525
#: functions.php:116
2626
msgid "Please use an HTML Email Client"
@@ -951,7 +951,7 @@ msgstr "Información"
951951

952952
#: syslog.php:1633 syslog.php:1699
953953
msgid "Debug"
954-
msgstr "Depuraración"
954+
msgstr "Depuración"
955955

956956
#: syslog.php:1638
957957
msgid "Record Type"

0 commit comments

Comments
 (0)