From 6df187478d6fb3f3060cf57010bd4222a537a91d Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 12 Nov 2022 09:58:03 -0500 Subject: [PATCH] Fixed wrong reference to user.expire in Model\User::getActorName - Update field documentation to prevent further confusion --- database.sql | 2 +- doc/database/db_user.md | 94 +++++++++++++++++------------------ src/Model/User.php | 2 +- static/dbstructure.config.php | 2 +- 4 files changed, 50 insertions(+), 50 deletions(-) diff --git a/database.sql b/database.sql index 71a5f0ae5f..f471aec907 100644 --- a/database.sql +++ b/database.sql @@ -80,7 +80,7 @@ CREATE TABLE IF NOT EXISTS `user` ( `pwdreset` varchar(255) COMMENT 'Password reset request token', `pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request', `maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '', - `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '', + `expire` int unsigned NOT NULL DEFAULT 0 COMMENT 'Delay in days before deleting user-related posts. Scope is controlled by pConfig.', `account_removed` boolean NOT NULL DEFAULT '0' COMMENT 'if 1 the account is removed', `account_expired` boolean NOT NULL DEFAULT '0' COMMENT '', `account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp when account expires and will be deleted', diff --git a/doc/database/db_user.md b/doc/database/db_user.md index 611fb76b05..85fe895e98 100644 --- a/doc/database/db_user.md +++ b/doc/database/db_user.md @@ -6,53 +6,53 @@ The local users Fields ------ -| Field | Description | Type | Null | Key | Default | Extra | -| ------------------------ | --------------------------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- | -| uid | sequential ID | mediumint unsigned | NO | PRI | NULL | auto_increment | -| parent-uid | The parent user that has full control about this user | mediumint unsigned | YES | | NULL | | -| guid | A unique identifier for this user | varchar(64) | NO | | | | -| username | Name that this user is known by | varchar(255) | NO | | | | -| password | encrypted password | varchar(255) | NO | | | | -| legacy_password | Is the password hash double-hashed? | boolean | NO | | 0 | | -| nickname | nick- and user name | varchar(255) | NO | | | | -| email | the users email address | varchar(255) | NO | | | | -| openid | | varchar(255) | NO | | | | -| timezone | PHP-legal timezone | varchar(128) | NO | | | | -| language | default language | varchar(32) | NO | | en | | -| register_date | timestamp of registration | datetime | NO | | 0001-01-01 00:00:00 | | -| login_date | timestamp of last login | datetime | NO | | 0001-01-01 00:00:00 | | -| default-location | Default for item.location | varchar(255) | NO | | | | -| allow_location | 1 allows to display the location | boolean | NO | | 0 | | -| theme | user theme preference | varchar(255) | NO | | | | -| pubkey | RSA public key 4096 bit | text | YES | | NULL | | -| prvkey | RSA private key 4096 bit | text | YES | | NULL | | -| spubkey | | text | YES | | NULL | | -| sprvkey | | text | YES | | NULL | | -| verified | user is verified through email | boolean | NO | | 0 | | -| blocked | 1 for user is blocked | boolean | NO | | 0 | | -| blockwall | Prohibit contacts to post to the profile page of the user | boolean | NO | | 0 | | -| hidewall | Hide profile details from unkown viewers | boolean | NO | | 0 | | -| blocktags | Prohibit contacts to tag the post of this user | boolean | NO | | 0 | | -| unkmail | Permit unknown people to send private mails to this user | boolean | NO | | 0 | | -| cntunkmail | | int unsigned | NO | | 10 | | -| notify-flags | email notification options | smallint unsigned | NO | | 65535 | | -| page-flags | page/profile type | tinyint unsigned | NO | | 0 | | -| account-type | | tinyint unsigned | NO | | 0 | | -| prvnets | | boolean | NO | | 0 | | -| pwdreset | Password reset request token | varchar(255) | YES | | NULL | | -| pwdreset_time | Timestamp of the last password reset request | datetime | YES | | NULL | | -| maxreq | | int unsigned | NO | | 10 | | -| expire | | int unsigned | NO | | 0 | | -| account_removed | if 1 the account is removed | boolean | NO | | 0 | | -| account_expired | | boolean | NO | | 0 | | -| account_expires_on | timestamp when account expires and will be deleted | datetime | NO | | 0001-01-01 00:00:00 | | -| expire_notification_sent | timestamp of last warning of account expiration | datetime | NO | | 0001-01-01 00:00:00 | | -| def_gid | | int unsigned | NO | | 0 | | -| allow_cid | default permission for this user | mediumtext | YES | | NULL | | -| allow_gid | default permission for this user | mediumtext | YES | | NULL | | -| deny_cid | default permission for this user | mediumtext | YES | | NULL | | -| deny_gid | default permission for this user | mediumtext | YES | | NULL | | -| openidserver | | text | YES | | NULL | | +| Field | Description | Type | Null | Key | Default | Extra | +| ------------------------ | --------------------------------------------------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- | +| uid | sequential ID | mediumint unsigned | NO | PRI | NULL | auto_increment | +| parent-uid | The parent user that has full control about this user | mediumint unsigned | YES | | NULL | | +| guid | A unique identifier for this user | varchar(64) | NO | | | | +| username | Name that this user is known by | varchar(255) | NO | | | | +| password | encrypted password | varchar(255) | NO | | | | +| legacy_password | Is the password hash double-hashed? | boolean | NO | | 0 | | +| nickname | nick- and user name | varchar(255) | NO | | | | +| email | the users email address | varchar(255) | NO | | | | +| openid | | varchar(255) | NO | | | | +| timezone | PHP-legal timezone | varchar(128) | NO | | | | +| language | default language | varchar(32) | NO | | en | | +| register_date | timestamp of registration | datetime | NO | | 0001-01-01 00:00:00 | | +| login_date | timestamp of last login | datetime | NO | | 0001-01-01 00:00:00 | | +| default-location | Default for item.location | varchar(255) | NO | | | | +| allow_location | 1 allows to display the location | boolean | NO | | 0 | | +| theme | user theme preference | varchar(255) | NO | | | | +| pubkey | RSA public key 4096 bit | text | YES | | NULL | | +| prvkey | RSA private key 4096 bit | text | YES | | NULL | | +| spubkey | | text | YES | | NULL | | +| sprvkey | | text | YES | | NULL | | +| verified | user is verified through email | boolean | NO | | 0 | | +| blocked | 1 for user is blocked | boolean | NO | | 0 | | +| blockwall | Prohibit contacts to post to the profile page of the user | boolean | NO | | 0 | | +| hidewall | Hide profile details from unkown viewers | boolean | NO | | 0 | | +| blocktags | Prohibit contacts to tag the post of this user | boolean | NO | | 0 | | +| unkmail | Permit unknown people to send private mails to this user | boolean | NO | | 0 | | +| cntunkmail | | int unsigned | NO | | 10 | | +| notify-flags | email notification options | smallint unsigned | NO | | 65535 | | +| page-flags | page/profile type | tinyint unsigned | NO | | 0 | | +| account-type | | tinyint unsigned | NO | | 0 | | +| prvnets | | boolean | NO | | 0 | | +| pwdreset | Password reset request token | varchar(255) | YES | | NULL | | +| pwdreset_time | Timestamp of the last password reset request | datetime | YES | | NULL | | +| maxreq | | int unsigned | NO | | 10 | | +| expire | Delay in days before deleting user-related posts. Scope is controlled by pConfig. | int unsigned | NO | | 0 | | +| account_removed | if 1 the account is removed | boolean | NO | | 0 | | +| account_expired | | boolean | NO | | 0 | | +| account_expires_on | timestamp when account expires and will be deleted | datetime | NO | | 0001-01-01 00:00:00 | | +| expire_notification_sent | timestamp of last warning of account expiration | datetime | NO | | 0001-01-01 00:00:00 | | +| def_gid | | int unsigned | NO | | 0 | | +| allow_cid | default permission for this user | mediumtext | YES | | NULL | | +| allow_gid | default permission for this user | mediumtext | YES | | NULL | | +| deny_cid | default permission for this user | mediumtext | YES | | NULL | | +| deny_gid | default permission for this user | mediumtext | YES | | NULL | | +| openidserver | | text | YES | | NULL | | Indexes ------------ diff --git a/src/Model/User.php b/src/Model/User.php index 3f5376e0b8..cc6e11a42d 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -265,7 +265,7 @@ class User // List of possible actor names $possible_accounts = ['friendica', 'actor', 'system', 'internal']; foreach ($possible_accounts as $name) { - if (!DBA::exists('user', ['nickname' => $name, 'account_removed' => false, 'expire' => false]) && + if (!DBA::exists('user', ['nickname' => $name, 'account_removed' => false, 'account_expired' => false]) && !DBA::exists('userd', ['username' => $name])) { DI::config()->set('system', 'actor_name', $name); return $name; diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 17064fd959..f957596b64 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -136,7 +136,7 @@ return [ "pwdreset" => ["type" => "varchar(255)", "comment" => "Password reset request token"], "pwdreset_time" => ["type" => "datetime", "comment" => "Timestamp of the last password reset request"], "maxreq" => ["type" => "int unsigned", "not null" => "1", "default" => "10", "comment" => ""], - "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""], + "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Delay in days before deleting user-related posts. Scope is controlled by pConfig."], "account_removed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if 1 the account is removed"], "account_expired" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""], "account_expires_on" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp when account expires and will be deleted"], -- 2.39.5