+++ /dev/null
-{
- "@context": {
- "id": "@id",
- "type": "@type",
- "as": "https://www.w3.org/ns/activitystreams#",
- "schema": "http://schema.org#",
- "fw": "https://funkwhale.audio/ns#",
- "xsd": "http://www.w3.org/2001/XMLSchema#",
- "Album": "fw:Album",
- "Track": "fw:Track",
- "Artist": "fw:Artist",
- "Library": "fw:Library",
- "bitrate": {
- "@id": "fw:bitrate",
- "@type": "xsd:nonNegativeInteger"
- },
- "size": {
- "@id": "fw:size",
- "@type": "xsd:nonNegativeInteger"
- },
- "position": {
- "@id": "fw:position",
- "@type": "xsd:nonNegativeInteger"
- },
- "disc": {
- "@id": "fw:disc",
- "@type": "xsd:nonNegativeInteger"
- },
- "library": {
- "@id": "fw:library",
- "@type": "@id"
- },
- "track": {
- "@id": "fw:track",
- "@type": "@id"
- },
- "cover": {
- "@id": "fw:cover",
- "@type": "as:Link"
- },
- "album": {
- "@id": "fw:album",
- "@type": "@id"
- },
- "artists": {
- "@id": "fw:artists",
- "@type": "@id",
- "@container": "@list"
- },
- "released": {
- "@id": "fw:released",
- "@type": "xsd:date"
- },
- "musicbrainzId": "fw:musicbrainzId",
- "license": {
- "@id": "fw:license",
- "@type": "@id"
- },
- "copyright": "fw:copyright",
- "category": "sc:category",
- "language": "sc:inLanguage"
- }
-}
Logger::info('Item insertion successful', ['user' => $item['uid'], 'item_id' => $item_id]);
$success = true;
} else {
- Logger::notice('Item insertion aborted', ['user' => $item['uid']]);
+ Logger::notice('Item insertion aborted', ['uri' => $item['uri'], 'uid' => $item['uid']]);
}
if ($item['uid'] == 0) {
*/
public static function clear()
{
- DBA::delete('inbox-entry', ["`wid` IS NULL AND `received` < ?", DateTimeFormat::utc('now - 4 hours')]);
+ // We delete all entries that aren't associated with a worker entry after seven days.
+ // The other entries are deleted when the worker deferred for too long.
+ DBA::delete('inbox-entry', ["`wid` IS NULL AND `received` < ?", DateTimeFormat::utc('now - 7 days')]);
}
/**
*/
public static function processReplyByUri(string $uri)
{
- $entries = DBA::select('inbox-entry', ['id'], ['in-reply-to-id' => $uri], ['order' => ['id' => true]]);
+ $entries = DBA::select('inbox-entry', ['id'], ["`in-reply-to-id` = ? AND `object-id` != ?", $uri, $uri]);
while ($entry = DBA::fetch($entries)) {
self::process($entry['id']);
}
Queue::processReplyByUri($url);
} elseif (!Worker::defer()) {
Logger::info('Activity could not be fetched', ['url' => $url]);
+ // @todo performe recursive deletion of all entries
} else {
Logger::info('Fetching deferred', ['url' => $url]);
}
--- /dev/null
+{
+ "@context": {
+ "id": "@id",
+ "type": "@type",
+ "as": "https://www.w3.org/ns/activitystreams#",
+ "schema": "http://schema.org#",
+ "fw": "https://funkwhale.audio/ns#",
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
+ "Album": "fw:Album",
+ "Track": "fw:Track",
+ "Artist": "fw:Artist",
+ "Library": "fw:Library",
+ "bitrate": {
+ "@id": "fw:bitrate",
+ "@type": "xsd:nonNegativeInteger"
+ },
+ "size": {
+ "@id": "fw:size",
+ "@type": "xsd:nonNegativeInteger"
+ },
+ "position": {
+ "@id": "fw:position",
+ "@type": "xsd:nonNegativeInteger"
+ },
+ "disc": {
+ "@id": "fw:disc",
+ "@type": "xsd:nonNegativeInteger"
+ },
+ "library": {
+ "@id": "fw:library",
+ "@type": "@id"
+ },
+ "track": {
+ "@id": "fw:track",
+ "@type": "@id"
+ },
+ "cover": {
+ "@id": "fw:cover",
+ "@type": "as:Link"
+ },
+ "album": {
+ "@id": "fw:album",
+ "@type": "@id"
+ },
+ "artists": {
+ "@id": "fw:artists",
+ "@type": "@id",
+ "@container": "@list"
+ },
+ "released": {
+ "@id": "fw:released",
+ "@type": "xsd:date"
+ },
+ "musicbrainzId": "fw:musicbrainzId",
+ "license": {
+ "@id": "fw:license",
+ "@type": "@id"
+ },
+ "copyright": "fw:copyright",
+ "category": "sc:category",
+ "language": "sc:inLanguage"
+ }
+}