feat: готовый бренд ZoomStage и минимальный доменный подвал (refs #12)
deploy-preland / deploy zoomstage.online (push) Successful in 44s
deploy-preland / deploy zoomstage.online (push) Successful in 44s
This commit is contained in:
1 parent
a2c3197a16
commit
ec087ea636
24 files changed
+365
-237
No files matched your search
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/** Отдельная явно согласованная миграция бренда. Обычная code-поставка SVG не пишет. */
|
||||
declare(strict_types=1);
|
||||
require __DIR__ . '/brand-contract.php';
|
||||
try {
|
||||
$mode = $argv[1] ?? ''; $url = $argv[2] ?? '';
|
||||
if (!preg_match('~^https://([a-z0-9.-]+)$~D', $url, $match)) throw new RuntimeException('Требуется HTTPS origin цели');
|
||||
$brand = prelandBrand(dirname(__DIR__), $match[1]);
|
||||
if ($mode === '--files') {
|
||||
foreach ($brand['logos'] as $target => $record) echo $record['file'], ' ', $target, "\n";
|
||||
exit(0);
|
||||
}
|
||||
if ($mode !== '--status') throw new RuntimeException('Неизвестный режим бренда');
|
||||
$actual = []; $expected = [];
|
||||
foreach ($brand['logos'] as $target => $record) {
|
||||
$context = stream_context_create(['http' => ['timeout' => 30, 'header' => "Cache-Control: no-cache\r\n"]]);
|
||||
$body = @file_get_contents($url . '/' . $target . '?brand_check=' . $record['sha256'], false, $context);
|
||||
if ($body === false) throw new RuntimeException('Не удалось прочитать бренд цели: ' . $target);
|
||||
$actual[$target] = hash('sha256', str_replace("\r\n", "\n", $body));
|
||||
$expected[$target] = $record['sha256'];
|
||||
}
|
||||
$state = prelandBrandState($actual, $brand);
|
||||
if ($state === 0) { echo "OK: доменный бренд совпал; SVG не перезаписываются\n"; exit(0); }
|
||||
if ($state === 10) { echo "Разрешена точная миграция бренда по preland#12\n"; exit(10); }
|
||||
throw new RuntimeException('На хосте другой бренд: обычный deploy не имеет права его менять');
|
||||
} catch (Throwable $error) { fwrite(STDERR, $error->getMessage() . "\n"); exit(1); }
|
||||
Reference in new issue
Block a user