]> git.mxchange.org Git - friendica.git/blobdiff - src/Console/MergeContacts.php
New option to disable the fetching of parents
[friendica.git] / src / Console / MergeContacts.php
index 79cd0b4b749ae431e49e6cb22f904f077e2eb4ad..0d05c579fabaaa737b3419c97102c7ba3ed107dd 100644 (file)
@@ -67,12 +67,16 @@ HELP;
                $this->l10n = $l10n;
        }
 
-       protected function doExecute()
+       protected function doExecute(): int
        {
                $duplicates = $this->dba->p("SELECT COUNT(*) AS `total`, `uri-id`, MAX(`url`) AS `url` FROM `contact` WHERE `uid` = 0 GROUP BY `uri-id` HAVING total > 1");
                while ($duplicate = $this->dba->fetch($duplicates)) {
                        $this->out($this->l10n->t('%d %s, %d duplicates.', $duplicate['uri-id'], $duplicate['url'], $duplicate['total']));
                        if ($this->getOption(['e', 'execute'], false)) {
+                               if (empty($duplicate['uri-id'])) {
+                                       $this->err($this->l10n->t('uri-id is empty for contact %s.', $duplicate['url']));
+                                       continue;
+                               }
                                $this->mergeContacts($duplicate['uri-id']);
                        }
                }