17 lines
1.0 KiB
PHP
17 lines
1.0 KiB
PHP
<?php
|
|||
|
|
/**
|
||
|
|
* Used by scripts/e2e-sitesmith.mjs (scenario 8n): runs the REAL WHP review lockdown on what the editor sent.
|
||
|
|
* stdin {summary, proposed:[ops with alias ids]} -> stdout {summary: server-rebuilt summary | null, alias, ops, dropped}
|
||
|
|
* (api/sitesmith.php sitesmith_review_rebuild_summary + Sitesmith::reviewFilterOps). Offline, no model call.
|
||
|
|
* Usage: php e2e-sitesmith-review-backend.php <backend repo dir>
|
||
|
|
*/
|
||
|
|
ob_start();
|
||
|
|
define('SITESMITH_API_LIBRARY_ONLY', true);
|
||
|
|
$dir = rtrim($argv[1], '/');
|
||
|
|
require_once $dir . '/web-files/libs/Sitesmith.php';
|
||
|
|
require $dir . '/web-files/api/sitesmith.php';
|
||
|
|
ob_end_clean();
|
||
|
|
$in = json_decode(stream_get_contents(STDIN), true);
|
||
|
|
$rb = sitesmith_review_rebuild_summary((string)($in['summary'] ?? ''));
|
||
|
|
$f = $rb === null ? ['ops' => [], 'dropped' => []] : Sitesmith::reviewFilterOps((array)($in['proposed'] ?? []), $rb['alias']);
|
||
|
|
echo json_encode(['summary' => $rb['summary'] ?? null, 'alias' => $rb['alias'] ?? null, 'ops' => $f['ops'], 'dropped' => (object)$f['dropped']], JSON_UNESCAPED_SLASHES);
|