<?php

class Changelog extends Frame
{
    protected $template = 'board/changelog.tpl';

    protected function getType()
    {
        return 'changelog';
    }

    public function get_vars()
    {
        $vars = parent::get_vars();

        if (isAutoDeploy()) {
            $vars['deploy_time'] = filemtime(__FILE__);
        }

        $vars['changelog_time'] = getAdminUser()['date_check_changelog'] ?? (new DateTime('yesterday'))->format('c');

        if (getAdminUser()['id']) {
            sqlQuery('UPDATE admins SET date_check_changelog = NOW() WHERE id=:id', ['id' => getAdminUser()['id']]);
        }

        return $vars;
    }
}

return Changelog::class;
