]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/User.php
Issue 10105: Use legacy photo data field if used
[friendica.git] / src / Model / User.php
index dbace74e5d9360fb38c4c3dd224192cebe2ae557..4959c8c21607c66f799d9449b457084ce29889d2 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -34,7 +34,7 @@ use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
 use Friendica\DI;
-use Friendica\Model\TwoFactor\AppSpecificPassword;
+use Friendica\Security\TwoFactor\Model\AppSpecificPassword;
 use Friendica\Network\HTTPException;
 use Friendica\Object\Image;
 use Friendica\Util\Crypto;
@@ -399,7 +399,7 @@ class User
                        return false;
                }
 
-               if (!$repairMissing) {
+               if (!$repairMissing || $owner['account_expired']) {
                        return $owner;
                }
 
@@ -1353,7 +1353,7 @@ class User
         */
        public static function remove(int $uid)
        {
-               if (!$uid) {
+               if (empty($uid)) {
                        return false;
                }
 
@@ -1367,6 +1367,9 @@ class User
                // unique), so it cannot be re-registered in the future.
                DBA::insert('userd', ['username' => $user['nickname']]);
 
+               // Remove all personal settings, especially connector settings
+               DBA::delete('pconfig', ['uid' => $uid]);
+
                // The user and related data will be deleted in Friendica\Worker\ExpireAndRemoveUsers
                DBA::update('user', ['account_removed' => true, 'account_expires_on' => DateTimeFormat::utc('now + 7 day')], ['uid' => $uid]);
                Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::REMOVAL, $uid);