`owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
`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',
- `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',
`size` int unsigned COMMENT 'Body size',
`created` datetime COMMENT '',
`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',
`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',
`size` int unsigned COMMENT 'Body size',
`created` datetime COMMENT '',
| owner-id | Item owner | int unsigned | 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 | |
-| 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 | |
| size | Body size | int unsigned | YES | | NULL | |
| created | | datetime | YES | | 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 | |
| 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 | |
| size | Body size | int unsigned | YES | | NULL | |
| created | | datetime | YES | | NULL | |
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)) {
$item = Post::selectFirst([], ['uri-id' => $engagement['uri-id']]);
if (empty($item)) {
'owner-id' => $parent['owner-id'],
'contact-type' => $parent['contact-contact-type'],
'media-type' => $mediatype,
- 'iso-639-1' => $language,
+ 'language' => $language,
'searchtext' => $searchtext,
'size' => self::getContentSize($parent),
'created' => $parent['created'],
'uri-id' => $uri_id,
'owner-id' => $item['owner-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),
'size' => Engagement::getContentSize($item),
'created' => $item['created'],
} elseif ($this->selectedTab == ChannelEntity::AUDIO) {
$condition = ["`media-type` & ?", 4];
} elseif ($this->selectedTab == ChannelEntity::LANGUAGE) {
- $condition = ["`iso-639-1` = ?", User::getLanguageCode($uid)];
+ $condition = ["`language` = ?", User::getLanguageCode($uid)];
} elseif (is_numeric($this->selectedTab)) {
$condition = $this->getUserChannelConditions($this->selectedTab, $uid);
}
$conditions = [];
$languages = $languages ?: User::getWantedLanguages($uid);
foreach ($languages as $language) {
- $conditions[] = "`iso-639-1` = ?";
+ $conditions[] = "`language` = ?";
$condition[] = $language;
}
if (!empty($conditions)) {
"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"],
"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"],
"size" => ["type" => "int unsigned", "comment" => "Body size"],
"created" => ["type" => "datetime", "comment" => ""],
"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"],
"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"],
"size" => ["type" => "int unsigned", "comment" => "Body size"],
"created" => ["type" => "datetime", "comment" => ""],
DBA::close($users);
return Update::SUCCESS;
-}
\ No newline at end of file
+}
+
+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;
+}