<?php
require __DIR__ . '/../../app/bootstrap.php';
require __DIR__ . '/../../app/database.php';
require_login();
session_write_close();
ignore_user_abort(true);
@set_time_limit(0);

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

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