Skip to content

Commit

Permalink
Merge pull request #4865 from wallabag/fix-4864
Browse files Browse the repository at this point in the history
Added a query to parse only non-hashed URL
  • Loading branch information
nicosomb committed Dec 21, 2020
2 parents d201391 + 68060f5 commit 863dd6e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Expand Up @@ -59,7 +59,7 @@ private function generateHashedUrls(User $user)
$em = $this->getContainer()->get('doctrine.orm.entity_manager');
$repo = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry');

$entries = $repo->findByUser($user->getId());
$entries = $repo->findByEmptyHashedUrlAndUserId($user->getId());

$i = 1;
foreach ($entries as $entry) {
Expand Down
14 changes: 14 additions & 0 deletions src/Wallabag/CoreBundle/Repository/EntryRepository.php
Expand Up @@ -369,6 +369,20 @@ public function findByUrlAndUserId($url, $userId)
);
}

/**
* Find all entries which have an empty value for hash.
*
* @return Entry|false
*/
public function findByEmptyHashedUrlAndUserId(int $userId)
{
return $this->createQueryBuilder('e')
->where('e.hashedUrl = :empty')->setParameter('empty', '')
->andWhere('e.user = :user_id')->setParameter('user_id', $userId)
->getQuery()
->getResult();
}

/**
* Find an entry by its hashed url and its owner.
* If it exists, return the entry otherwise return false.
Expand Down

0 comments on commit 863dd6e

Please sign in to comment.