Skip to content
This repository was archived by the owner on Nov 27, 2022. It is now read-only.

Commit ff9d9b7

Browse files
committed
The method for retrieving settings returns now an Generator
1 parent b7e0af0 commit ff9d9b7

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

share/templates/layout.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,13 @@ function toggleVisible(head, row) {
210210
<label for="tab-config">Configuration</label>
211211
<div class="content">
212212
<table>
213-
<?php echo $dataModel->getConfigDataRows(); ?>
214-
</table>
213+
<?php foreach ($dataModel->getSettings() as $row): ?>
214+
<tr>
215+
<th><?php echo $row['config'] ?></th>
216+
<td><?php echo $row['value'] ?></td>
217+
</tr>
218+
<?php endforeach ?>
219+
</table>
215220
</div>
216221
</div>
217222

web/index.php

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,45 +40,42 @@ public function getStatusDataRows()
4040
$value = 'true';
4141
}
4242
if ($k === 'used_memory' || $k === 'free_memory' || $k === 'wasted_memory') {
43-
$v = $this->_size_for_humans(
43+
$value = $this->_size_for_humans(
4444
$v
4545
);
46-
}
47-
if ($k === 'current_wasted_percentage' || $k === 'opcache_hit_rate') {
48-
$v = number_format(
46+
} elseif ($k === 'current_wasted_percentage' || $k === 'opcache_hit_rate') {
47+
$value = number_format(
4948
$v,
5049
2
5150
) . '%';
51+
} elseif ($k === 'blacklist_miss_ratio') {
52+
$value = number_format($v, 2) . '%';
53+
} elseif ($k === 'start_time' || $k === 'last_restart_time') {
54+
$value = ($v ? date(DATE_RFC822, $v) : 'never');
5255
}
53-
if ($k === 'blacklist_miss_ratio') {
54-
$v = number_format($v, 2) . '%';
55-
}
56-
if ($k === 'start_time' || $k === 'last_restart_time') {
57-
$v = ($v ? date(DATE_RFC822, $v) : 'never');
58-
}
56+
5957
if (THOUSAND_SEPARATOR === true && is_int($v)) {
60-
$v = number_format($v);
58+
$value = number_format($v);
6159
}
6260

63-
$rows[] = "<tr><th>$k</th><td>$v</td></tr>\n";
61+
$rows[] = "<tr><th>$k</th><td>$value</td></tr>\n";
6462
}
65-
continue;
66-
}
67-
if ($value === false) {
68-
$value = 'false';
69-
}
70-
if ($value === true) {
71-
$value = 'true';
63+
} else {
64+
if ($value === false) {
65+
$value = 'false';
66+
}
67+
if ($value === true) {
68+
$value = 'true';
69+
}
70+
$rows[] = "<tr><th>$key</th><td>$value</td></tr>\n";
7271
}
73-
$rows[] = "<tr><th>$key</th><td>$value</td></tr>\n";
7472
}
7573

7674
return implode("\n", $rows);
7775
}
7876

79-
public function getConfigDataRows()
77+
public function getSettings()
8078
{
81-
$rows = array();
8279
foreach ($this->configuration['directives'] as $key => $value) {
8380
if ($value === false) {
8481
$value = 'false';
@@ -89,10 +86,8 @@ public function getConfigDataRows()
8986
if ($key == 'opcache.memory_consumption') {
9087
$value = $this->_size_for_humans($value);
9188
}
92-
$rows[] = "<tr><th>$key</th><td>$value</td></tr>\n";
89+
yield ["config" => $key, "value" => $value];
9390
}
94-
95-
return implode("\n", $rows);
9691
}
9792

9893
public function getScriptStatusRows()

0 commit comments

Comments
 (0)