aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2019-04-01 14:34:20 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-04-01 14:34:20 +0200
commitc579ce2306297674c56376a2ab5c8ba66a272253 (patch)
tree03f8fdd7c7ee93fd0527d46f2690a81cf6d2d286 /src/Wallabag
parent8a6456629814039cfc623cdb279bcba06dacff50 (diff)
downloadwallabag-c579ce2306297674c56376a2ab5c8ba66a272253.tar.gz
wallabag-c579ce2306297674c56376a2ab5c8ba66a272253.tar.zst
wallabag-c579ce2306297674c56376a2ab5c8ba66a272253.zip
Some cleanup
Also, do not run the hashed_url migration into a Doctrine migration
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/ApiBundle/Controller/EntryRestController.php1
-rw-r--r--src/Wallabag/CoreBundle/Command/GenerateUrlHashesCommand.php8
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php6
3 files changed, 5 insertions, 10 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
index 0ecf1a0e..ad43b1d4 100644
--- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
@@ -52,7 +52,6 @@ class EntryRestController extends WallabagRestController
52 foreach ($hashedUrls as $hashedUrl) { 52 foreach ($hashedUrls as $hashedUrl) {
53 $res = $repo->findByHashedUrlAndUserId($hashedUrl, $this->getUser()->getId()); 53 $res = $repo->findByHashedUrlAndUserId($hashedUrl, $this->getUser()->getId());
54 54
55 // $results[$url] = $this->returnExistInformation($res, $returnId);
56 $results[$hashedUrl] = $this->returnExistInformation($res, $returnId); 55 $results[$hashedUrl] = $this->returnExistInformation($res, $returnId);
57 } 56 }
58 57
diff --git a/src/Wallabag/CoreBundle/Command/GenerateUrlHashesCommand.php b/src/Wallabag/CoreBundle/Command/GenerateUrlHashesCommand.php
index 685e1672..45bd8c5f 100644
--- a/src/Wallabag/CoreBundle/Command/GenerateUrlHashesCommand.php
+++ b/src/Wallabag/CoreBundle/Command/GenerateUrlHashesCommand.php
@@ -20,18 +20,14 @@ class GenerateUrlHashesCommand extends ContainerAwareCommand
20 ->setName('wallabag:generate-hashed-urls') 20 ->setName('wallabag:generate-hashed-urls')
21 ->setDescription('Generates hashed urls for each entry') 21 ->setDescription('Generates hashed urls for each entry')
22 ->setHelp('This command helps you to generates hashes of the url of each entry, to check through API if an URL is already saved') 22 ->setHelp('This command helps you to generates hashes of the url of each entry, to check through API if an URL is already saved')
23 ->addArgument( 23 ->addArgument('username', InputArgument::OPTIONAL, 'User to process entries');
24 'username',
25 InputArgument::OPTIONAL,
26 'User to process entries'
27 );
28 } 24 }
29 25
30 protected function execute(InputInterface $input, OutputInterface $output) 26 protected function execute(InputInterface $input, OutputInterface $output)
31 { 27 {
32 $this->output = $output; 28 $this->output = $output;
33 29
34 $username = $input->getArgument('username'); 30 $username = (string) $input->getArgument('username');
35 31
36 if ($username) { 32 if ($username) {
37 try { 33 try {
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index 0c175abb..f5089729 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -350,15 +350,15 @@ class EntryRepository extends EntityRepository
350 * Find an entry by its hashed url and its owner. 350 * Find an entry by its hashed url and its owner.
351 * If it exists, return the entry otherwise return false. 351 * If it exists, return the entry otherwise return false.
352 * 352 *
353 * @param $hashedUrl 353 * @param string $hashedUrl Url hashed using sha1
354 * @param $userId 354 * @param int $userId
355 * 355 *
356 * @return Entry|bool 356 * @return Entry|bool
357 */ 357 */
358 public function findByHashedUrlAndUserId($hashedUrl, $userId) 358 public function findByHashedUrlAndUserId($hashedUrl, $userId)
359 { 359 {
360 $res = $this->createQueryBuilder('e') 360 $res = $this->createQueryBuilder('e')
361 ->where('e.hashedUrl = :hashed_url')->setParameter('hashed_url', urldecode($hashedUrl)) 361 ->where('e.hashedUrl = :hashed_url')->setParameter('hashed_url', $hashedUrl)
362 ->andWhere('e.user = :user_id')->setParameter('user_id', $userId) 362 ->andWhere('e.user = :user_id')->setParameter('user_id', $userId)
363 ->getQuery() 363 ->getQuery()
364 ->getResult(); 364 ->getResult();