. // }}} /** * WebFinger implementation for GNU social * * @package GNUsocial * * @author Diogo Peralta Cordeiro profile_page; } public function setProfilepage(string $profile_page): void { $this->profile_page = $profile_page; } public function getSource(): string { return $this->source; } public function setSource(string $source): void { $this->source = $source; } public function getActorId(): int { return $this->actor_id; } public function setActorId(int $actor_id): void { $this->actor_id = $actor_id; } public function getIsLocal(): bool { return $this->is_local; } public function setIsLocal(bool $is_local): void { $this->is_local = $is_local; } public function getCreated(): DateTimeInterface { return $this->created; } public function setCreated(DateTimeInterface $created): void { $this->created = $created; } public function getModified(): DateTimeInterface { return $this->modified; } public function setModified(DateTimeInterface $modified): void { $this->modified = $modified; } // @codeCoverageIgnoreEnd // }}} Autocode public static function getOrCreateByRemoteUri($actor_uri): self { $fnactor = DB::findBy('freenetwork_actor', ['profile_page' => $actor_uri, 'is_local' => false]); if ($fnactor === []) { // TODO grab with webfinger // If already has for a different protocol and isn't local, update // else create actor and then fnactor $fnactor = self::create([ 'profile_page' => $actor_uri, 'actor_id' => 1, 'is_local' => false, ]); DB::persist($fnactor); return $fnactor; } else { return $fnactor[0]; } } public static function schemaDef() { return [ 'name' => 'freenetwork_actor', 'fields' => [ 'profile_page' => ['type' => 'text', 'not null' => true], 'actor_id' => ['type' => 'int', 'not null' => true], 'is_local' => ['type' => 'bool', 'not null' => true, 'description' => 'whether this was a locally generated or an imported actor'], 'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'], 'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], ], 'primary key' => ['profile_page'], 'indexes' => [ 'freenetwork_profile_page_idx' => ['actor_id'], ], 'foreign keys' => [ 'freenetwork_actor_actor_id_fkey' => ['actor', ['actor_id' => 'id']], ], ]; } }