Skip to content

Commit 77e96da

Browse files
committed
Enhance tail view.
1 parent 7358e25 commit 77e96da

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

app/code/community/Kiatng/Shooter/controllers/LogController.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,19 @@ public function tailAction()
118118
$output .= "<h3>$fnm <em>$dt</em></h3>";
119119
if ($tail = $helper->tail($path, $lines)) {
120120
$tail = print_r($tail, true);
121+
$cntLines = count(explode("\n", $tail));
122+
if ($cntLines == $lines) {
123+
$path = base64_encode($path);
124+
$output .= "<p>View last number of lines: ";
125+
foreach ([50, 100, 200, 600, 1200, 2400, 5000, 12000] as $l) {
126+
if ($l != $lines) {
127+
$url = Mage::getUrl('*/*/tail', ['path' => $path, 'lines' => $l]);
128+
$output .= "<a href='$url'>$l</a> ";
129+
}
130+
}
131+
$output .= "</p>";
132+
}
133+
121134
$output .= "<pre>$tail</pre>";
122135
} else {
123136
$output .= "<p><em>empty</em></p>";

0 commit comments

Comments
 (0)