aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/plugins/logviewer
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2023-09-02 14:42:51 +0200
committerGitHub <noreply@github.com>2023-09-02 14:42:51 +0200
commit5ff5424d8c81c7123d8656a787af2ff85b3dec21 (patch)
tree322929ee01d892bb3c927e7fe1238369c647f820 /lib/plugins/logviewer
parent0613df3287b82a98b1e97cf86ed9d4c8fbd16f1c (diff)
parent91560755291852b8302767d454183a7662666f7e (diff)
downloaddokuwiki-5ff5424d8c81c7123d8656a787af2ff85b3dec21.tar.gz
dokuwiki-5ff5424d8c81c7123d8656a787af2ff85b3dec21.zip
Merge pull request #4045 from dokuwiki/autofix
Use Rector to autofix code smell
Diffstat (limited to 'lib/plugins/logviewer')
-rw-r--r--lib/plugins/logviewer/admin.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/plugins/logviewer/admin.php b/lib/plugins/logviewer/admin.php
index 335af4c78..a747686af 100644
--- a/lib/plugins/logviewer/admin.php
+++ b/lib/plugins/logviewer/admin.php
@@ -1,5 +1,7 @@
<?php
+use dokuwiki\Extension\AdminPlugin;
+use dokuwiki\Form\Form;
use dokuwiki\Logger;
/**
@@ -8,9 +10,9 @@ use dokuwiki\Logger;
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <andi@splitbrain.org>
*/
-class admin_plugin_logviewer extends DokuWiki_Admin_Plugin
+class admin_plugin_logviewer extends AdminPlugin
{
- const MAX_READ_SIZE = 1048576; // 1 MB
+ protected const MAX_READ_SIZE = 1_048_576; // 1 MB
protected $facilities;
protected $facility;
@@ -56,7 +58,7 @@ class admin_plugin_logviewer extends DokuWiki_Admin_Plugin
{
global $ID;
- $form = new dokuwiki\Form\Form(['method' => 'GET']);
+ $form = new Form(['method' => 'GET']);
$form->setHiddenField('do', 'admin');
$form->setHiddenField('page', 'logviewer');
$form->setHiddenField('facility', $this->facility);
@@ -71,8 +73,10 @@ class admin_plugin_logviewer extends DokuWiki_Admin_Plugin
if ($facility == $this->facility) {
echo '<strong>' . hsc($facility) . '</strong>';
} else {
- $link = wl($ID,
- ['do' => 'admin', 'page' => 'logviewer', 'date' => $this->date, 'facility' => $facility]);
+ $link = wl(
+ $ID,
+ ['do' => 'admin', 'page' => 'logviewer', 'date' => $this->date, 'facility' => $facility]
+ );
echo '<a href="' . $link . '">' . hsc($facility) . '</a>';
}
echo '</li>';
@@ -156,7 +160,7 @@ class admin_plugin_logviewer extends DokuWiki_Admin_Plugin
if ($size >= self::MAX_READ_SIZE) {
array_shift($lines); // Discard the first line
- while (!empty($lines) && (substr($lines[0], 0, 2) === ' ')) {
+ while ($lines !== [] && (substr($lines[0], 0, 2) === ' ')) {
array_shift($lines); // Discard indented lines
}
@@ -191,10 +195,10 @@ class admin_plugin_logviewer extends DokuWiki_Admin_Plugin
$line = $lines[$i] ?? '';
}
echo '</dd>';
- $i -= 1; // rewind the counter
+ --$i; // rewind the counter
} else {
// other lines are actual log lines in three parts
- list($dt, $file, $msg) = sexplode("\t", $line, 3, '');
+ [$dt, $file, $msg] = sexplode("\t", $line, 3, '');
echo '<dt>';
echo '<span class="datetime">' . hsc($dt) . '</span>';
echo '<span class="log">';