Use a better index for hashed_url

It'll most often be used in addition to the `user_id`.
Also, automatically generate the hash when saving the url.
Switch from `md5` to `sha1`.
This commit is contained in:
Jeremy Benoist
2019-04-01 13:51:57 +02:00
parent 9c2b2aae70
commit 8a64566298
7 changed files with 21 additions and 23 deletions

View File

@ -72,11 +72,8 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase
$entry1->setUrl($url);
$em->persist($entry1);
$em->flush();
$this->assertNull($entry1->getHashedUrl());
$application = new Application($this->getClient()->getKernel());
$application->add(new GenerateUrlHashesCommand());
@ -92,7 +89,7 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase
$entry = $em->getRepository('WallabagCoreBundle:Entry')->findOneByUrl($url);
$this->assertSame($entry->getHashedUrl(), hash('md5', $url));
$this->assertSame($entry->getHashedUrl(), hash('sha1', $url));
$query = $em->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.url = :url');
$query->setParameter('url', $url);