Some cleanup

Also, do not run the hashed_url migration into a Doctrine migration
This commit is contained in:
Jeremy Benoist
2019-04-01 14:34:20 +02:00
parent 8a64566298
commit c579ce2306
5 changed files with 23 additions and 15 deletions

View File

@ -52,7 +52,6 @@ class EntryRestController extends WallabagRestController
foreach ($hashedUrls as $hashedUrl) {
$res = $repo->findByHashedUrlAndUserId($hashedUrl, $this->getUser()->getId());
// $results[$url] = $this->returnExistInformation($res, $returnId);
$results[$hashedUrl] = $this->returnExistInformation($res, $returnId);
}

View File

@ -20,18 +20,14 @@ class GenerateUrlHashesCommand extends ContainerAwareCommand
->setName('wallabag:generate-hashed-urls')
->setDescription('Generates hashed urls for each entry')
->setHelp('This command helps you to generates hashes of the url of each entry, to check through API if an URL is already saved')
->addArgument(
'username',
InputArgument::OPTIONAL,
'User to process entries'
);
->addArgument('username', InputArgument::OPTIONAL, 'User to process entries');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->output = $output;
$username = $input->getArgument('username');
$username = (string) $input->getArgument('username');
if ($username) {
try {

View File

@ -350,15 +350,15 @@ class EntryRepository extends EntityRepository
* Find an entry by its hashed url and its owner.
* If it exists, return the entry otherwise return false.
*
* @param $hashedUrl
* @param $userId
* @param string $hashedUrl Url hashed using sha1
* @param int $userId
*
* @return Entry|bool
*/
public function findByHashedUrlAndUserId($hashedUrl, $userId)
{
$res = $this->createQueryBuilder('e')
->where('e.hashedUrl = :hashed_url')->setParameter('hashed_url', urldecode($hashedUrl))
->where('e.hashedUrl = :hashed_url')->setParameter('hashed_url', $hashedUrl)
->andWhere('e.user = :user_id')->setParameter('user_id', $userId)
->getQuery()
->getResult();