3 * @file src/Model/User.php
4 * @brief This file includes the User class with user related database functions
6 namespace Friendica\Model;
8 use Friendica\Core\System;
9 use Friendica\Core\Worker;
12 require_once 'boot.php';
13 require_once 'plugin.php';
16 * @brief This class handles User related functions
20 public static function remove($uid)
26 logger('Removing user: ' . $uid);
28 $r = dba::select('user', array(), array('uid' => $uid), array("limit" => 1));
30 call_hooks('remove_user', $r);
32 // save username (actually the nickname as it is guaranteed
33 // unique), so it cannot be re-registered in the future.
35 dba::insert('userd', array('username' => $r['nickname']));
37 // The user and related data will be deleted in "cron_expire_and_remove_users" (cronjobs.php)
38 q("UPDATE `user` SET `account_removed` = 1, `account_expires_on` = UTC_TIMESTAMP() WHERE `uid` = %d", intval($uid));
39 Worker::add(PRIORITY_HIGH, "Notifier", "removeme", $uid);
41 // Send an update to the directory
42 Worker::add(PRIORITY_LOW, "Directory", $r['url']);
44 if ($uid == local_user()) {
45 unset($_SESSION['authenticated']);
46 unset($_SESSION['uid']);
47 goaway(System::baseUrl());