<?php

\session_start();
\ob_start();
include './common.php';
use Ministra\Lib\Admin;
use Ministra\Lib\AdminAccess;
use Ministra\Lib\w13ec15f0067ea75861e61e27c990e4ba\d3507c2999d38573a0a0c91771d70af2;
use Ministra\Lib\Video;
use Ministra\Lib\VideoMaster;
$error = '';
\Ministra\Lib\Admin::checkAuth();
\Ministra\Lib\Admin::checkAccess(\Ministra\Lib\AdminAccess::ACCESS_VIEW);
if (@$_GET['id']) {
    $task_id = (int) $_GET['id'];
    \Ministra\Lib\Admin::checkAccess(\Ministra\Lib\AdminAccess::ACCESS_EDIT);
    $task = \Ministra\Lib\w13ec15f0067ea75861e61e27c990e4ba\d3507c2999d38573a0a0c91771d70af2::getInstance()->from('moderator_tasks')->where(['id' => $task_id])->get()->first();
    $moderator_id = $task['to_usr'];
    $video_id = $task['media_id'];
    $action = "<a href=\\'msgs.php?task={$task_id}\\'>" . \_('task done') . '</a>';
    \Ministra\Lib\w13ec15f0067ea75861e61e27c990e4ba\d3507c2999d38573a0a0c91771d70af2::getInstance()->insert('video_log', ['action' => $action, 'video_id' => $video_id, 'moderator_id' => $moderator_id, 'actiontime' => 'NOW()']);
    \Ministra\Lib\w13ec15f0067ea75861e61e27c990e4ba\d3507c2999d38573a0a0c91771d70af2::getInstance()->update('moderator_tasks', ['ended' => 1, 'end_time' => 'NOW()'], ['id' => (int) $_GET['id']]);
    $video = \Ministra\Lib\Video::getById($video_id);
    $path = $video['path'];
    $master = new \Ministra\Lib\VideoMaster();
    try {
        $master->startMD5SumInAllStorages($path);
    } catch (\Exception $exception) {
    }
    \header('Location: tasks.php');
    exit;
}
