Torrent::getInfoHashAsHex() removed in favor of Torrent::getInfoHash() which is now returns cached HEX string.

This commit is contained in:
Alexey Skobkin 2018-06-22 22:47:51 +03:00
parent 027476c553
commit 296850e482
3 changed files with 3 additions and 15 deletions

View file

@ -80,20 +80,8 @@ class Torrent
return $this->id; return $this->id;
} }
/** /** Returns torrent info hash as HEX string */
* Returns torrent info hash as HEX string
*/
public function getInfoHash(): string public function getInfoHash(): string
{
return $this->getInfoHashAsHex();
}
/**
* @deprecated Use getInfoHash() instead
*
* Returns torrent info hash as HEX string
*/
public function getInfoHashAsHex(): string
{ {
if (null === $this->infoHashHexCache) { if (null === $this->infoHashHexCache) {
$this->infoHashHexCache = bin2hex(stream_get_contents($this->infoHash)); $this->infoHashHexCache = bin2hex(stream_get_contents($this->infoHash));

View file

@ -16,7 +16,7 @@
{# @var torrent \App\Entity\Torrent #} {# @var torrent \App\Entity\Torrent #}
{% for torrent in torrents %} {% for torrent in torrents %}
<tr> <tr>
<td><a href="{{ magnet(torrent.name, torrent.infoHashAsHex) }}">&#128279;</a></td> <td><a href="{{ magnet(torrent.name, torrent.infoHash) }}">&#128279;</a></td>
<td><a href="{{ path('torrents_show', {'id': torrent.id}) }}">{{ torrent.name }}</a></td> <td><a href="{{ path('torrents_show', {'id': torrent.id}) }}">{{ torrent.name }}</a></td>
<td>{{ torrent.totalSize | readable_size }}</td> <td>{{ torrent.totalSize | readable_size }}</td>
<td>{{ torrent.discoveredOn | date('Y-m-d H:i:s')}}</td> <td>{{ torrent.discoveredOn | date('Y-m-d H:i:s')}}</td>

View file

@ -10,7 +10,7 @@
<tr> <tr>
<td>Hash</td> <td>Hash</td>
<td> <td>
<a href="{{ magnet(torrent.name, torrent.infoHashAsHex) }}">{{ torrent.infoHashAsHex }}</a> <a href="{{ magnet(torrent.name, torrent.infoHash) }}">{{ torrent.infoHash }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>