[BakaUpdatesMangaReleasesBridge] Sanitize hash for more solid UIDs (#1113)

This should minimize occasional hiccups on regular updates.
This commit is contained in:
fulmeek 2019-04-30 21:01:48 +02:00 committed by LogMANOriginal
parent 21d3bf3b60
commit 33c16f8be5

View file

@ -68,7 +68,7 @@ class BakaUpdatesMangaReleasesBridge extends BridgeAbstract {
$item['title'] = implode(' ', $title); $item['title'] = implode(' ', $title);
$item['uri'] = $this->getURI(); $item['uri'] = $this->getURI();
$item['uid'] = hash('sha1', $item['title']); $item['uid'] = $this->getSanitizedHash($item['title']);
$this->items[] = $item; $this->items[] = $item;
} }
@ -89,6 +89,10 @@ class BakaUpdatesMangaReleasesBridge extends BridgeAbstract {
return parent::getName(); return parent::getName();
} }
private function getSanitizedHash($string) {
return hash('sha1', preg_replace('/[^a-zA-Z0-9\-\.]/', '', ucwords(strtolower($string))));
}
private function filterText($text) { private function filterText($text) {
return rtrim($text, '* '); return rtrim($text, '* ');
} }