-- ------------------------------------------
-- Friendica 2025.02-dev (Interrupted Fern)
--- DB_UPDATE_VERSION 1579
+-- DB_UPDATE_VERSION 1580
-- ------------------------------------------
`publisher-url` varbinary(383) COMMENT 'URL of the publisher of the media',
`publisher-name` varchar(255) COMMENT 'Name of the publisher of the media',
`publisher-image` varbinary(383) COMMENT 'Image of the publisher of the media',
+ `language` char(3) COMMENT 'Language information about this media in the ISO 639 format',
+ `published` datetime COMMENT 'Publification date of this media',
+ `modified` datetime COMMENT 'Modification date of this media',
PRIMARY KEY(`id`),
UNIQUE INDEX `uri-id-url` (`uri-id`,`url`(512)),
INDEX `uri-id-id` (`uri-id`,`id`),
| publisher-url | URL of the publisher of the media | varbinary(383) | YES | | NULL | |
| publisher-name | Name of the publisher of the media | varchar(255) | YES | | NULL | |
| publisher-image | Image of the publisher of the media | varbinary(383) | YES | | NULL | |
+| language | Language information about this media in the ISO 639 format | char(3) | YES | | NULL | |
+| published | Publification date of this media | datetime | YES | | NULL | |
+| modified | Modification date of this media | datetime | YES | | NULL | |
Indexes
------------
$data['url'] = $media[0]['url'];
$data['title'] = $media[0]['name'];
$data['description'] = $media[0]['description'];
+ $data['language'] = $media[0]['language'];
$data['type'] = 'link';
$data['author_name'] = $media[0]['author-name'];
$data['author_url'] = $media[0]['author-url'];
$data['width'] = $media[0]['preview-width'];
$data['height'] = $media[0]['preview-height'];
$data['blurhash'] = $media[0]['blurhash'];
+ $data['published'] = $media[0]['published'];
return new \Friendica\Object\Api\Mastodon\Card($data, $history);
}
$media['publisher-name'] = $gserver['site_name'] ?? null;
$media['publisher-image'] = null;
+ if (!empty($item['language'])) {
+ $media['language'] = array_key_first(json_decode($item['language'], true));
+ }
+
+ $media['published'] = $item['created'];
+ $media['modified'] = $item['changed'];
+
DI::logger()->debug('Activity detected', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'plink' => $item['plink'], 'uri' => $item['uri']]);
return $media;
}
$media['publisher-url'] = $gserver['url'] ?? null;
$media['publisher-name'] = $gserver['site_name'] ?? null;
$media['publisher-image'] = null;
+ $media['language'] = null;
+ $media['published'] = $contact['created'];
+ $media['modified'] = $contact['updated'];
DI::logger()->debug('Account detected', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'uri' => $contact['url']]);
return $media;
$media['publisher-url'] = $data['publisher_url'] ?? null;
$media['publisher-name'] = $data['publisher_name'] ?? null;
$media['publisher-image'] = $data['publisher_img'] ?? null;
+ $media['language'] = $data['language'] ?? null;
+ $media['published'] = $data['published'] ?? null;
+ $media['modified'] = $data['modified'] ?? null;
return $media;
}
namespace Friendica\Object\Api\Mastodon;
use Friendica\BaseDataTransferObject;
+use Friendica\Util\DateTimeFormat;
/**
* Class Card
/** @var string */
protected $description;
/** @var string */
+ protected $language;
+ /** @var string */
protected $type;
/** @var string */
protected $author_name;
$this->url = $attachment['url'] ?? '';
$this->title = $attachment['title'] ?? '';
$this->description = $attachment['description'] ?? '';
+ $this->language = $attachment['language'] ?? '';
$this->type = $attachment['type'] ?? '';
$this->author_name = $attachment['author_name'] ?? '';
$this->author_url = $attachment['author_url'] ?? '';
$this->image = $attachment['image'] ?? '';
$this->embed_url = '';
$this->blurhash = $attachment['blurhash'] ?? '';
+ $this->published_at = !empty($attachment['published']) ? DateTimeFormat::utc($attachment['published'], DateTimeFormat::JSON) : null;
$this->history = $history;
}
$xpath = new DOMXPath($doc);
+ $list = $xpath->query('//html[@lang]');
+ foreach ($list as $node) {
+ if ($node->attributes->length) {
+ foreach ($node->attributes as $attribute) {
+ if ($attribute->name == 'lang') {
+ $siteinfo['language'] = $attribute->value;
+ }
+ }
+ }
+ }
+
$list = $xpath->query('//meta[@content]');
foreach ($list as $node) {
$meta_tag = [];
}
}
+ if (!empty($siteinfo['language'])) {
+ $siteinfo['language'] = explode('_', str_replace('-', '_', $siteinfo['language']))[0];
+ }
+
DI::logger()->info('Siteinfo fetched', ['url' => $url, 'siteinfo' => $siteinfo]);
Hook::callAll('getsiteinfo', $siteinfo);
// This file is required several times during the test in DbaDefinition which justifies this condition
if (!defined('DB_UPDATE_VERSION')) {
- define('DB_UPDATE_VERSION', 1579);
+ define('DB_UPDATE_VERSION', 1580);
}
return [
"publisher-url" => ["type" => "varbinary(383)", "comment" => "URL of the publisher of the media"],
"publisher-name" => ["type" => "varchar(255)", "comment" => "Name of the publisher of the media"],
"publisher-image" => ["type" => "varbinary(383)", "comment" => "Image of the publisher of the media"],
+ "language" => ["type" => "char(3)", "comment" => "Language information about this media in the ISO 639 format"],
+ "published" => ["type" => "datetime", "comment" => "Publification date of this media"],
+ "modified" => ["type" => "datetime", "comment" => "Modification date of this media"],
],
"indexes" => [
"PRIMARY" => ["id"],