V94 END auto agent sync
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled

This commit is contained in:
OpusWIRE
2026-04-20 14:24:51 +02:00
parent 0e0f754b2a
commit fb41795eb4
3 changed files with 48 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<?php
$c = pg_connect("host=127.0.0.1 port=5432 dbname=adx_system user=admin password=admin123");
// Find all contacts-like tables
$r = pg_query($c, "SELECT table_schema, table_name FROM information_schema.tables WHERE table_name ILIKE '%contact%' ORDER BY 1,2");
echo "Contact tables:\n";
$tables = [];
while($row = pg_fetch_row($r)) {
$tables[] = "$row[0].$row[1]";
echo " $row[0].$row[1]\n";
}
echo "\nRow counts:\n";
foreach ($tables as $t) {
$r = @pg_query($c, "SELECT COUNT(*) FROM $t");
if ($r) {
$n = pg_fetch_row($r)[0];
echo " $t = $n\n";
}
}
// Find which table has 'orphans_contacts' ref in code or KPI
$r = pg_query($c, "SELECT table_schema, table_name FROM information_schema.columns WHERE column_name = 'company_id' LIMIT 10");
echo "\nTables with company_id column:\n";
while($row = pg_fetch_row($r)) echo " $row[0].$row[1]\n";

11
api/_tmp_kpi_check.php Normal file
View File

@@ -0,0 +1,11 @@
<?php
// Find which DB the KPI feeder uses
$c = pg_connect("host=127.0.0.1 port=5432 dbname=adx_system user=admin password=admin123");
$r = pg_query($c, "SELECT schema_name FROM information_schema.schemata WHERE schema_name NOT LIKE 'pg_%' AND schema_name != 'information_schema'");
echo "Schemas adx_system:\n";
while($row = pg_fetch_row($r)) echo " " . $row[0] . "\n";
// List all tables
$r = pg_query($c, "SELECT table_schema, table_name FROM information_schema.tables WHERE table_type='BASE TABLE' AND table_schema NOT IN ('pg_catalog','information_schema') LIMIT 30");
echo "\nTables:\n";
while($row = pg_fetch_row($r)) echo " $row[0].$row[1]\n";

12
api/_tmp_s95_orph.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
// Run on S95 via sentinel
$cmd = 'sudo -u postgres psql -d admin -tAc "SELECT COUNT(*) FROM crm.contacts WHERE company_id IS NULL"';
echo "Cmd: $cmd\n";
$ch = curl_init("https://wevads.weval-consulting.com/api/sentinel-brain.php");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(["action"=>"exec","cmd"=>$cmd]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$r = curl_exec($ch);
echo "Response: $r\n";