]> git.mxchange.org Git - friendica.git/blobdiff - src/Console/MergeContacts.php
Delete introductions when referenced contact id doesn't exist anymore in Ping module
[friendica.git] / src / Console / MergeContacts.php
index 0d05c579fabaaa737b3419c97102c7ba3ed107dd..e230499d2d23ce84e06e1b86cafb68977e64c57d 100644 (file)
@@ -23,6 +23,7 @@ namespace Friendica\Console;
 
 use Friendica\Core\L10n;
 use Friendica\Database\Database;
+use Friendica\Model\Contact;
 
 /**
  * tool to find and merge duplicated contact entries.
@@ -87,7 +88,7 @@ HELP;
        {
                $first = $this->dba->selectFirst('contact', ['id', 'nurl', 'url'], ["`uri-id` = ? AND `nurl` != ? AND `url` != ?", $uriid, '', ''], ['order' => ['id']]);
                if (empty($first)) {
-                       $this->err($this->l10n->t('No valid first countact found for uri-id %d.', $uriid));
+                       $this->err($this->l10n->t('No valid first contact found for uri-id %d.', $uriid));
                        return;
                }
                $this->out($first['url']);
@@ -137,7 +138,7 @@ HELP;
                $this->updateTable('post-thread-user', 'contact-id', $from, $to, false);
                $this->updateTable('user-contact', 'cid', $from, $to, true);
 
-               if (!$this->dba->delete('contact', ['id' => $from])) {
+               if (!Contact::deleteById($from)) {
                        $this->err($this->l10n->t('Deletion of id %d failed', $from));
                } else {
                        $this->out($this->l10n->t('Deletion of id %d was successful', $from));