mirror of
https://github.com/friendica/friendica
synced 2024-11-09 17:02:54 +00:00
language field renamed to "language"
This commit is contained in:
parent
fc22a3e83f
commit
7faa42882b
9 changed files with 23 additions and 12 deletions
|
@ -1346,7 +1346,7 @@ CREATE TABLE IF NOT EXISTS `post-engagement` (
|
||||||
`owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
|
`owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
|
||||||
`contact-type` tinyint NOT NULL DEFAULT 0 COMMENT 'Person, organisation, news, community, relay',
|
`contact-type` tinyint NOT NULL DEFAULT 0 COMMENT 'Person, organisation, news, community, relay',
|
||||||
`media-type` tinyint NOT NULL DEFAULT 0 COMMENT 'Type of media in a bit array (1 = image, 2 = video, 4 = audio',
|
`media-type` tinyint NOT NULL DEFAULT 0 COMMENT 'Type of media in a bit array (1 = image, 2 = video, 4 = audio',
|
||||||
`iso-639-1` char(2) COMMENT 'Language information about this post in the ISO 639-1 format',
|
`language` char(2) COMMENT 'Language information about this post in the ISO 639-1 format',
|
||||||
`searchtext` mediumtext COMMENT 'Simplified text for the full text search',
|
`searchtext` mediumtext COMMENT 'Simplified text for the full text search',
|
||||||
`size` int unsigned COMMENT 'Body size',
|
`size` int unsigned COMMENT 'Body size',
|
||||||
`created` datetime COMMENT '',
|
`created` datetime COMMENT '',
|
||||||
|
@ -1469,7 +1469,7 @@ CREATE TABLE IF NOT EXISTS `post-searchindex` (
|
||||||
`uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
|
`uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
|
||||||
`owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
|
`owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
|
||||||
`media-type` tinyint NOT NULL DEFAULT 0 COMMENT 'Type of media in a bit array (1 = image, 2 = video, 4 = audio',
|
`media-type` tinyint NOT NULL DEFAULT 0 COMMENT 'Type of media in a bit array (1 = image, 2 = video, 4 = audio',
|
||||||
`iso-639-1` char(2) COMMENT 'Language information about this post in the ISO 639-1 format',
|
`language` char(2) COMMENT 'Language information about this post in the ISO 639-1 format',
|
||||||
`searchtext` mediumtext COMMENT 'Simplified text for the full text search',
|
`searchtext` mediumtext COMMENT 'Simplified text for the full text search',
|
||||||
`size` int unsigned COMMENT 'Body size',
|
`size` int unsigned COMMENT 'Body size',
|
||||||
`created` datetime COMMENT '',
|
`created` datetime COMMENT '',
|
||||||
|
|
|
@ -12,7 +12,7 @@ Fields
|
||||||
| owner-id | Item owner | int unsigned | NO | | 0 | |
|
| owner-id | Item owner | int unsigned | NO | | 0 | |
|
||||||
| contact-type | Person, organisation, news, community, relay | tinyint | NO | | 0 | |
|
| contact-type | Person, organisation, news, community, relay | tinyint | NO | | 0 | |
|
||||||
| media-type | Type of media in a bit array (1 = image, 2 = video, 4 = audio | tinyint | NO | | 0 | |
|
| media-type | Type of media in a bit array (1 = image, 2 = video, 4 = audio | tinyint | NO | | 0 | |
|
||||||
| iso-639-1 | Language information about this post in the ISO 639-1 format | char(2) | YES | | NULL | |
|
| language | Language information about this post in the ISO 639-1 format | char(2) | YES | | NULL | |
|
||||||
| searchtext | Simplified text for the full text search | mediumtext | YES | | NULL | |
|
| searchtext | Simplified text for the full text search | mediumtext | YES | | NULL | |
|
||||||
| size | Body size | int unsigned | YES | | NULL | |
|
| size | Body size | int unsigned | YES | | NULL | |
|
||||||
| created | | datetime | YES | | NULL | |
|
| created | | datetime | YES | | NULL | |
|
||||||
|
|
|
@ -11,7 +11,7 @@ Fields
|
||||||
| uri-id | Id of the item-uri table entry that contains the item uri | int unsigned | NO | PRI | NULL | |
|
| uri-id | Id of the item-uri table entry that contains the item uri | int unsigned | NO | PRI | NULL | |
|
||||||
| owner-id | Item owner | int unsigned | NO | | 0 | |
|
| owner-id | Item owner | int unsigned | NO | | 0 | |
|
||||||
| media-type | Type of media in a bit array (1 = image, 2 = video, 4 = audio | tinyint | NO | | 0 | |
|
| media-type | Type of media in a bit array (1 = image, 2 = video, 4 = audio | tinyint | NO | | 0 | |
|
||||||
| iso-639-1 | Language information about this post in the ISO 639-1 format | char(2) | YES | | NULL | |
|
| language | Language information about this post in the ISO 639-1 format | char(2) | YES | | NULL | |
|
||||||
| searchtext | Simplified text for the full text search | mediumtext | YES | | NULL | |
|
| searchtext | Simplified text for the full text search | mediumtext | YES | | NULL | |
|
||||||
| size | Body size | int unsigned | YES | | NULL | |
|
| size | Body size | int unsigned | YES | | NULL | |
|
||||||
| created | | datetime | YES | | NULL | |
|
| created | | datetime | YES | | NULL | |
|
||||||
|
|
|
@ -1376,7 +1376,7 @@ class PostUpdate
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$engagements = DBA::select('post-engagement', ['uri-id'], ["`iso-639-1` IS NULL"], ['order' => ['uri-id' => true], 'limit' => 1000]);
|
$engagements = DBA::select('post-engagement', ['uri-id'], ["`language` IS NULL"], ['order' => ['uri-id' => true], 'limit' => 1000]);
|
||||||
while ($engagement = DBA::fetch($engagements)) {
|
while ($engagement = DBA::fetch($engagements)) {
|
||||||
$item = Post::selectFirst([], ['uri-id' => $engagement['uri-id']]);
|
$item = Post::selectFirst([], ['uri-id' => $engagement['uri-id']]);
|
||||||
if (empty($item)) {
|
if (empty($item)) {
|
||||||
|
|
|
@ -104,7 +104,7 @@ class Engagement
|
||||||
'owner-id' => $parent['owner-id'],
|
'owner-id' => $parent['owner-id'],
|
||||||
'contact-type' => $parent['contact-contact-type'],
|
'contact-type' => $parent['contact-contact-type'],
|
||||||
'media-type' => $mediatype,
|
'media-type' => $mediatype,
|
||||||
'iso-639-1' => $language,
|
'language' => $language,
|
||||||
'searchtext' => $searchtext,
|
'searchtext' => $searchtext,
|
||||||
'size' => self::getContentSize($parent),
|
'size' => self::getContentSize($parent),
|
||||||
'created' => $parent['created'],
|
'created' => $parent['created'],
|
||||||
|
|
|
@ -53,7 +53,7 @@ class SearchIndex
|
||||||
'uri-id' => $uri_id,
|
'uri-id' => $uri_id,
|
||||||
'owner-id' => $item['owner-id'],
|
'owner-id' => $item['owner-id'],
|
||||||
'media-type' => Engagement::getMediaType($uri_id),
|
'media-type' => Engagement::getMediaType($uri_id),
|
||||||
'iso-639-1' => !empty($item['language']) ? (array_key_first(json_decode($item['language'], true)) ?? L10n::UNDETERMINED_LANGUAGE) : L10n::UNDETERMINED_LANGUAGE,
|
'language' => !empty($item['language']) ? (array_key_first(json_decode($item['language'], true)) ?? L10n::UNDETERMINED_LANGUAGE) : L10n::UNDETERMINED_LANGUAGE,
|
||||||
'searchtext' => Post\Engagement::getSearchTextForUriId($uri_id, $refresh),
|
'searchtext' => Post\Engagement::getSearchTextForUriId($uri_id, $refresh),
|
||||||
'size' => Engagement::getContentSize($item),
|
'size' => Engagement::getContentSize($item),
|
||||||
'created' => $item['created'],
|
'created' => $item['created'],
|
||||||
|
|
|
@ -324,7 +324,7 @@ class Timeline extends BaseModule
|
||||||
} elseif ($this->selectedTab == ChannelEntity::AUDIO) {
|
} elseif ($this->selectedTab == ChannelEntity::AUDIO) {
|
||||||
$condition = ["`media-type` & ?", 4];
|
$condition = ["`media-type` & ?", 4];
|
||||||
} elseif ($this->selectedTab == ChannelEntity::LANGUAGE) {
|
} elseif ($this->selectedTab == ChannelEntity::LANGUAGE) {
|
||||||
$condition = ["`iso-639-1` = ?", User::getLanguageCode($uid)];
|
$condition = ["`language` = ?", User::getLanguageCode($uid)];
|
||||||
} elseif (is_numeric($this->selectedTab)) {
|
} elseif (is_numeric($this->selectedTab)) {
|
||||||
$condition = $this->getUserChannelConditions($this->selectedTab, $uid);
|
$condition = $this->getUserChannelConditions($this->selectedTab, $uid);
|
||||||
}
|
}
|
||||||
|
@ -450,7 +450,7 @@ class Timeline extends BaseModule
|
||||||
$conditions = [];
|
$conditions = [];
|
||||||
$languages = $languages ?: User::getWantedLanguages($uid);
|
$languages = $languages ?: User::getWantedLanguages($uid);
|
||||||
foreach ($languages as $language) {
|
foreach ($languages as $language) {
|
||||||
$conditions[] = "`iso-639-1` = ?";
|
$conditions[] = "`language` = ?";
|
||||||
$condition[] = $language;
|
$condition[] = $language;
|
||||||
}
|
}
|
||||||
if (!empty($conditions)) {
|
if (!empty($conditions)) {
|
||||||
|
|
|
@ -1367,7 +1367,7 @@ return [
|
||||||
"owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "Item owner"],
|
"owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "Item owner"],
|
||||||
"contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Person, organisation, news, community, relay"],
|
"contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Person, organisation, news, community, relay"],
|
||||||
"media-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Type of media in a bit array (1 = image, 2 = video, 4 = audio"],
|
"media-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Type of media in a bit array (1 = image, 2 = video, 4 = audio"],
|
||||||
"iso-639-1" => ["type" => "char(2)", "comment" => "Language information about this post in the ISO 639-1 format"],
|
"language" => ["type" => "char(2)", "comment" => "Language information about this post in the ISO 639-1 format"],
|
||||||
"searchtext" => ["type" => "mediumtext", "comment" => "Simplified text for the full text search"],
|
"searchtext" => ["type" => "mediumtext", "comment" => "Simplified text for the full text search"],
|
||||||
"size" => ["type" => "int unsigned", "comment" => "Body size"],
|
"size" => ["type" => "int unsigned", "comment" => "Body size"],
|
||||||
"created" => ["type" => "datetime", "comment" => ""],
|
"created" => ["type" => "datetime", "comment" => ""],
|
||||||
|
@ -1488,7 +1488,7 @@ return [
|
||||||
"uri-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
|
"uri-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
|
||||||
"owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "Item owner"],
|
"owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "Item owner"],
|
||||||
"media-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Type of media in a bit array (1 = image, 2 = video, 4 = audio"],
|
"media-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Type of media in a bit array (1 = image, 2 = video, 4 = audio"],
|
||||||
"iso-639-1" => ["type" => "char(2)", "comment" => "Language information about this post in the ISO 639-1 format"],
|
"language" => ["type" => "char(2)", "comment" => "Language information about this post in the ISO 639-1 format"],
|
||||||
"searchtext" => ["type" => "mediumtext", "comment" => "Simplified text for the full text search"],
|
"searchtext" => ["type" => "mediumtext", "comment" => "Simplified text for the full text search"],
|
||||||
"size" => ["type" => "int unsigned", "comment" => "Body size"],
|
"size" => ["type" => "int unsigned", "comment" => "Body size"],
|
||||||
"created" => ["type" => "datetime", "comment" => ""],
|
"created" => ["type" => "datetime", "comment" => ""],
|
||||||
|
|
13
update.php
13
update.php
|
@ -1410,4 +1410,15 @@ function update_1539()
|
||||||
DBA::close($users);
|
DBA::close($users);
|
||||||
|
|
||||||
return Update::SUCCESS;
|
return Update::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pre_update_1550()
|
||||||
|
{
|
||||||
|
if (DBStructure::existsTable('post-engagement') && DBStructure::existsColumn('post-engagement', ['language'])) {
|
||||||
|
DBA::e("ALTER TABLE `post-engagement` DROP `language`");
|
||||||
|
}
|
||||||
|
if (DBStructure::existsTable('post-searchindex') && DBStructure::existsColumn('post-searchindex', ['network'])) {
|
||||||
|
DBA::e("ALTER TABLE `post-searchindex` DROP `network`, DROP `private`");
|
||||||
|
}
|
||||||
|
return Update::SUCCESS;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue