Skip to content

Database setup duplicates the Default site when rerun #357

Description

@somethingwithproof

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

QABug found in QAbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions