seedproject-web/api/cli/rebuild.php

21 lines
751 B
PHP
Raw Permalink Normal View History

<?php
/**
* Queue a static-site rebuild.
*
* Sets the sp_settings 'rebuild_pending' flag that scripts/deploy-watch.sh polls (~every 3
* min) and clears after building. Run this after a MANUAL database edit e.g. adding a
* directory listing or a link so the change gets baked into the static pages.
*
* php api/cli/rebuild.php
*/
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../config.php';
\Db::execute("DELETE FROM sp_settings WHERE keyval = 'rebuild_pending'");
\Db::execute(
"INSERT INTO sp_settings (keyval, `group`, metval, status) VALUES ('rebuild_pending', 'deploy', ?, 1)",
[json_encode(['at' => date('c'), 'by' => 'cli'])]
);
echo "Rebuild queued — deploy-watch will build within ~3 min.\n";