} else {
$users = $this->getContainer()->get('wallabag_user.user_repository')->findAll();
- $this->io->text(sprintf('Cleaning through <info>%d</info> user accounts', count($users)));
+ $this->io->text(sprintf('Cleaning through <info>%d</info> user accounts', \count($users)));
foreach ($users as $user) {
$this->io->text(sprintf('Processing user <info>%s</info>', $user->getUsername()));
return 0;
}
- /**
- * @param User $user
- */
private function cleanDuplicates(User $user)
{
$em = $this->getContainer()->get('doctrine.orm.entity_manager');
$repo = $this->getContainer()->get('wallabag_core.entry_repository');
- $entries = $repo->getAllEntriesIdAndUrl($user->getId());
+ $entries = $repo->findAllEntriesIdAndUrlByUserId($user->getId());
$duplicatesCount = 0;
$urls = [];
$url = $this->similarUrl($entry['url']);
/* @var $entry Entry */
- if (in_array($url, $urls, true)) {
+ if (\in_array($url, $urls, true)) {
++$duplicatesCount;
$em->remove($repo->find($entry['id']));
private function similarUrl($url)
{
- if (in_array(substr($url, -1), ['/', '#'], true)) { // get rid of "/" and "#" and the end of urls
- return substr($url, 0, strlen($url));
+ if (\in_array(substr($url, -1), ['/', '#'], true)) { // get rid of "/" and "#" and the end of urls
+ return substr($url, 0, \strlen($url));
}
return $url;