mirror of
https://github.com/friendica/friendica
synced 2025-04-25 09:10:11 +00:00
Ensure to never delete the "0" user
This commit is contained in:
parent
81a03b137b
commit
d7fa58d81c
2 changed files with 12 additions and 2 deletions
|
@ -33,9 +33,14 @@ class ExpireAndRemoveUsers
|
|||
public static function execute()
|
||||
{
|
||||
// expire any expired regular accounts. Don't expire forums.
|
||||
$condition = ["NOT `account_expired` AND `account_expires_on` > ? AND `account_expires_on` < UTC_TIMESTAMP() AND `page-flags` = 0", DBA::NULL_DATETIME];
|
||||
$condition = ["NOT `account_expired` AND `account_expires_on` > ? AND `account_expires_on` < UTC_TIMESTAMP() AND `page-flags` = ? AND `uid` != ?",
|
||||
DBA::NULL_DATETIME, User::PAGE_FLAGS_NORMAL, 0];
|
||||
DBA::update('user', ['account_expired' => true], $condition);
|
||||
|
||||
// Ensure to never remove the user with uid=0
|
||||
DBA::update('user', ['account_expired' => false, 'account_removed' => false,
|
||||
'account_expires_on' => DBA::NULL_DATETIME], ['uid' => 0]);
|
||||
|
||||
// Remove any freshly expired account
|
||||
$users = DBA::select('user', ['uid'], ['account_expired' => true, 'account_removed' => false]);
|
||||
while ($user = DBA::fetch($users)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue