Files
intra.noxus.fi/fix_domains.php
2026-03-10 16:42:44 +02:00

35 lines
1.4 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Väliaikainen skripti: lisää puuttuvat domainit ja branding yrityksille.
*/
ini_set('display_errors', '1');
error_reporting(E_ALL);
require_once __DIR__ . '/db.php';
// Web1 — lisää domain ja subtitle
$web1 = _dbFetchOne("SELECT * FROM companies WHERE id = 'web1'");
if ($web1) {
_dbExecute("UPDATE companies SET subtitle = ? WHERE id = 'web1'", ['Asiakkuudenhallinta']);
// Lisää domain
$existing = _dbFetchColumn("SELECT domain FROM company_domains WHERE company_id = 'web1'");
if (!in_array('intra.web1.fi', $existing)) {
_dbExecute("INSERT INTO company_domains (company_id, domain) VALUES ('web1', 'intra.web1.fi')");
echo "✅ intra.web1.fi lisätty Web1:lle\n";
} else {
echo " intra.web1.fi oli jo Web1:llä\n";
}
echo "✅ Web1 subtitle: Asiakkuudenhallinta\n";
} else {
echo "❌ Web1 yritystä ei löydy!\n";
}
// Noxus — lisää intra.noxus.fi
$existing = _dbFetchColumn("SELECT domain FROM company_domains WHERE company_id = 'noxus'");
// Noxus ei välttämättä ole omana yrityksenä — se on "yleinen" domain
echo "\nKaikki domainit:\n";
$all = _dbFetchAll("SELECT cd.domain, cd.company_id, c.nimi FROM company_domains cd JOIN companies c ON c.id = cd.company_id ORDER BY cd.domain");
foreach ($all as $row) {
echo " {$row['domain']}{$row['nimi']} ({$row['company_id']})\n";
}