3 namespace Friendica\Module\Admin\Logs;
5 use Friendica\Core\Config;
6 use Friendica\Core\L10n;
7 use Friendica\Core\Renderer;
8 use Friendica\Module\BaseAdminModule;
9 use Friendica\Util\Strings;
11 class View extends BaseAdminModule
13 public static function content(array $parameters = [])
15 parent::content($parameters);
17 $t = Renderer::getMarkupTemplate('admin/logs/view.tpl');
18 $f = Config::get('system', 'logfile');
21 if (!file_exists($f)) {
22 $data = DI::l10n()->t('Error trying to open <strong>%1$s</strong> log file.\r\n<br/>Check to see if file %1$s exist and is readable.', $f);
26 $data = DI::l10n()->t('Couldn\'t open <strong>%1$s</strong> log file.\r\n<br/>Check to see if file %1$s is readable.', $f);
29 $size = $fstat['size'];
31 if ($size > 5000000 || $size < 0) {
34 $seek = fseek($fp, 0 - $size, SEEK_END);
36 $data = Strings::escapeHtml(fread($fp, $size));
38 $data .= Strings::escapeHtml(fread($fp, 4096));
45 return Renderer::replaceMacros($t, [
46 '$title' => DI::l10n()->t('Administration'),
47 '$page' => DI::l10n()->t('View Logs'),
49 '$logname' => Config::get('system', 'logfile')