Switch admin/API flows to article IDs with legacy job fallback

This commit is contained in:
hbrain 2026-05-31 18:04:21 +02:00
parent 3cc2828bc0
commit efcf87d00c
5 changed files with 205 additions and 67 deletions

View file

@ -10,8 +10,12 @@ foreach ($dirs as $dir) {
$name = basename($dir);
$stateFile = $dir . '/.movmaker-state.json';
$lockDir = $dir . '/.movmaker-lock';
$idFile = $dir . '/.mvlog-id';
$state = is_file($stateFile) ? json_decode((string)file_get_contents($stateFile), true) : [];
$status = is_array($state) ? (string)($state['status'] ?? '') : '';
$articleId = is_array($state) ? strtolower((string)($state['article_id'] ?? '')) : '';
if ($articleId === '' && is_file($idFile)) $articleId = strtolower(trim((string)file_get_contents($idFile)));
if (!preg_match('/^[0-9]{14}[a-f0-9]{16}$/', $articleId)) $articleId = '';
$locked = is_dir($lockDir);
if ($locked || $status === 'processing') {
$started = '';
@ -19,6 +23,7 @@ foreach ($dirs as $dir) {
if ($started === '' && is_array($state)) $started = (string)($state['started_at'] ?? $state['updated_at'] ?? '');
$jobs[] = [
'name' => $name,
'id' => $articleId,
'status' => $status ?: ($locked ? 'processing' : 'unknown'),
'started_at' => $started,
];