Skip to content

Commit f51d319

Browse files
committed
Fixing Cacti#5628 - Argument --with-profile not used
Argument '--with-profile' is a invalid arg of cli/import_package.php
1 parent dae1025 commit f51d319

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Cacti CHANGELOG
22

33
1.2.27
44
-issue#5622: Errors and deprecation warnings with PHP 8.3.0
5+
-issue#5628: Argument '--with-profile' is a invalid arg of cli/import_package.php
56
-issue#5629: auth_changepassword.php cannot return to the refer url by just clicking the "Return" button once
67
-issue#5636: Cacti 1.2.26 error on LDAP authentication the first time
78
-issue#5638: Add tooltip info about IPv6 address

cli/import_package.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
$preview_only = false;
5151
$info_only = false;
5252
$profile_id = '';
53+
$profile_set = false;
5354

5455
foreach($parms as $parameter) {
5556
if (strpos($parameter, '=')) {
@@ -63,6 +64,17 @@
6364
case '--filename':
6465
$filename = trim($value);
6566

67+
break;
68+
case '--with-profile':
69+
if ($profile_set) {
70+
print 'The argument --with-profile can not be used in conjunction with --profile-id.' . PHP_EOL;
71+
exit(1);
72+
}
73+
74+
$profile_set = true;
75+
76+
$profile_id = db_fetch_cell('SELECT id FROM data_source_profiles WHERE `default` = "on"');
77+
6678
break;
6779
case '--use-profile':
6880
$use_profile = true;
@@ -77,6 +89,13 @@
7789

7890
break;
7991
case '--profile-id':
92+
if ($profile_set) {
93+
print 'The argument --profile-id can not be used in conjunction with --with-profile.' . PHP_EOL;
94+
exit(1);
95+
}
96+
97+
$profile_set = true;
98+
8099
$profile_id = trim($value);
81100

82101
break;

0 commit comments

Comments
 (0)