Show file count while listing (#1082)

This commit is contained in:
Cønstantine Kovalensky 2023-11-11 23:28:30 +04:00 committed by GitHub
commit e74dcfd379
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -156,7 +156,7 @@ sup {
<hr>
<table>
<tr>
<th>Path</th>
<th>Path ({$files['count']} files)</th>
<th>Size</th>
<th class="tooltip" style="width: auto;">
BTMR hash

View file

@ -165,7 +165,7 @@ class TorrentFileList
*/
public function fileTreeTable(array $array, string $parent = ''): array
{
static $filesList = ['list' => '', 'size' => 0];
static $filesList = ['list' => '', 'size' => 0, 'count' => 0];
foreach ($array as $key => $value) {
$key = htmlCHR($key);
$current = "$parent/$key";
@ -176,6 +176,7 @@ class TorrentFileList
$root = bin2hex($value['']['pieces root'] ?? '');
$filesList['size'] += $length;
$filesList['list'] .= '<tr><td>' . $current . '</td><td>' . humn_size($length, 2) . '</td><td>' . $root . '</td></tr><tr>';
$filesList['count']++;
}
}