Dashboard
Development
Checking...
Diagnostic Tools
Check Stats
check-stats.php
Dumps all campaigns, generated links, and campaign assignments with partner details. Use when data looks wrong and you need to see what's actually in the database.
Debug Partner Links
debug-links.php
Shows what the Partner API returns for a specific partner — memberships, campaigns, and tracked links grouped by Space. Pass ?email= to target a specific partner.
Health Check
health.php
Confirms the API is running, the database is accessible, and shows PHP/SQLite versions plus campaign and partner counts.
Database Repair
Fix Duplicate Partners
fix-duplicate-partners.php
Merges partner rows that share the same email (caused by race conditions when GHL fires multiple webhooks). Re-links all assignments, links, and tokens to a single canonical partner ID. Safe to run multiple times.
Fix Duplicate Campaigns
fix-duplicates.php
Finds campaigns with the same base URL within a Space and merges them — keeping the one with the most activity (shares/clicks) and transferring assignments from the duplicate. Uses the newest name.
Fix Partner Stats
fix-partners.php
One-time fix script that merges stats (shares, clicks) from an old duplicate partner into the current one. Has hardcoded partner IDs — check the file before running.
Fix Campaign URLs
fix-url.php
Corrects a specific wrong URL path in campaigns and regenerates all associated tracked links. Has hardcoded paths — check the file before running.
Database Management
Seed Database
seed.php
Initialises the database schema (tables and indexes). Safe to run multiple times — uses IF NOT EXISTS. Run after a reset or on first deploy.
Reset Database
reset-db.php
Deletes the SQLite database file (and WAL/SHM files). All data will be lost. Run seed.php afterwards to recreate the schema. Only use in development.
Output