mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
Do not show log details pane if empty
This commit is contained in:
@@ -507,7 +507,7 @@ abstract class TorrentAbstract extends BaseAttrObject {
|
||||
$log['adjusted'] = ($log['Adjusted'] === '1');
|
||||
$log['adjusted_checksum'] = ($log['AdjustedChecksum'] === '1');
|
||||
$log['checksum'] = ($log['Checksum'] === '1');
|
||||
$log['details'] = explode("\r\n", trim($log['Details'] ?? ''));
|
||||
$log['details'] = trim($log['Details'] ?? '') ? explode("\r\n", trim($log['Details'])) : [];
|
||||
if ($log['adjusted'] && $log['checksum'] !== $log['adjusted_checksum']) {
|
||||
$log['details'][] = 'Bad/No Checksum(s)';
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class TorrentLog extends BaseObject {
|
||||
AND LogID = ?
|
||||
", $this->torrent->id(), $this->id
|
||||
);
|
||||
$info['detail_list'] = explode("\r\n", $info['Details'] ?? "\r\n");
|
||||
$info['detail_list'] = trim($info['Details'] ?? '') ? explode("\r\n", $info['Details']) : [];
|
||||
$info['adjustment_list'] = $info['AdjustmentDetails'] ? unserialize($info['AdjustmentDetails']) : [];
|
||||
$this->info = $info;
|
||||
return $this->info;
|
||||
|
||||
@@ -367,6 +367,31 @@ class TorrentTest extends TestCase {
|
||||
);
|
||||
}
|
||||
|
||||
public function testLogfileList(): void {
|
||||
$logfileSummary = new LogfileSummary([
|
||||
'error' => [UPLOAD_ERR_OK],
|
||||
'name' => ['valid_log_eac.log'],
|
||||
'tmp_name' => [__DIR__ . '/../fixture/valid_log_eac.log'],
|
||||
]);
|
||||
$torrentLogManager = new Manager\TorrentLog();
|
||||
$checkerVersion = Logchecker::getLogcheckerVersion();
|
||||
foreach ($logfileSummary->all() as $logfile) {
|
||||
$torrentLogManager->create($this->torrent, $logfile, $checkerVersion);
|
||||
}
|
||||
$expected = [
|
||||
'has_riplog' => false,
|
||||
'adjustment_details' => [],
|
||||
'adjusted' => false,
|
||||
'adjusted_checksum' => false,
|
||||
'checksum' => true,
|
||||
'details' => [],
|
||||
];
|
||||
$logfileList = $this->torrent->logfileList();
|
||||
$this->assertCount(1, $logfileList);
|
||||
$this->assertArrayIsEqualToArrayOnlyConsideringListOfKeys($expected, $logfileList[0], array_keys($expected));
|
||||
$this->assertNotEmpty($logfileList[0]['html_log']);
|
||||
}
|
||||
|
||||
public function testLogfileHashList(): void {
|
||||
try {
|
||||
$logfileSummary = new LogfileSummary([
|
||||
|
||||
Reference in New Issue
Block a user