More fields added to "user-contact"
This commit is contained in:
parent
5abc1543fd
commit
2926282f8d
|
@ -1526,6 +1526,8 @@ CREATE TABLE IF NOT EXISTS `user-contact` (
|
||||||
`subhub` boolean COMMENT '',
|
`subhub` boolean COMMENT '',
|
||||||
`hub-verify` varchar(255) COMMENT '',
|
`hub-verify` varchar(255) COMMENT '',
|
||||||
`protocol` char(4) COMMENT 'Protocol of the contact',
|
`protocol` char(4) COMMENT 'Protocol of the contact',
|
||||||
|
`rating` tinyint COMMENT 'Automatically detected feed poll frequency',
|
||||||
|
`priority` tinyint unsigned COMMENT 'Feed poll priority',
|
||||||
PRIMARY KEY(`uid`,`cid`),
|
PRIMARY KEY(`uid`,`cid`),
|
||||||
INDEX `cid` (`cid`),
|
INDEX `cid` (`cid`),
|
||||||
UNIQUE INDEX `uri-id_uid` (`uri-id`,`uid`),
|
UNIQUE INDEX `uri-id_uid` (`uri-id`,`uid`),
|
||||||
|
|
|
@ -24,6 +24,8 @@ Fields
|
||||||
| subhub | | boolean | YES | | NULL | |
|
| subhub | | boolean | YES | | NULL | |
|
||||||
| hub-verify | | varchar(255) | YES | | NULL | |
|
| hub-verify | | varchar(255) | YES | | NULL | |
|
||||||
| protocol | Protocol of the contact | char(4) | YES | | NULL | |
|
| protocol | Protocol of the contact | char(4) | YES | | NULL | |
|
||||||
|
| rating | Automatically detected feed poll frequency | tinyint | YES | | NULL | |
|
||||||
|
| priority | Feed poll priority | tinyint unsigned | YES | | NULL | |
|
||||||
|
|
||||||
Indexes
|
Indexes
|
||||||
------------
|
------------
|
||||||
|
|
|
@ -66,17 +66,7 @@ class User
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = $contact;
|
$fields = self::preparedFields($contact);
|
||||||
|
|
||||||
if (isset($fields['readonly'])) {
|
|
||||||
$fields['ignored'] = $fields['readonly'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($fields['self'])) {
|
|
||||||
$fields['rel'] = Contact::SELF;
|
|
||||||
}
|
|
||||||
|
|
||||||
$fields = DBStructure::getFieldsForTable('user-contact', $fields);
|
|
||||||
$fields['cid'] = $pcid;
|
$fields['cid'] = $pcid;
|
||||||
$fields['uid'] = $contact['uid'];
|
$fields['uid'] = $contact['uid'];
|
||||||
$fields['uri-id'] = $contact['uri-id'];
|
$fields['uri-id'] = $contact['uri-id'];
|
||||||
|
@ -101,19 +91,7 @@ class User
|
||||||
{
|
{
|
||||||
DBA::transaction();
|
DBA::transaction();
|
||||||
|
|
||||||
unset($fields['uid']);
|
$update_fields = self::preparedFields($fields);
|
||||||
unset($fields['cid']);
|
|
||||||
unset($fields['uri-id']);
|
|
||||||
|
|
||||||
if (isset($fields['readonly'])) {
|
|
||||||
$fields['ignored'] = $fields['readonly'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($fields['self'])) {
|
|
||||||
$fields['rel'] = Contact::SELF;
|
|
||||||
}
|
|
||||||
|
|
||||||
$update_fields = DBStructure::getFieldsForTable('user-contact', $fields);
|
|
||||||
if (!empty($update_fields)) {
|
if (!empty($update_fields)) {
|
||||||
$contacts = DBA::select('contact', ['uri-id', 'uid'], $condition);
|
$contacts = DBA::select('contact', ['uri-id', 'uid'], $condition);
|
||||||
while ($row = DBA::fetch($contacts)) {
|
while ($row = DBA::fetch($contacts)) {
|
||||||
|
@ -129,6 +107,29 @@ class User
|
||||||
DBA::commit();
|
DBA::commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare field data for update/insert
|
||||||
|
*
|
||||||
|
* @param array $fields
|
||||||
|
* @return array prepared fields
|
||||||
|
*/
|
||||||
|
private static function preparedFields(array $fields): array
|
||||||
|
{
|
||||||
|
unset($fields['uid']);
|
||||||
|
unset($fields['cid']);
|
||||||
|
unset($fields['uri-id']);
|
||||||
|
|
||||||
|
if (isset($fields['readonly'])) {
|
||||||
|
$fields['ignored'] = $fields['readonly'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($fields['self'])) {
|
||||||
|
$fields['rel'] = Contact::SELF;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DBStructure::getFieldsForTable('user-contact', $fields);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block contact id for user id
|
* Block contact id for user id
|
||||||
*
|
*
|
||||||
|
|
|
@ -1548,6 +1548,8 @@ return [
|
||||||
"subhub" => ["type" => "boolean", "comment" => ""],
|
"subhub" => ["type" => "boolean", "comment" => ""],
|
||||||
"hub-verify" => ["type" => "varchar(255)", "comment" => ""],
|
"hub-verify" => ["type" => "varchar(255)", "comment" => ""],
|
||||||
"protocol" => ["type" => "char(4)", "comment" => "Protocol of the contact"],
|
"protocol" => ["type" => "char(4)", "comment" => "Protocol of the contact"],
|
||||||
|
"rating" => ["type" => "tinyint", "comment" => "Automatically detected feed poll frequency"],
|
||||||
|
"priority" => ["type" => "tinyint unsigned", "comment" => "Feed poll priority"],
|
||||||
],
|
],
|
||||||
"indexes" => [
|
"indexes" => [
|
||||||
"PRIMARY" => ["uid", "cid"],
|
"PRIMARY" => ["uid", "cid"],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user