Remove redundant comments, streamline query logic, and clean up variable handling for improved code readability and efficiency in StdOut.php and StdOut-detail.php.
This commit is contained in:
13
X/StdOut.php
13
X/StdOut.php
@@ -63,29 +63,22 @@
|
||||
</div>
|
||||
<!-- TABLE -->
|
||||
<div>
|
||||
<?php // DATA OPTIMIZED
|
||||
|
||||
// The one and only query to get everything we need
|
||||
<?php
|
||||
$sql = "SELECT cmd, MIN(ts) AS debut, MAX(ts) AS fin FROM x_stdout GROUP BY cmd ORDER BY fin DESC";
|
||||
$results = Invoke_infra($sql);
|
||||
|
||||
echo "<div class='row'>";
|
||||
|
||||
// Loop through the results (now very fast, no more queries inside)
|
||||
if (is_array($results)) {
|
||||
foreach ($results as $script) {
|
||||
$scriptName = $script['cmd'];
|
||||
$startTime = $script['debut'];
|
||||
$endTime = $script['fin'];
|
||||
|
||||
echo "<div class='col-3 mb-3'>";
|
||||
echo "<a href='StdOut-detail.php?s={$scriptName}&AIX=1&linux=1&DUN=1' class='btn btn-primary btn-lg' role='button'>";
|
||||
echo "<b>{$scriptName}</b><br><small>{$startTime} --> {$endTime}</small>";
|
||||
echo "<a href='StdOut-detail.php?s=$scriptName&AIX=1&linux=1&DUN=1' class='btn btn-primary btn-lg' role='button'>";
|
||||
echo "<b>$scriptName</b><br><small>$startTime --> $endTime</small>";
|
||||
echo "</a>";
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "</div>";
|
||||
?>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user