]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/User.php
Merge branch '2018.08-rc'
[friendica.git] / src / Model / User.php
index 96f207c4acf9f9a97f43c2b7634d3f9eb2e7060d..d65e7d8f9699e41aabadb406bd3034bd7da2266f 100644 (file)
@@ -11,6 +11,7 @@ use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
@@ -70,9 +71,11 @@ class User
        public static function getOwnerDataByNick($nick)
        {
                $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nick]);
+
                if (!DBA::isResult($user)) {
                        return false;
                }
+
                return self::getOwnerDataById($user['uid']);
        }
 
@@ -88,7 +91,7 @@ class User
        {
                $default_group = 0;
 
-               if ($network == NETWORK_OSTATUS) {
+               if ($network == Protocol::OSTATUS) {
                        $default_group = PConfig::get($uid, "ostatus", "default_group");
                }
 
@@ -492,7 +495,7 @@ class User
                $spubkey = $sres['pubkey'];
 
                $insert_result = DBA::insert('user', [
-                       'guid'     => generate_user_guid(),
+                       'guid'     => System::createGUID(32),
                        'username' => $username,
                        'password' => $new_password_encoded,
                        'email'    => $email,
@@ -727,13 +730,16 @@ class User
                DBA::insert('userd', ['username' => $user['nickname']]);
 
                // The user and related data will be deleted in "cron_expire_and_remove_users" (cronjobs.php)
-               DBA::update('user', ['account_removed' => true, 'account_expires_on' => DateTimeFormat::utcNow()], ['uid' => $uid]);
+               DBA::update('user', ['account_removed' => true, 'account_expires_on' => DateTimeFormat::utc(DateTimeFormat::utcNow() . " + 7 day")], ['uid' => $uid]);
                Worker::add(PRIORITY_HIGH, "Notifier", "removeme", $uid);
 
                // Send an update to the directory
                $self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
                Worker::add(PRIORITY_LOW, "Directory", $self['url']);
 
+               // Remove the user relevant data
+               Worker::add(PRIORITY_LOW, "RemoveUser", $uid);
+
                if ($uid == local_user()) {
                        unset($_SESSION['authenticated']);
                        unset($_SESSION['uid']);