<?php
require __DIR__ . '/../../app/bootstrap.php';
require __DIR__ . '/../../app/database.php';
require_login();

$taskId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
$status = isset($_GET['status']) ? trim((string)$_GET['status']) : '';
if ($taskId <= 0 || $status === '') {
    redirect('/admin/site-build/index.php?mode=tasklist');
}

try {
    update_article_generation_task_status($taskId, $status);
    redirect('/admin/site-build/index.php?mode=tasklist');
} catch (Exception $e) {
    redirect('/admin/site-build/index.php?mode=tasklist');
}
