path([$torrentId, '*']));
foreach ($htmlfiles as $path) {
if (preg_match('/(\d+)\.log/', $path, $match)) {
$logId = $match[1];
$this->remove([$torrentId, $logId]);
}
}
} else {
$path = $this->path($id);
if (file_exists($path)) {
@unlink($path);
}
}
return true;
}
/**
* Path of a HTML-ized rip log.
*
* @param array $id rip log identifier [torrentId, logId]
*/
public function path(/* array */ $id): string {
$torrentId = $id[0];
$logId = $id[1];
$key = strrev(sprintf('%04d', $torrentId));
return sprintf('%s/%02d/%02d', self::STORAGE, substr($key, 0, 2), substr($key, 2, 2))
. '/' . $torrentId . '_' . $logId . '.html';
}
}