Describe the bug
Running mactrack_setup_database() more than once inserts another Default site every time. Schema setup should be idempotent because it is used by install and upgrade paths.
Docker reproduction
The new clean-install E2E suite installed Cacti 1.2.31 and MacTrack, recorded the initial Default-site count, invoked mactrack_setup_database() again, and queried the count afterward.
Observed:
Schema setup is not idempotent: Default site count changed from 1 to 2
Expected: the count remains 1.
Cause
includes/database.php unconditionally inserts the Default site at the end of mactrack_setup_database(), even though the upgrade/setup path elsewhere in the same file already uses a guard.
Describe the bug
Running
mactrack_setup_database()more than once inserts anotherDefaultsite every time. Schema setup should be idempotent because it is used by install and upgrade paths.Docker reproduction
The new clean-install E2E suite installed Cacti 1.2.31 and MacTrack, recorded the initial Default-site count, invoked
mactrack_setup_database()again, and queried the count afterward.Observed:
Expected: the count remains
1.Cause
includes/database.phpunconditionally inserts the Default site at the end ofmactrack_setup_database(), even though the upgrade/setup path elsewhere in the same file already uses a guard.