We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 77e96da commit e1bdae6Copy full SHA for e1bdae6
1 file changed
app/code/community/Kiatng/Shooter/Helper/File.php
@@ -57,6 +57,24 @@ public function tail(string $filepath, int $lines = 10)
57
}
58
59
60
+ /**
61
+ * Get the tail of a file as HTML
62
+ *
63
+ * @param string $filepath Path to the file to read
64
+ * @param int $lines Number of lines to read (must be positive)
65
+ * @return string Returns the tail of the file as HTML or an empty string if no tail is found
66
+ */
67
+ public function getTailHtml(string $filepath, int $lines = 10): string
68
+ {
69
+ if ($tail = $this->tail($filepath, $lines)) {
70
+ $tail = print_r($tail, true);
71
+ $dt = Mage::getSingleton('core/date')->date('Y-m-d H:i:s', filemtime($filepath));
72
+ return "<h3>$filepath <em>$dt</em></h3><pre>$tail</pre>";
73
+ }
74
+
75
+ return '';
76
77
78
/**
79
* Get the latest file in a directory
80
*
0 commit comments