148 lines
4.8 KiB
PHP
148 lines
4.8 KiB
PHP
<?php
|
|
require_once __DIR__ . '/bootstrap.php';
|
|
|
|
$statusCode = 200;
|
|
$result = [
|
|
'success' => false,
|
|
'message' => 'Schema not checked yet.',
|
|
];
|
|
|
|
try {
|
|
clm_ensure_schema();
|
|
$result = [
|
|
'success' => true,
|
|
'message' => 'Central License Manager schema is ready.',
|
|
];
|
|
} catch (Throwable $e) {
|
|
$result = [
|
|
'success' => false,
|
|
'message' => $e->getMessage(),
|
|
];
|
|
$statusCode = 500;
|
|
}
|
|
|
|
if (PHP_SAPI === 'cli') {
|
|
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . PHP_EOL;
|
|
exit($result['success'] ? 0 : 1);
|
|
}
|
|
|
|
if (isset($_GET['json'])) {
|
|
clm_json($result, $statusCode);
|
|
}
|
|
|
|
$tables = clm_tables();
|
|
$baseUrl = clm_base_url();
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Install Central License Manager</title>
|
|
<meta name="description" content="Install and validate the standalone Central License Manager schema.">
|
|
<meta name="robots" content="noindex, nofollow">
|
|
<style>
|
|
:root {
|
|
--bg: #f7f9fc;
|
|
--card: #ffffff;
|
|
--text: #0f172a;
|
|
--muted: #64748b;
|
|
--line: #d9e2ec;
|
|
--accent: #0ea5e9;
|
|
--good: #15803d;
|
|
--bad: #b91c1c;
|
|
}
|
|
* { box-sizing: border-box; }
|
|
body {
|
|
margin: 0;
|
|
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
background: radial-gradient(circle at top left, rgba(14,165,233,0.14), transparent 26%), var(--bg);
|
|
color: var(--text);
|
|
}
|
|
main { max-width: 960px; margin: 0 auto; padding: 32px 20px 48px; }
|
|
.card {
|
|
background: var(--card);
|
|
border: 1px solid var(--line);
|
|
border-radius: 24px;
|
|
padding: 24px;
|
|
box-shadow: 0 20px 45px rgba(15, 23, 42, 0.07);
|
|
margin-bottom: 20px;
|
|
}
|
|
h1, h2 { margin: 0 0 12px; }
|
|
p { color: var(--muted); line-height: 1.65; }
|
|
.status { font-weight: 800; }
|
|
.ok { color: var(--good); }
|
|
.bad { color: var(--bad); }
|
|
.code {
|
|
display: block;
|
|
margin-top: 12px;
|
|
background: #0f172a;
|
|
color: #e2e8f0;
|
|
padding: 14px 16px;
|
|
border-radius: 18px;
|
|
overflow-x: auto;
|
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
font-size: 13px;
|
|
}
|
|
ul { color: var(--muted); padding-left: 20px; }
|
|
a {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 12px 18px;
|
|
border-radius: 16px;
|
|
background: linear-gradient(135deg, #0ea5e9, #0284c7);
|
|
color: white;
|
|
text-decoration: none;
|
|
font-weight: 700;
|
|
margin-right: 10px;
|
|
}
|
|
a.alt {
|
|
background: white;
|
|
color: var(--text);
|
|
border: 1px solid var(--line);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<section class="card">
|
|
<h1>Central License Manager installer</h1>
|
|
<p class="status <?= !empty($result['success']) ? 'ok' : 'bad' ?>">
|
|
<?= !empty($result['success']) ? 'Schema ready' : 'Schema check failed' ?>
|
|
</p>
|
|
<p><?= clm_html($result['message']) ?></p>
|
|
<div>
|
|
<a href="manage.php">Open manager</a>
|
|
<a class="alt" href="index.php">Back to landing</a>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<h2>Current configuration mode</h2>
|
|
<p><?= clm_html(clm_manager_mode_label()) ?></p>
|
|
<span class="code">LICENSE_API_URL=<?= clm_html($baseUrl) ?></span>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<h2>Managed tables</h2>
|
|
<ul>
|
|
<li><code><?= clm_html($tables['apps']) ?></code></li>
|
|
<li><code><?= clm_html($tables['licenses']) ?></code></li>
|
|
<li><code><?= clm_html($tables['activations']) ?></code></li>
|
|
</ul>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<h2>Move this folder later</h2>
|
|
<ul>
|
|
<li>Copy the whole <code>central_license_manager/</code> folder to the new host.</li>
|
|
<li>Set <code>CLM_DB_*</code>, <code>CLM_API_SECRET</code>, and <code>CLM_ADMIN_PASSWORD</code> there.</li>
|
|
<li>Open this page once on the new server to auto-create the schema again.</li>
|
|
<li>Point each app to the new base URL using <code>LICENSE_API_URL</code>.</li>
|
|
</ul>
|
|
</section>
|
|
</main>
|
|
</body>
|
|
</html>
|