* @license https://files.froxlor.org/misc/COPYING.txt GPLv2 */ const AREA = 'admin'; require __DIR__ . '/lib/init.php'; use Froxlor\Api\Commands\SysLog; use Froxlor\UI\Collection; use Froxlor\UI\HTML; use Froxlor\UI\Listing; use Froxlor\UI\Panel\UI; use Froxlor\UI\Request; use Froxlor\UI\Response; if ($page == 'log' && $userinfo['change_serversettings'] == '1') { if ($action == '') { try { $syslog_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/tablelisting.syslog.php'; $collection = (new Collection(SysLog::class, $userinfo)) ->withPagination($syslog_list_data['syslog_list']['columns'], $syslog_list_data['syslog_list']['default_sorting']); } catch (Exception $e) { Response::dynamicError($e->getMessage()); } UI::view('user/table.html.twig', [ 'listing' => Listing::format($collection, $syslog_list_data, 'syslog_list'), 'actions_links' => [ [ 'href' => $linker->getLink(['section' => 'logger', 'page' => 'log', 'action' => 'truncate']), 'label' => lng('logger.truncate'), 'icon' => 'fa-solid fa-recycle', 'class' => 'btn-warning' ] ] ]); } elseif ($action == 'truncate') { if (Request::post('send') == 'send') { try { SysLog::getLocal($userinfo, [ 'min_to_keep' => 10 ])->delete(); } catch (Exception $e) { Response::dynamicError($e->getMessage()); } Response::redirectTo($filename, [ 'page' => $page ]); } else { HTML::askYesNo('logger_reallytruncate', $filename, [ 'page' => $page, 'action' => $action ], TABLE_PANEL_LOG); } } }