kopia lustrzana https://github.com/nextcloud/social
Merge pull request #1943 from nextcloud/fix/noid/composer-conflict
fixing composer conflictpull/1944/head
commit
3bf6a40714
|
@ -33,6 +33,9 @@
|
|||
"nextcloud/ocp": "dev-master",
|
||||
"vimeo/psalm": "^5.1.0"
|
||||
},
|
||||
"replace": {
|
||||
"symfony/console": "*"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l",
|
||||
"cs:check": "php-cs-fixer fix --dry-run --diff",
|
||||
|
|
Plik diff jest za duży
Load Diff
|
@ -121,7 +121,7 @@ class AP {
|
|||
RemoveInterface $removeInterface,
|
||||
UndoInterface $undoInterface,
|
||||
UpdateInterface $updateInterface,
|
||||
ConfigService $configService
|
||||
ConfigService $configService,
|
||||
) {
|
||||
$this->acceptInterface = $acceptInterface;
|
||||
$this->addInterface = $addInterface;
|
||||
|
@ -152,7 +152,7 @@ class AP {
|
|||
AP::$activityPub = Server::get(AP::class);
|
||||
} catch (QueryException $e) {
|
||||
Server::get(LoggerInterface::class)
|
||||
->error($e->getMessage(), ['exception' => $e]);
|
||||
->error($e->getMessage(), ['exception' => $e]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ class AP {
|
|||
* @throws SocialAppConfigException
|
||||
* @throws ItemUnknownException
|
||||
*/
|
||||
public function getItemFromData(array $data, ACore $parent = null, int $level = 0): ACore {
|
||||
public function getItemFromData(array $data, ?ACore $parent = null, int $level = 0): ACore {
|
||||
if (++$level > self::REDUNDANCY_LIMIT) {
|
||||
throw new RedundancyLimitException((string)$level);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class AccountCreate extends Base {
|
|||
|
||||
public function __construct(
|
||||
IUserManager $userManager, AccountService $accountService,
|
||||
CacheActorService $cacheActorService, ConfigService $configService, MiscService $miscService
|
||||
CacheActorService $cacheActorService, ConfigService $configService, MiscService $miscService,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -45,9 +45,9 @@ class AccountCreate extends Base {
|
|||
protected function configure() {
|
||||
parent::configure();
|
||||
$this->setName('social:account:create')
|
||||
->addArgument('userId', InputArgument::REQUIRED, 'Nextcloud username of the account')
|
||||
->addOption('handle', '', InputOption::VALUE_REQUIRED, 'social handle')
|
||||
->setDescription('Create a new social account');
|
||||
->addArgument('userId', InputArgument::REQUIRED, 'Nextcloud username of the account')
|
||||
->addOption('handle', '', InputOption::VALUE_REQUIRED, 'social handle')
|
||||
->setDescription('Create a new social account');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,7 +29,7 @@ class AccountDelete extends Base {
|
|||
IUserManager $userManager,
|
||||
AccountService $accountService,
|
||||
CacheActorService $cacheActorService,
|
||||
ConfigService $configService
|
||||
ConfigService $configService,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -42,8 +42,8 @@ class AccountDelete extends Base {
|
|||
protected function configure(): void {
|
||||
parent::configure();
|
||||
$this->setName('social:account:delete')
|
||||
->addArgument('account', InputArgument::REQUIRED, 'Social Local Account')
|
||||
->setDescription('Delete a local social account');
|
||||
->addArgument('account', InputArgument::REQUIRED, 'Social Local Account')
|
||||
->setDescription('Delete a local social account');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ class AccountFollowing extends Base {
|
|||
|
||||
public function __construct(
|
||||
AccountService $accountService, CacheActorService $cacheActorService,
|
||||
FollowService $followService, ConfigService $configService, MiscService $miscService
|
||||
FollowService $followService, ConfigService $configService, MiscService $miscService,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -44,11 +44,11 @@ class AccountFollowing extends Base {
|
|||
protected function configure() {
|
||||
parent::configure();
|
||||
$this->setName('social:account:following')
|
||||
->addArgument('userId', InputArgument::REQUIRED, 'Nextcloud userid')
|
||||
->addArgument('account', InputArgument::REQUIRED, 'Account to follow')
|
||||
->addOption('local', '', InputOption::VALUE_NONE, 'account is local')
|
||||
->addOption('unfollow', '', InputOption::VALUE_NONE, 'unfollow')
|
||||
->setDescription('Following a new account');
|
||||
->addArgument('userId', InputArgument::REQUIRED, 'Nextcloud userid')
|
||||
->addArgument('account', InputArgument::REQUIRED, 'Account to follow')
|
||||
->addOption('local', '', InputOption::VALUE_NONE, 'account is local')
|
||||
->addOption('unfollow', '', InputOption::VALUE_NONE, 'unfollow')
|
||||
->setDescription('Following a new account');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,7 +27,7 @@ class CacheRefresh extends Base {
|
|||
|
||||
public function __construct(
|
||||
AccountService $accountService, CacheActorService $cacheActorService,
|
||||
DocumentService $documentService, HashtagService $hashtagService
|
||||
DocumentService $documentService, HashtagService $hashtagService,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -40,7 +40,7 @@ class CacheRefresh extends Base {
|
|||
protected function configure() {
|
||||
parent::configure();
|
||||
$this->setName('social:cache:refresh')
|
||||
->setDescription('Update the cache')
|
||||
->setDescription('Update the cache')
|
||||
->addOption('force', 'f', InputOption::VALUE_NONE, 'enforce update of cached account');
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class CheckInstall extends Base {
|
|||
IUserManager $userManager, StreamRequest $streamRequest, StreamDestRequest $streamDestRequest,
|
||||
StreamTagsRequest $streamTagsRequest, CacheActorService $cacheActorService,
|
||||
CheckService $checkService, ConfigService $configService, PushService $pushService,
|
||||
MiscService $miscService
|
||||
MiscService $miscService,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -62,13 +62,13 @@ class CheckInstall extends Base {
|
|||
protected function configure() {
|
||||
parent::configure();
|
||||
$this->setName('social:check:install')
|
||||
->addOption('index', '', InputOption::VALUE_NONE, 'regenerate your index')
|
||||
->addOption('index', '', InputOption::VALUE_NONE, 'regenerate your index')
|
||||
// ->addOption(
|
||||
// 'push', '', InputOption::VALUE_REQUIRED,
|
||||
// 'a local account used to test integration to Nextcloud Push',
|
||||
// ''
|
||||
// )
|
||||
->setDescription('Check the integrity of the installation');
|
||||
->setDescription('Check the integrity of the installation');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -57,13 +57,13 @@ class ExtendedBase extends Base {
|
|||
if ($objectId !== '' && $cache->hasItem($objectId)) {
|
||||
try {
|
||||
$cachedObject = $cache->getItem($objectId)
|
||||
->getObject();
|
||||
->getObject();
|
||||
|
||||
/** @var Stream $cachedItem */
|
||||
$cachedItem = AP::$activityPub->getItemFromData($cachedObject);
|
||||
$content = $cachedItem->getContent();
|
||||
$author = $cachedItem->getActor()
|
||||
->getAccount();
|
||||
->getAccount();
|
||||
} catch (CacheItemNotFoundException $e) {
|
||||
} catch (ItemUnknownException $e) {
|
||||
} catch (RedundancyLimitException $e) {
|
||||
|
@ -72,7 +72,7 @@ class ExtendedBase extends Base {
|
|||
} else {
|
||||
$content = $item->getContent();
|
||||
$author = $item->getActor()
|
||||
->getAccount();
|
||||
->getAccount();
|
||||
}
|
||||
|
||||
$content = ($this->crop) ? substr($content, 0, $this->crop) : $content;
|
||||
|
@ -82,7 +82,7 @@ class ExtendedBase extends Base {
|
|||
$item->getNid(),
|
||||
'<comment>' . $item->getId() . '</comment>',
|
||||
'<info>' . $item->getActor()
|
||||
->getAccount() . '</info>',
|
||||
->getAccount() . '</info>',
|
||||
$item->getType(),
|
||||
'<info>' . $author . '</info>',
|
||||
$content,
|
||||
|
|
|
@ -35,13 +35,13 @@ class Fediverse extends Base {
|
|||
protected function configure() {
|
||||
parent::configure();
|
||||
$this->setName('social:fediverse')
|
||||
->addOption(
|
||||
'type', 't', InputArgument::OPTIONAL,
|
||||
'Change the type of access management', ''
|
||||
)
|
||||
->addArgument('action', InputArgument::OPTIONAL, 'add/remove/test address', '')
|
||||
->addArgument('address', InputArgument::OPTIONAL, 'address/host', '')
|
||||
->setDescription('Allow or deny access to the fediverse');
|
||||
->addOption(
|
||||
'type', 't', InputArgument::OPTIONAL,
|
||||
'Change the type of access management', ''
|
||||
)
|
||||
->addArgument('action', InputArgument::OPTIONAL, 'add/remove/test address', '')
|
||||
->addArgument('address', InputArgument::OPTIONAL, 'address/host', '')
|
||||
->setDescription('Allow or deny access to the fediverse');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,7 +32,7 @@ class NoteBoost extends Base {
|
|||
public function __construct(
|
||||
AccountService $accountService,
|
||||
StreamService $streamService,
|
||||
BoostService $boostService
|
||||
BoostService $boostService,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -48,10 +48,10 @@ class NoteBoost extends Base {
|
|||
protected function configure() {
|
||||
parent::configure();
|
||||
$this->setName('social:note:boost')
|
||||
->addArgument('user_id', InputArgument::REQUIRED, 'userId of the author')
|
||||
->addArgument('note_id', InputArgument::REQUIRED, 'Note to boost')
|
||||
->addOption('unboost', '', InputOption::VALUE_NONE, 'Unboost')
|
||||
->setDescription('Boost a note');
|
||||
->addArgument('user_id', InputArgument::REQUIRED, 'userId of the author')
|
||||
->addArgument('note_id', InputArgument::REQUIRED, 'Note to boost')
|
||||
->addOption('unboost', '', InputOption::VALUE_NONE, 'Unboost')
|
||||
->setDescription('Boost a note');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class NoteCreate extends Base {
|
|||
*/
|
||||
public function __construct(
|
||||
ActivityService $activityService, AccountService $accountService, PostService $postService,
|
||||
CurlService $curlService, ConfigService $configService, MiscService $miscService
|
||||
CurlService $curlService, ConfigService $configService, MiscService $miscService,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -73,23 +73,23 @@ class NoteCreate extends Base {
|
|||
protected function configure() {
|
||||
parent::configure();
|
||||
$this->setName('social:note:create')
|
||||
->addOption(
|
||||
'replyTo', 'r', InputOption::VALUE_OPTIONAL, 'in reply to an existing thread'
|
||||
)
|
||||
->addOption(
|
||||
'to', 't', InputOption::VALUE_OPTIONAL, 'mentioning people'
|
||||
)
|
||||
->addOption(
|
||||
'type', 'y', InputOption::VALUE_OPTIONAL,
|
||||
'type: public (default), followers, unlisted, direct'
|
||||
)
|
||||
->addOption(
|
||||
'hashtag', 'g', InputOption::VALUE_OPTIONAL,
|
||||
'hashtag, without the leading #'
|
||||
)
|
||||
->addArgument('user_id', InputArgument::REQUIRED, 'userId of the author')
|
||||
->addArgument('content', InputArgument::REQUIRED, 'content of the post')
|
||||
->setDescription('Create a new note');
|
||||
->addOption(
|
||||
'replyTo', 'r', InputOption::VALUE_OPTIONAL, 'in reply to an existing thread'
|
||||
)
|
||||
->addOption(
|
||||
'to', 't', InputOption::VALUE_OPTIONAL, 'mentioning people'
|
||||
)
|
||||
->addOption(
|
||||
'type', 'y', InputOption::VALUE_OPTIONAL,
|
||||
'type: public (default), followers, unlisted, direct'
|
||||
)
|
||||
->addOption(
|
||||
'hashtag', 'g', InputOption::VALUE_OPTIONAL,
|
||||
'hashtag, without the leading #'
|
||||
)
|
||||
->addArgument('user_id', InputArgument::REQUIRED, 'userId of the author')
|
||||
->addArgument('content', InputArgument::REQUIRED, 'content of the post')
|
||||
->setDescription('Create a new note');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class NoteLike extends Base {
|
|||
*/
|
||||
public function __construct(
|
||||
AccountService $accountService, StreamService $streamService, LikeService $likeService,
|
||||
MiscService $miscService
|
||||
MiscService $miscService,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -62,10 +62,10 @@ class NoteLike extends Base {
|
|||
protected function configure() {
|
||||
parent::configure();
|
||||
$this->setName('social:note:like')
|
||||
->addArgument('user_id', InputArgument::REQUIRED, 'userId of the author')
|
||||
->addArgument('note_id', InputArgument::REQUIRED, 'Note to like')
|
||||
->addOption('unlike', '', InputOption::VALUE_NONE, 'Unlike')
|
||||
->setDescription('Like a note');
|
||||
->addArgument('user_id', InputArgument::REQUIRED, 'userId of the author')
|
||||
->addArgument('note_id', InputArgument::REQUIRED, 'Note to like')
|
||||
->addOption('unlike', '', InputOption::VALUE_NONE, 'Unlike')
|
||||
->setDescription('Like a note');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class QueueProcess extends Base {
|
|||
public function __construct(
|
||||
ActivityService $activityService, RequestQueueService $requestQueueService,
|
||||
StreamQueueService $streamQueueService, ConfigService $configService,
|
||||
MiscService $miscService
|
||||
MiscService $miscService,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -57,7 +57,7 @@ class QueueProcess extends Base {
|
|||
protected function configure() {
|
||||
parent::configure();
|
||||
$this->setName('social:queue:process')
|
||||
->setDescription('Process the request queue');
|
||||
->setDescription('Process the request queue');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class QueueStatus extends Base {
|
|||
* @param MiscService $miscService
|
||||
*/
|
||||
public function __construct(
|
||||
RequestQueueService $requestQueueService, ConfigService $configService, MiscService $miscService
|
||||
RequestQueueService $requestQueueService, ConfigService $configService, MiscService $miscService,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -50,10 +50,10 @@ class QueueStatus extends Base {
|
|||
protected function configure() {
|
||||
parent::configure();
|
||||
$this->setName('social:queue:status')
|
||||
->addOption(
|
||||
'token', 't', InputOption::VALUE_OPTIONAL, 'token of a request'
|
||||
)
|
||||
->setDescription('Return status on the request queue');
|
||||
->addOption(
|
||||
'token', 't', InputOption::VALUE_OPTIONAL, 'token of a request'
|
||||
)
|
||||
->setDescription('Return status on the request queue');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class Reset extends Base {
|
|||
*/
|
||||
public function __construct(
|
||||
CoreRequestBuilder $coreRequestBuilder, CheckService $checkService, ConfigService $configService,
|
||||
MiscService $miscService
|
||||
MiscService $miscService,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -58,8 +58,8 @@ class Reset extends Base {
|
|||
protected function configure() {
|
||||
parent::configure();
|
||||
$this->setName('social:reset')
|
||||
->addOption('uninstall', '', InputOption::VALUE_NONE, 'full removing of the app')
|
||||
->setDescription('Reset ALL data related to the Social App');
|
||||
->addOption('uninstall', '', InputOption::VALUE_NONE, 'full removing of the app')
|
||||
->setDescription('Reset ALL data related to the Social App');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class StreamDetails extends ExtendedBase {
|
|||
* @param MiscService $miscService
|
||||
*/
|
||||
public function __construct(
|
||||
StreamService $streamService, DetailsService $detailsService, MiscService $miscService
|
||||
StreamService $streamService, DetailsService $detailsService, MiscService $miscService,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -58,9 +58,9 @@ class StreamDetails extends ExtendedBase {
|
|||
protected function configure() {
|
||||
parent::configure();
|
||||
$this->setName('social:details')
|
||||
->addArgument('streamId', InputArgument::REQUIRED, 'Id of the Stream item')
|
||||
->addOption('json', '', InputOption::VALUE_NONE, 'return JSON format')
|
||||
->setDescription('Get details about a Stream item');
|
||||
->addArgument('streamId', InputArgument::REQUIRED, 'Id of the Stream item')
|
||||
->addOption('json', '', InputOption::VALUE_NONE, 'return JSON format')
|
||||
->setDescription('Get details about a Stream item');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class Timeline extends ExtendedBase {
|
|||
StreamRequest $streamRequest,
|
||||
AccountService $accountService,
|
||||
CacheActorService $cacheActorService,
|
||||
ConfigService $configService
|
||||
ConfigService $configService,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -69,16 +69,16 @@ class Timeline extends ExtendedBase {
|
|||
protected function configure() {
|
||||
parent::configure();
|
||||
$this->setName('social:timeline')
|
||||
->addArgument('userId', InputArgument::REQUIRED, 'viewer')
|
||||
->addArgument('timeline', InputArgument::REQUIRED, 'timeline')
|
||||
->addOption('local', '', InputOption::VALUE_NONE, 'public')
|
||||
->addOption('min_id', '', InputOption::VALUE_REQUIRED, 'min_id', 0)
|
||||
->addOption('max_id', '', InputOption::VALUE_REQUIRED, 'max_id', 0)
|
||||
->addOption('since', '', InputOption::VALUE_REQUIRED, 'since', 0)
|
||||
->addOption('limit', '', InputOption::VALUE_REQUIRED, 'limit', 5)
|
||||
->addOption('account', '', InputOption::VALUE_REQUIRED, 'account', '')
|
||||
->addOption('crop', '', InputOption::VALUE_REQUIRED, 'crop', 0)
|
||||
->setDescription('Get stream by timeline and viewer');
|
||||
->addArgument('userId', InputArgument::REQUIRED, 'viewer')
|
||||
->addArgument('timeline', InputArgument::REQUIRED, 'timeline')
|
||||
->addOption('local', '', InputOption::VALUE_NONE, 'public')
|
||||
->addOption('min_id', '', InputOption::VALUE_REQUIRED, 'min_id', 0)
|
||||
->addOption('max_id', '', InputOption::VALUE_REQUIRED, 'max_id', 0)
|
||||
->addOption('since', '', InputOption::VALUE_REQUIRED, 'since', 0)
|
||||
->addOption('limit', '', InputOption::VALUE_REQUIRED, 'limit', 5)
|
||||
->addOption('account', '', InputOption::VALUE_REQUIRED, 'account', '')
|
||||
->addOption('crop', '', InputOption::VALUE_REQUIRED, 'crop', 0)
|
||||
->setDescription('Get stream by timeline and viewer');
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,9 +111,9 @@ class Timeline extends ExtendedBase {
|
|||
$options = new ProbeOptions();
|
||||
$options->setFormat(Stream::FORMAT_LOCAL);
|
||||
$options->setLimit(intval($input->getOption('limit')))
|
||||
->setMinId(intval($input->getOption('min_id')))
|
||||
->setMaxId(intval($input->getOption('max_id')))
|
||||
->setSince(intval($input->getOption('since')));
|
||||
->setMinId(intval($input->getOption('min_id')))
|
||||
->setMaxId(intval($input->getOption('max_id')))
|
||||
->setSince(intval($input->getOption('since')));
|
||||
|
||||
if ($input->getOption('local')) {
|
||||
$options->setLocal(true);
|
||||
|
@ -122,7 +122,7 @@ class Timeline extends ExtendedBase {
|
|||
$timeline = $input->getArgument('timeline');
|
||||
if (str_starts_with($timeline, '#')) {
|
||||
$options->setProbe(ProbeOptions::HASHTAG)
|
||||
->setArgument(substr($timeline, 1));
|
||||
->setArgument(substr($timeline, 1));
|
||||
} else {
|
||||
$options->setProbe($timeline);
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class ActivityPubController extends Controller {
|
|||
FollowService $followService,
|
||||
StreamService $streamService,
|
||||
ConfigService $configService,
|
||||
LoggerInterface $logger
|
||||
LoggerInterface $logger,
|
||||
) {
|
||||
parent::__construct(Application::APP_ID, $request);
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ class ApiController extends Controller {
|
|||
StreamService $streamService,
|
||||
ActionService $actionService,
|
||||
PostService $postService,
|
||||
ConfigService $configService
|
||||
ConfigService $configService,
|
||||
) {
|
||||
parent::__construct(Application::APP_ID, $request);
|
||||
|
||||
|
@ -111,7 +111,7 @@ class ApiController extends Controller {
|
|||
|
||||
$authHeader = trim($this->request->getHeader('Authorization'));
|
||||
if (strpos($authHeader, ' ')) {
|
||||
list($authType, $authToken) = explode(' ', $authHeader);
|
||||
[$authType, $authToken] = explode(' ', $authHeader);
|
||||
if (strtolower($authType) === 'bearer') {
|
||||
$this->bearer = $authToken;
|
||||
}
|
||||
|
@ -370,7 +370,7 @@ class ApiController extends Controller {
|
|||
|
||||
/**
|
||||
* @param string $ext
|
||||
* only support image actually
|
||||
* only support image actually
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -401,7 +401,7 @@ class ApiController extends Controller {
|
|||
int $limit = 20,
|
||||
int $max_id = 0,
|
||||
int $min_id = 0,
|
||||
int $since_id = 0
|
||||
int $since_id = 0,
|
||||
): DataResponse {
|
||||
try {
|
||||
$this->initViewer(true);
|
||||
|
@ -422,11 +422,11 @@ class ApiController extends Controller {
|
|||
$options = new ProbeOptions($this->request);
|
||||
$options->setFormat(ACore::FORMAT_LOCAL);
|
||||
$options->setProbe($timeline)
|
||||
->setLocal($local)
|
||||
->setLimit($limit)
|
||||
->setMaxId($max_id)
|
||||
->setMinId($min_id)
|
||||
->setSince($since_id);
|
||||
->setLocal($local)
|
||||
->setLimit($limit)
|
||||
->setMaxId($max_id)
|
||||
->setMinId($min_id)
|
||||
->setSince($since_id);
|
||||
|
||||
$posts = $this->streamService->getTimeline($options);
|
||||
|
||||
|
@ -538,7 +538,7 @@ class ApiController extends Controller {
|
|||
int $limit = 20,
|
||||
int $max_id = 0,
|
||||
int $min_id = 0,
|
||||
int $since_id = 0
|
||||
int $since_id = 0,
|
||||
): DataResponse {
|
||||
try {
|
||||
$this->initViewer(true);
|
||||
|
@ -548,11 +548,11 @@ class ApiController extends Controller {
|
|||
$options = new ProbeOptions($this->request);
|
||||
$options->setFormat(ACore::FORMAT_LOCAL);
|
||||
$options->setProbe(ProbeOptions::ACCOUNT)
|
||||
->setAccountId($local->getId())
|
||||
->setLimit($limit)
|
||||
->setMaxId($max_id)
|
||||
->setMinId($min_id)
|
||||
->setSince($since_id);
|
||||
->setAccountId($local->getId())
|
||||
->setLimit($limit)
|
||||
->setMaxId($max_id)
|
||||
->setMinId($min_id)
|
||||
->setSince($since_id);
|
||||
|
||||
$posts = $this->streamService->getTimeline($options);
|
||||
|
||||
|
@ -576,7 +576,7 @@ class ApiController extends Controller {
|
|||
int $limit = 20,
|
||||
int $max_id = 0,
|
||||
int $min_id = 0,
|
||||
int $since = 0
|
||||
int $since = 0,
|
||||
): DataResponse {
|
||||
try {
|
||||
$this->initViewer(true);
|
||||
|
@ -585,11 +585,11 @@ class ApiController extends Controller {
|
|||
$options = new ProbeOptions($this->request);
|
||||
$options->setFormat(ACore::FORMAT_LOCAL);
|
||||
$options->setProbe(ProbeOptions::FOLLOWING)
|
||||
->setAccountId($local->getId())
|
||||
->setLimit($limit)
|
||||
->setMaxId($max_id)
|
||||
->setMinId($min_id)
|
||||
->setSince($since);
|
||||
->setAccountId($local->getId())
|
||||
->setLimit($limit)
|
||||
->setMaxId($max_id)
|
||||
->setMinId($min_id)
|
||||
->setSince($since);
|
||||
|
||||
return new DataResponse($this->cacheActorService->probeActors($options), Http::STATUS_OK);
|
||||
} catch (Exception $e) {
|
||||
|
@ -611,7 +611,7 @@ class ApiController extends Controller {
|
|||
int $limit = 20,
|
||||
int $max_id = 0,
|
||||
int $min_id = 0,
|
||||
int $since = 0
|
||||
int $since = 0,
|
||||
): DataResponse {
|
||||
try {
|
||||
$this->initViewer(true);
|
||||
|
@ -621,11 +621,11 @@ class ApiController extends Controller {
|
|||
$options = new ProbeOptions($this->request);
|
||||
$options->setFormat(ACore::FORMAT_LOCAL);
|
||||
$options->setProbe(ProbeOptions::FOLLOWERS)
|
||||
->setAccountId($local->getId())
|
||||
->setLimit($limit)
|
||||
->setMaxId($max_id)
|
||||
->setMinId($min_id)
|
||||
->setSince($since);
|
||||
->setAccountId($local->getId())
|
||||
->setLimit($limit)
|
||||
->setMaxId($max_id)
|
||||
->setMinId($min_id)
|
||||
->setSince($since);
|
||||
|
||||
return new DataResponse($this->cacheActorService->probeActors($options), Http::STATUS_OK);
|
||||
} catch (Exception $e) {
|
||||
|
@ -649,7 +649,7 @@ class ApiController extends Controller {
|
|||
int $limit = 20,
|
||||
int $max_id = 0,
|
||||
int $min_id = 0,
|
||||
int $since_id = 0
|
||||
int $since_id = 0,
|
||||
): DataResponse {
|
||||
try {
|
||||
$this->initViewer(true);
|
||||
|
@ -657,10 +657,10 @@ class ApiController extends Controller {
|
|||
$options = new ProbeOptions($this->request);
|
||||
$options->setFormat(ACore::FORMAT_LOCAL);
|
||||
$options->setProbe(ProbeOptions::FAVOURITES)
|
||||
->setLimit($limit)
|
||||
->setMaxId($max_id)
|
||||
->setMinId($min_id)
|
||||
->setSince($since_id);
|
||||
->setLimit($limit)
|
||||
->setMaxId($max_id)
|
||||
->setMinId($min_id)
|
||||
->setSince($since_id);
|
||||
|
||||
$posts = $this->streamService->getTimeline($options);
|
||||
|
||||
|
@ -684,7 +684,7 @@ class ApiController extends Controller {
|
|||
int $since_id = 0,
|
||||
array $types = [],
|
||||
array $exclude_types = [],
|
||||
string $accountId = ''
|
||||
string $accountId = '',
|
||||
): DataResponse {
|
||||
try {
|
||||
$this->initViewer(true);
|
||||
|
@ -692,13 +692,13 @@ class ApiController extends Controller {
|
|||
$options = new ProbeOptions($this->request);
|
||||
$options->setFormat(ACore::FORMAT_LOCAL);
|
||||
$options->setProbe(ProbeOptions::NOTIFICATIONS)
|
||||
->setLimit($limit)
|
||||
->setMaxId($max_id)
|
||||
->setMinId($min_id)
|
||||
->setSince($since_id)
|
||||
->setTypes($types)
|
||||
->setExcludeTypes($exclude_types)
|
||||
->setAccountId($accountId);
|
||||
->setLimit($limit)
|
||||
->setMaxId($max_id)
|
||||
->setMinId($min_id)
|
||||
->setSince($since_id)
|
||||
->setTypes($types)
|
||||
->setExcludeTypes($exclude_types)
|
||||
->setAccountId($accountId);
|
||||
|
||||
$posts = $this->streamService->getTimeline($options);
|
||||
|
||||
|
@ -722,7 +722,7 @@ class ApiController extends Controller {
|
|||
int $min_id = 0,
|
||||
int $since_id = 0,
|
||||
bool $local = false,
|
||||
bool $only_media = false
|
||||
bool $only_media = false,
|
||||
): DataResponse {
|
||||
try {
|
||||
$this->initViewer(true);
|
||||
|
@ -730,13 +730,13 @@ class ApiController extends Controller {
|
|||
$options = new ProbeOptions($this->request);
|
||||
$options->setFormat(ACore::FORMAT_LOCAL);
|
||||
$options->setProbe('hashtag')
|
||||
->setLimit($limit)
|
||||
->setMaxId($max_id)
|
||||
->setMinId($min_id)
|
||||
->setSince($since_id)
|
||||
->setLocal($local)
|
||||
->setOnlyMedia($only_media)
|
||||
->setArgument($hashtag);
|
||||
->setLimit($limit)
|
||||
->setMaxId($max_id)
|
||||
->setMinId($min_id)
|
||||
->setSince($since_id)
|
||||
->setLocal($local)
|
||||
->setOnlyMedia($only_media)
|
||||
->setArgument($hashtag);
|
||||
|
||||
$posts = $this->streamService->getTimeline($options);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class ConfigController extends Controller {
|
|||
|
||||
public function __construct(
|
||||
string $appName, IRequest $request, TestService $testService,
|
||||
ConfigService $configService, MiscService $miscService
|
||||
ConfigService $configService, MiscService $miscService,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class LocalController extends Controller {
|
|||
FollowService $followService, PostService $postService, StreamService $streamService,
|
||||
SearchService $searchService,
|
||||
BoostService $boostService, LikeService $likeService, DocumentService $documentService,
|
||||
MiscService $miscService
|
||||
MiscService $miscService,
|
||||
) {
|
||||
parent::__construct(Application::APP_ID, $request);
|
||||
|
||||
|
@ -103,7 +103,7 @@ class LocalController extends Controller {
|
|||
*
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function postCreate(string $content = '', array $to = [], string $type = null, ?string $replyTo = null, $attachments = null, array $hashtags = []): DataResponse {
|
||||
public function postCreate(string $content = '', array $to = [], ?string $type = null, ?string $replyTo = null, $attachments = null, array $hashtags = []): DataResponse {
|
||||
$content = $content ?: '';
|
||||
$replyTo = $replyTo ?? '';
|
||||
$type = $type ?? Stream::TYPE_PUBLIC;
|
||||
|
|
|
@ -66,7 +66,7 @@ class NavigationController extends Controller {
|
|||
DocumentService $documentService,
|
||||
ConfigService $configService,
|
||||
CheckService $checkService,
|
||||
MiscService $miscService
|
||||
MiscService $miscService,
|
||||
) {
|
||||
parent::__construct(Application::APP_ID, $request);
|
||||
|
||||
|
@ -99,7 +99,7 @@ class NavigationController extends Controller {
|
|||
'firstrun' => false,
|
||||
'setup' => false,
|
||||
'isAdmin' => Server::get(IGroupManager::class)
|
||||
->isAdmin($this->userId),
|
||||
->isAdmin($this->userId),
|
||||
'cliUrl' => $this->getCliUrl()
|
||||
];
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class OAuthController extends Controller {
|
|||
ClientService $clientService,
|
||||
ConfigService $configService,
|
||||
LoggerInterface $logger,
|
||||
IInitialState $initialState
|
||||
IInitialState $initialState,
|
||||
) {
|
||||
parent::__construct(Application::APP_ID, $request);
|
||||
|
||||
|
@ -87,17 +87,17 @@ class OAuthController extends Controller {
|
|||
}
|
||||
|
||||
$nodeInfo = [
|
||||
"version" => "2.0",
|
||||
"software" => [
|
||||
"name" => $name,
|
||||
"version" => $version
|
||||
'version' => '2.0',
|
||||
'software' => [
|
||||
'name' => $name,
|
||||
'version' => $version
|
||||
],
|
||||
"protocols" => [
|
||||
"activitypub"
|
||||
'protocols' => [
|
||||
'activitypub'
|
||||
],
|
||||
"rootUrl" => rtrim($this->urlGenerator->linkToRouteAbsolute('social.Navigation.navigate'), '/'),
|
||||
"usage" => $usage,
|
||||
"openRegistrations" => $openReg
|
||||
'rootUrl' => rtrim($this->urlGenerator->linkToRouteAbsolute('social.Navigation.navigate'), '/'),
|
||||
'usage' => $usage,
|
||||
'openRegistrations' => $openReg
|
||||
];
|
||||
|
||||
return new DataResponse($nodeInfo, Http::STATUS_OK);
|
||||
|
@ -116,7 +116,7 @@ class OAuthController extends Controller {
|
|||
string $client_name = '',
|
||||
$redirect_uris = '',
|
||||
string $website = '',
|
||||
string $scopes = 'read'
|
||||
string $scopes = 'read',
|
||||
): DataResponse {
|
||||
// TODO: manage array from request
|
||||
if (!is_array($redirect_uris)) {
|
||||
|
@ -152,7 +152,7 @@ class OAuthController extends Controller {
|
|||
string $client_id,
|
||||
string $redirect_uri,
|
||||
string $response_type,
|
||||
string $scope = 'read'
|
||||
string $scope = 'read',
|
||||
): Response {
|
||||
$user = $this->userSession->getUser();
|
||||
|
||||
|
@ -186,7 +186,7 @@ class OAuthController extends Controller {
|
|||
string $client_id,
|
||||
string $redirect_uri,
|
||||
string $response_type,
|
||||
string $scope = 'read'
|
||||
string $scope = 'read',
|
||||
): DataResponse {
|
||||
try {
|
||||
$user = $this->userSession->getUser();
|
||||
|
@ -240,7 +240,7 @@ class OAuthController extends Controller {
|
|||
string $redirect_uri,
|
||||
string $grant_type,
|
||||
string $scope = 'read',
|
||||
string $code = ''
|
||||
string $code = '',
|
||||
): DataResponse {
|
||||
try {
|
||||
$client = $this->clientService->getFromClientId($client_id);
|
||||
|
@ -276,10 +276,10 @@ class OAuthController extends Controller {
|
|||
|
||||
return new DataResponse(
|
||||
[
|
||||
"access_token" => $client->getToken(),
|
||||
"token_type" => 'Bearer',
|
||||
"scope" => $scope,
|
||||
"created_at" => $client->getCreation()
|
||||
'access_token' => $client->getToken(),
|
||||
'token_type' => 'Bearer',
|
||||
'scope' => $scope,
|
||||
'created_at' => $client->getCreation()
|
||||
], Http::STATUS_OK
|
||||
);
|
||||
} catch (ClientNotFoundException $e) {
|
||||
|
|
|
@ -40,7 +40,7 @@ class OStatusController extends Controller {
|
|||
|
||||
public function __construct(
|
||||
IRequest $request, IInitialStateService $initialStateService, CacheActorService $cacheActorService, AccountService $accountService,
|
||||
CurlService $curlService, MiscService $miscService, IUserSession $userSession
|
||||
CurlService $curlService, MiscService $miscService, IUserSession $userSession,
|
||||
) {
|
||||
parent::__construct(Application::APP_ID, $request);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class QueueController extends Controller {
|
|||
|
||||
public function __construct(
|
||||
IRequest $request, RequestQueueService $requestQueueService, ActivityService $activityService,
|
||||
MiscService $miscService
|
||||
MiscService $miscService,
|
||||
) {
|
||||
parent::__construct(Application::APP_ID, $request);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class SocialPubController extends Controller {
|
|||
public function __construct(
|
||||
?string $userId, IInitialStateService $initialStateService, IRequest $request, IL10N $l10n, NavigationController $navigationController,
|
||||
CacheActorService $cacheActorService, AccountService $accountService, StreamService $streamService,
|
||||
ConfigService $configService
|
||||
ConfigService $configService,
|
||||
) {
|
||||
parent::__construct(Application::APP_ID, $request);
|
||||
|
||||
|
@ -157,7 +157,7 @@ class SocialPubController extends Controller {
|
|||
} catch (AccountDoesNotExistException $e) {
|
||||
}
|
||||
|
||||
// $postId = $this->configService->getSocialUrl() . '@' . $username . '/' . $token;
|
||||
// $postId = $this->configService->getSocialUrl() . '@' . $username . '/' . $token;
|
||||
|
||||
$stream = $this->streamService->getStreamByNid($token);
|
||||
if (strtolower($stream->getActor()->getDisplayName()) !== strtolower($username)) {
|
||||
|
|
|
@ -17,7 +17,7 @@ class SocialWidget implements IWidget {
|
|||
|
||||
public function __construct(
|
||||
IL10N $l10n,
|
||||
IURLGenerator $urlGenerator
|
||||
IURLGenerator $urlGenerator,
|
||||
) {
|
||||
$this->l10n = $l10n;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
|
|
|
@ -31,12 +31,12 @@ class ActionsRequest extends ActionsRequestBuilder {
|
|||
public function save(ACore $like): void {
|
||||
$qb = $this->getActionsInsertSql();
|
||||
$qb->setValue('id', $qb->createNamedParameter($like->getId()))
|
||||
->setValue('id_prim', $qb->createNamedParameter($qb->prim($like->getId())))
|
||||
->setValue('actor_id', $qb->createNamedParameter($like->getActorId()))
|
||||
->setValue('actor_id_prim', $qb->createNamedParameter($qb->prim($like->getActorId())))
|
||||
->setValue('type', $qb->createNamedParameter($like->getType()))
|
||||
->setValue('object_id', $qb->createNamedParameter($like->getObjectId()))
|
||||
->setValue('object_id_prim', $qb->createNamedParameter($qb->prim($like->getObjectId())));
|
||||
->setValue('id_prim', $qb->createNamedParameter($qb->prim($like->getId())))
|
||||
->setValue('actor_id', $qb->createNamedParameter($like->getActorId()))
|
||||
->setValue('actor_id_prim', $qb->createNamedParameter($qb->prim($like->getActorId())))
|
||||
->setValue('type', $qb->createNamedParameter($like->getType()))
|
||||
->setValue('object_id', $qb->createNamedParameter($like->getObjectId()))
|
||||
->setValue('object_id_prim', $qb->createNamedParameter($qb->prim($like->getObjectId())));
|
||||
|
||||
try {
|
||||
$qb->setValue(
|
||||
|
@ -142,7 +142,7 @@ class ActionsRequest extends ActionsRequestBuilder {
|
|||
public function moveAccount(string $actorId, string $newId): void {
|
||||
$qb = $this->getActionsUpdateSql();
|
||||
$qb->set('actor_id', $qb->createNamedParameter($newId))
|
||||
->set('actor_id_prim', $qb->createNamedParameter($qb->prim($newId)));
|
||||
->set('actor_id_prim', $qb->createNamedParameter($qb->prim($newId)));
|
||||
|
||||
$qb->limitToDBField('actor_id_prim', $qb->prim($actorId));
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class ActionsRequestBuilder extends CoreRequestBuilder {
|
|||
|
||||
/** @noinspection PhpMethodParametersCountMismatchInspection */
|
||||
$qb->select('a.id', 'a.type', 'a.actor_id', 'a.object_id', 'a.creation')
|
||||
->from(self::TABLE_ACTIONS, 'a');
|
||||
->from(self::TABLE_ACTIONS, 'a');
|
||||
|
||||
$this->defaultSelectAlias = 'a';
|
||||
$qb->setDefaultSelectAlias('a');
|
||||
|
@ -67,7 +67,7 @@ class ActionsRequestBuilder extends CoreRequestBuilder {
|
|||
protected function countActionsSelectSql(): SocialQueryBuilder {
|
||||
$qb = $this->getQueryBuilder();
|
||||
$qb->selectAlias($qb->createFunction('COUNT(*)'), 'count')
|
||||
->from(self::TABLE_ACTIONS, 'a');
|
||||
->from(self::TABLE_ACTIONS, 'a');
|
||||
|
||||
$this->defaultSelectAlias = 'a';
|
||||
$qb->setDefaultSelectAlias('a');
|
||||
|
@ -84,7 +84,7 @@ class ActionsRequestBuilder extends CoreRequestBuilder {
|
|||
protected function getActionsDeleteSql(): SocialQueryBuilder {
|
||||
$qb = $this->getQueryBuilder();
|
||||
$qb->delete(self::TABLE_ACTIONS)
|
||||
->setDefaultSelectAlias('a');
|
||||
->setDefaultSelectAlias('a');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
|
|
@ -27,20 +27,20 @@ class ActorsRequest extends ActorsRequestBuilder {
|
|||
$qb = $this->getActorsInsertSql();
|
||||
|
||||
$qb->setValue('id', $qb->createNamedParameter($actor->getId()))
|
||||
->setValue('id_prim', $qb->createNamedParameter($qb->prim($actor->getId())))
|
||||
->setValue('user_id', $qb->createNamedParameter($actor->getUserId()))
|
||||
->setValue('name', $qb->createNamedParameter($actor->getName()))
|
||||
->setValue('summary', $qb->createNamedParameter($actor->getSummary()))
|
||||
->setValue('avatar_version', $qb->createNamedParameter($actor->getAvatarVersion()))
|
||||
->setValue(
|
||||
'preferred_username', $qb->createNamedParameter($actor->getPreferredUsername())
|
||||
)
|
||||
->setValue('public_key', $qb->createNamedParameter($actor->getPublicKey()))
|
||||
->setValue('private_key', $qb->createNamedParameter($actor->getPrivateKey()))
|
||||
->setValue(
|
||||
'creation',
|
||||
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
||||
);
|
||||
->setValue('id_prim', $qb->createNamedParameter($qb->prim($actor->getId())))
|
||||
->setValue('user_id', $qb->createNamedParameter($actor->getUserId()))
|
||||
->setValue('name', $qb->createNamedParameter($actor->getName()))
|
||||
->setValue('summary', $qb->createNamedParameter($actor->getSummary()))
|
||||
->setValue('avatar_version', $qb->createNamedParameter($actor->getAvatarVersion()))
|
||||
->setValue(
|
||||
'preferred_username', $qb->createNamedParameter($actor->getPreferredUsername())
|
||||
)
|
||||
->setValue('public_key', $qb->createNamedParameter($actor->getPublicKey()))
|
||||
->setValue('private_key', $qb->createNamedParameter($actor->getPrivateKey()))
|
||||
->setValue(
|
||||
'creation',
|
||||
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
||||
);
|
||||
|
||||
$qb->executeStatement();
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class ActorsRequest extends ActorsRequestBuilder {
|
|||
public function refreshKeys(Person $actor): void {
|
||||
$qb = $this->getActorsUpdateSql();
|
||||
$qb->set('public_key', $qb->createNamedParameter($actor->getPublicKey()))
|
||||
->set('private_key', $qb->createNamedParameter($actor->getPrivateKey()));
|
||||
->set('private_key', $qb->createNamedParameter($actor->getPrivateKey()));
|
||||
|
||||
try {
|
||||
$qb->set(
|
||||
|
|
|
@ -56,7 +56,7 @@ class ActorsRequestBuilder extends CoreRequestBuilder {
|
|||
'a.id', 'a.id_prim', 'a.user_id', 'a.preferred_username', 'a.name', 'a.summary',
|
||||
'a.public_key', 'a.avatar_version', 'a.private_key', 'a.creation', 'a.deleted'
|
||||
)
|
||||
->from(self::TABLE_ACTORS, 'a');
|
||||
->from(self::TABLE_ACTORS, 'a');
|
||||
|
||||
$this->defaultSelectAlias = 'a';
|
||||
$qb->setDefaultSelectAlias('a');
|
||||
|
@ -91,18 +91,18 @@ class ActorsRequestBuilder extends CoreRequestBuilder {
|
|||
$actor->importFromDatabase($data);
|
||||
$actor->setType('Person');
|
||||
$actor->setInbox($actor->getId() . '/inbox')
|
||||
->setOutbox($actor->getId() . '/outbox')
|
||||
->setUserId($this->get('user_id', $data, ''))
|
||||
->setFollowers($actor->getId() . '/followers')
|
||||
->setFollowing($actor->getId() . '/following')
|
||||
->setSharedInbox($root . 'inbox')
|
||||
->setLocal(true)
|
||||
->setAvatarVersion($this->getInt('avatar_version', $data, -1))
|
||||
->setAccount(
|
||||
$actor->getPreferredUsername() . '@' . $this->configService->getSocialAddress()
|
||||
);
|
||||
->setOutbox($actor->getId() . '/outbox')
|
||||
->setUserId($this->get('user_id', $data, ''))
|
||||
->setFollowers($actor->getId() . '/followers')
|
||||
->setFollowing($actor->getId() . '/following')
|
||||
->setSharedInbox($root . 'inbox')
|
||||
->setLocal(true)
|
||||
->setAvatarVersion($this->getInt('avatar_version', $data, -1))
|
||||
->setAccount(
|
||||
$actor->getPreferredUsername() . '@' . $this->configService->getSocialAddress()
|
||||
);
|
||||
$actor->setUrlSocial($root)
|
||||
->setUrl($actor->getId());
|
||||
->setUrl($actor->getId());
|
||||
|
||||
return $actor;
|
||||
}
|
||||
|
|
|
@ -30,25 +30,25 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
|||
public function save(Person $actor): void {
|
||||
$qb = $this->getCacheActorsInsertSql();
|
||||
$qb->setValue('id', $qb->createNamedParameter($actor->getId()))
|
||||
->setValue('id_prim', $qb->createNamedParameter($qb->prim($actor->getId())))
|
||||
->setValue('account', $qb->createNamedParameter($actor->getAccount()))
|
||||
->setValue('type', $qb->createNamedParameter($actor->getType()))
|
||||
->setValue('local', $qb->createNamedParameter(($actor->isLocal()) ? '1' : '0'))
|
||||
->setValue('following', $qb->createNamedParameter($actor->getFollowing()))
|
||||
->setValue('followers', $qb->createNamedParameter($actor->getFollowers()))
|
||||
->setValue('inbox', $qb->createNamedParameter($actor->getInbox()))
|
||||
->setValue('shared_inbox', $qb->createNamedParameter($actor->getSharedInbox()))
|
||||
->setValue('outbox', $qb->createNamedParameter($actor->getOutbox()))
|
||||
->setValue('featured', $qb->createNamedParameter($actor->getFeatured()))
|
||||
->setValue('url', $qb->createNamedParameter($actor->getUrl()))
|
||||
->setValue(
|
||||
'preferred_username', $qb->createNamedParameter($actor->getPreferredUsername())
|
||||
)
|
||||
->setValue('name', $qb->createNamedParameter($actor->getName()))
|
||||
->setValue('summary', $qb->createNamedParameter($actor->getSummary()))
|
||||
->setValue('public_key', $qb->createNamedParameter($actor->getPublicKey()))
|
||||
->setValue('source', $qb->createNamedParameter($actor->getSource()))
|
||||
->setValue('details', $qb->createNamedParameter(json_encode($actor->getDetailsAll())));
|
||||
->setValue('id_prim', $qb->createNamedParameter($qb->prim($actor->getId())))
|
||||
->setValue('account', $qb->createNamedParameter($actor->getAccount()))
|
||||
->setValue('type', $qb->createNamedParameter($actor->getType()))
|
||||
->setValue('local', $qb->createNamedParameter(($actor->isLocal()) ? '1' : '0'))
|
||||
->setValue('following', $qb->createNamedParameter($actor->getFollowing()))
|
||||
->setValue('followers', $qb->createNamedParameter($actor->getFollowers()))
|
||||
->setValue('inbox', $qb->createNamedParameter($actor->getInbox()))
|
||||
->setValue('shared_inbox', $qb->createNamedParameter($actor->getSharedInbox()))
|
||||
->setValue('outbox', $qb->createNamedParameter($actor->getOutbox()))
|
||||
->setValue('featured', $qb->createNamedParameter($actor->getFeatured()))
|
||||
->setValue('url', $qb->createNamedParameter($actor->getUrl()))
|
||||
->setValue(
|
||||
'preferred_username', $qb->createNamedParameter($actor->getPreferredUsername())
|
||||
)
|
||||
->setValue('name', $qb->createNamedParameter($actor->getName()))
|
||||
->setValue('summary', $qb->createNamedParameter($actor->getSummary()))
|
||||
->setValue('public_key', $qb->createNamedParameter($actor->getPublicKey()))
|
||||
->setValue('source', $qb->createNamedParameter($actor->getSource()))
|
||||
->setValue('details', $qb->createNamedParameter(json_encode($actor->getDetailsAll())));
|
||||
|
||||
try {
|
||||
if ($actor->getCreation() > 0) {
|
||||
|
@ -67,7 +67,7 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
|||
|
||||
if ($actor->hasIcon()) {
|
||||
$iconId = $actor->getIcon()
|
||||
->getId();
|
||||
->getId();
|
||||
} else {
|
||||
$iconId = $actor->getIconId();
|
||||
}
|
||||
|
@ -85,20 +85,20 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
|||
public function update(Person $actor): int {
|
||||
$qb = $this->getCacheActorsUpdateSql();
|
||||
$qb->set('following', $qb->createNamedParameter($actor->getFollowing()))
|
||||
->set('followers', $qb->createNamedParameter($actor->getFollowers()))
|
||||
->set('inbox', $qb->createNamedParameter($actor->getInbox()))
|
||||
->set('shared_inbox', $qb->createNamedParameter($actor->getSharedInbox()))
|
||||
->set('outbox', $qb->createNamedParameter($actor->getOutbox()))
|
||||
->set('featured', $qb->createNamedParameter($actor->getFeatured()))
|
||||
->set('url', $qb->createNamedParameter($actor->getUrl()))
|
||||
->set(
|
||||
'preferred_username', $qb->createNamedParameter($actor->getPreferredUsername())
|
||||
)
|
||||
->set('name', $qb->createNamedParameter($actor->getName()))
|
||||
->set('summary', $qb->createNamedParameter($actor->getSummary()))
|
||||
->set('public_key', $qb->createNamedParameter($actor->getPublicKey()))
|
||||
->set('source', $qb->createNamedParameter($actor->getSource()))
|
||||
->set('details', $qb->createNamedParameter(json_encode($actor->getDetailsAll())));
|
||||
->set('followers', $qb->createNamedParameter($actor->getFollowers()))
|
||||
->set('inbox', $qb->createNamedParameter($actor->getInbox()))
|
||||
->set('shared_inbox', $qb->createNamedParameter($actor->getSharedInbox()))
|
||||
->set('outbox', $qb->createNamedParameter($actor->getOutbox()))
|
||||
->set('featured', $qb->createNamedParameter($actor->getFeatured()))
|
||||
->set('url', $qb->createNamedParameter($actor->getUrl()))
|
||||
->set(
|
||||
'preferred_username', $qb->createNamedParameter($actor->getPreferredUsername())
|
||||
)
|
||||
->set('name', $qb->createNamedParameter($actor->getName()))
|
||||
->set('summary', $qb->createNamedParameter($actor->getSummary()))
|
||||
->set('public_key', $qb->createNamedParameter($actor->getPublicKey()))
|
||||
->set('source', $qb->createNamedParameter($actor->getSource()))
|
||||
->set('details', $qb->createNamedParameter(json_encode($actor->getDetailsAll())));
|
||||
|
||||
try {
|
||||
if ($actor->getCreation() > 0) {
|
||||
|
@ -116,7 +116,7 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
|||
|
||||
if ($actor->hasIcon()) {
|
||||
$iconId = $actor->getIcon()
|
||||
->getId();
|
||||
->getId();
|
||||
} else {
|
||||
$iconId = $actor->getIconId();
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
|||
public function getSharedInboxes(): array {
|
||||
$qb = $this->getQueryBuilder();
|
||||
$qb->selectDistinct('shared_inbox')
|
||||
->from(self::TABLE_CACHE_ACTORS);
|
||||
->from(self::TABLE_CACHE_ACTORS);
|
||||
$inbox = [];
|
||||
$cursor = $qb->execute();
|
||||
while ($data = $cursor->fetch()) {
|
||||
|
|
|
@ -62,7 +62,7 @@ class CacheActorsRequestBuilder extends CoreRequestBuilder {
|
|||
'ca.name', 'ca.summary', 'ca.public_key', 'ca.local', 'ca.details', 'ca.source', 'ca.creation',
|
||||
'ca.details_update'
|
||||
)
|
||||
->from(self::TABLE_CACHE_ACTORS, 'ca');
|
||||
->from(self::TABLE_CACHE_ACTORS, 'ca');
|
||||
|
||||
$qb->setDefaultSelectAlias('ca');
|
||||
|
||||
|
@ -152,7 +152,7 @@ class CacheActorsRequestBuilder extends CoreRequestBuilder {
|
|||
$link = Person::LINK_LOCAL;
|
||||
if ($qb->hasViewer()
|
||||
&& $qb->getViewer()
|
||||
->getId() === $actor->getId()) {
|
||||
->getId() === $actor->getId()) {
|
||||
$link = Person::LINK_VIEWER;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -21,20 +21,20 @@ class CacheDocumentsRequest extends CacheDocumentsRequestBuilder {
|
|||
public function save(Document $document): void {
|
||||
$qb = $this->getCacheDocumentsInsertSql();
|
||||
$qb->setValue('id', $qb->createNamedParameter($document->getId()))
|
||||
->setValue('id_prim', $qb->createNamedParameter($qb->prim($document->getId())))
|
||||
->setValue('account', $qb->createNamedParameter($document->getAccount()))
|
||||
->setValue('type', $qb->createNamedParameter($document->getType()))
|
||||
->setValue('url', $qb->createNamedParameter($document->getUrl()))
|
||||
->setValue('media_type', $qb->createNamedParameter($document->getMediaType()))
|
||||
->setValue('mime_type', $qb->createNamedParameter($document->getMimeType()))
|
||||
->setValue('error', $qb->createNamedParameter($document->getError()))
|
||||
->setValue('local_copy', $qb->createNamedParameter($document->getLocalCopy()))
|
||||
->setValue('resized_copy', $qb->createNamedParameter($document->getResizedCopy()))
|
||||
->setValue('blurhash', $qb->createNamedParameter($document->getBlurHash()))
|
||||
->setValue('description', $qb->createNamedParameter($document->getDescription()))
|
||||
->setValue('parent_id', $qb->createNamedParameter($document->getParentId()))
|
||||
->setValue('parent_id_prim', $qb->createNamedParameter($qb->prim($document->getParentId())))
|
||||
->setValue('public', $qb->createNamedParameter(($document->isPublic()) ? '1' : '0'));
|
||||
->setValue('id_prim', $qb->createNamedParameter($qb->prim($document->getId())))
|
||||
->setValue('account', $qb->createNamedParameter($document->getAccount()))
|
||||
->setValue('type', $qb->createNamedParameter($document->getType()))
|
||||
->setValue('url', $qb->createNamedParameter($document->getUrl()))
|
||||
->setValue('media_type', $qb->createNamedParameter($document->getMediaType()))
|
||||
->setValue('mime_type', $qb->createNamedParameter($document->getMimeType()))
|
||||
->setValue('error', $qb->createNamedParameter($document->getError()))
|
||||
->setValue('local_copy', $qb->createNamedParameter($document->getLocalCopy()))
|
||||
->setValue('resized_copy', $qb->createNamedParameter($document->getResizedCopy()))
|
||||
->setValue('blurhash', $qb->createNamedParameter($document->getBlurHash()))
|
||||
->setValue('description', $qb->createNamedParameter($document->getDescription()))
|
||||
->setValue('parent_id', $qb->createNamedParameter($document->getParentId()))
|
||||
->setValue('parent_id_prim', $qb->createNamedParameter($qb->prim($document->getParentId())))
|
||||
->setValue('public', $qb->createNamedParameter(($document->isPublic()) ? '1' : '0'));
|
||||
|
||||
// generate Meta
|
||||
$document->convertToMediaAttachment();
|
||||
|
@ -61,17 +61,17 @@ class CacheDocumentsRequest extends CacheDocumentsRequestBuilder {
|
|||
public function update(Document $document): void {
|
||||
$qb = $this->getCacheDocumentsUpdateSql();
|
||||
$qb->set('type', $qb->createNamedParameter($document->getType()))
|
||||
->set('url', $qb->createNamedParameter($document->getUrl()))
|
||||
->set('media_type', $qb->createNamedParameter($document->getMediaType()))
|
||||
->set('mime_type', $qb->createNamedParameter($document->getMimeType()))
|
||||
->set('error', $qb->createNamedParameter($document->getError()))
|
||||
->set('local_copy', $qb->createNamedParameter($document->getLocalCopy()))
|
||||
->set('resized_copy', $qb->createNamedParameter($document->getResizedCopy()))
|
||||
->set('blurhash', $qb->createNamedParameter($document->getBlurHash()))
|
||||
->set('description', $qb->createNamedParameter($document->getDescription()))
|
||||
->set('parent_id', $qb->createNamedParameter($document->getParentId()))
|
||||
->set('parent_id_prim', $qb->createNamedParameter($qb->prim($document->getParentId())))
|
||||
->set('public', $qb->createNamedParameter(($document->isPublic()) ? '1' : '0'));
|
||||
->set('url', $qb->createNamedParameter($document->getUrl()))
|
||||
->set('media_type', $qb->createNamedParameter($document->getMediaType()))
|
||||
->set('mime_type', $qb->createNamedParameter($document->getMimeType()))
|
||||
->set('error', $qb->createNamedParameter($document->getError()))
|
||||
->set('local_copy', $qb->createNamedParameter($document->getLocalCopy()))
|
||||
->set('resized_copy', $qb->createNamedParameter($document->getResizedCopy()))
|
||||
->set('blurhash', $qb->createNamedParameter($document->getBlurHash()))
|
||||
->set('description', $qb->createNamedParameter($document->getDescription()))
|
||||
->set('parent_id', $qb->createNamedParameter($document->getParentId()))
|
||||
->set('parent_id_prim', $qb->createNamedParameter($qb->prim($document->getParentId())))
|
||||
->set('public', $qb->createNamedParameter(($document->isPublic()) ? '1' : '0'));
|
||||
|
||||
try {
|
||||
$qb->set(
|
||||
|
@ -262,7 +262,7 @@ class CacheDocumentsRequest extends CacheDocumentsRequestBuilder {
|
|||
public function moveAccount(string $actorId, string $newId): void {
|
||||
$qb = $this->getCacheDocumentsUpdateSql();
|
||||
$qb->set('parent_id', $qb->createNamedParameter($newId))
|
||||
->set('parent_id_prim', $qb->createNamedParameter($qb->prim($newId)));
|
||||
->set('parent_id_prim', $qb->createNamedParameter($qb->prim($newId)));
|
||||
|
||||
$qb->limitToDBField('parent_id_prim', $qb->prim($actorId));
|
||||
|
||||
|
@ -300,7 +300,7 @@ class CacheDocumentsRequest extends CacheDocumentsRequestBuilder {
|
|||
public function updateCopies(Document $document): void {
|
||||
$qb = $this->getCacheDocumentsUpdateSql();
|
||||
$qb->set('local_copy', $qb->createNamedParameter($document->getLocalCopy()))
|
||||
->set('resized_copy', $qb->createNamedParameter($document->getResizedCopy()));
|
||||
->set('resized_copy', $qb->createNamedParameter($document->getResizedCopy()));
|
||||
|
||||
$qb->limitToIdPrim($qb->prim($document->getId()));
|
||||
$qb->executeStatement();
|
||||
|
|
|
@ -44,7 +44,7 @@ class CacheDocumentsRequestBuilder extends CoreRequestBuilder {
|
|||
'cd.error', 'cd.creation', 'cd.caching', 'cd.resized_copy', 'cd.meta',
|
||||
'cd.blurhash', 'cd.description'
|
||||
)
|
||||
->from(self::TABLE_CACHE_DOCUMENTS, 'cd');
|
||||
->from(self::TABLE_CACHE_DOCUMENTS, 'cd');
|
||||
|
||||
$this->defaultSelectAlias = 'cd';
|
||||
$qb->setDefaultSelectAlias('cd');
|
||||
|
|
|
@ -32,13 +32,13 @@ class ClientRequest extends ClientRequestBuilder {
|
|||
public function saveApp(SocialClient $client): void {
|
||||
$qb = $this->getClientInsertSql();
|
||||
$qb->setValue('app_name', $qb->createNamedParameter($client->getAppName()))
|
||||
->setValue('app_website', $qb->createNamedParameter($client->getAppWebsite()))
|
||||
->setValue(
|
||||
'app_redirect_uris', $qb->createNamedParameter(json_encode($client->getAppRedirectUris()))
|
||||
)
|
||||
->setValue('app_client_id', $qb->createNamedParameter($client->getAppClientId()))
|
||||
->setValue('app_client_secret', $qb->createNamedParameter($client->getAppClientSecret()))
|
||||
->setValue('app_scopes', $qb->createNamedParameter(json_encode($client->getAppScopes())));
|
||||
->setValue('app_website', $qb->createNamedParameter($client->getAppWebsite()))
|
||||
->setValue(
|
||||
'app_redirect_uris', $qb->createNamedParameter(json_encode($client->getAppRedirectUris()))
|
||||
)
|
||||
->setValue('app_client_id', $qb->createNamedParameter($client->getAppClientId()))
|
||||
->setValue('app_client_secret', $qb->createNamedParameter($client->getAppClientSecret()))
|
||||
->setValue('app_scopes', $qb->createNamedParameter(json_encode($client->getAppScopes())));
|
||||
|
||||
try {
|
||||
$dt = new DateTime('now');
|
||||
|
|
|
@ -64,7 +64,7 @@ class ClientRequestBuilder extends CoreRequestBuilder {
|
|||
'cl.app_client_secret', 'cl.app_scopes', 'cl.auth_scopes', 'cl.auth_account', 'cl.auth_user_id',
|
||||
'cl.auth_code', 'cl.token', 'cl.last_update', 'cl.creation'
|
||||
)
|
||||
->from(self::TABLE_CLIENT, 'cl');
|
||||
->from(self::TABLE_CLIENT, 'cl');
|
||||
|
||||
$this->defaultSelectAlias = 'cl';
|
||||
$qb->setDefaultSelectAlias('cl');
|
||||
|
|
|
@ -254,7 +254,7 @@ class CoreRequestBuilder {
|
|||
LoggerInterface $logger,
|
||||
IURLGenerator $urlGenerator,
|
||||
ConfigService $configService,
|
||||
MiscService $miscService
|
||||
MiscService $miscService,
|
||||
) {
|
||||
$this->dbConnection = $connection;
|
||||
$this->logger = $logger;
|
||||
|
@ -689,14 +689,14 @@ class CoreRequestBuilder {
|
|||
* @param string $alias
|
||||
*/
|
||||
protected function limitToDBField(
|
||||
IQueryBuilder &$qb, string $field, string $value, bool $cs = true, string $alias = ''
|
||||
IQueryBuilder &$qb, string $field, string $value, bool $cs = true, string $alias = '',
|
||||
) {
|
||||
$expr = $this->exprLimitToDBField($qb, $field, $value, true, $cs, $alias);
|
||||
$qb->andWhere($expr);
|
||||
}
|
||||
|
||||
protected function filterDBField(
|
||||
IQueryBuilder &$qb, string $field, string $value, bool $cs = true, string $alias = ''
|
||||
IQueryBuilder &$qb, string $field, string $value, bool $cs = true, string $alias = '',
|
||||
) {
|
||||
$expr = $this->exprLimitToDBField($qb, $field, $value, false, $cs, $alias);
|
||||
$qb->andWhere($expr);
|
||||
|
@ -704,7 +704,7 @@ class CoreRequestBuilder {
|
|||
|
||||
protected function exprLimitToDBField(
|
||||
IQueryBuilder &$qb, string $field, string $value, bool $eq = true, bool $cs = true,
|
||||
string $alias = ''
|
||||
string $alias = '',
|
||||
): string {
|
||||
$expr = $qb->expr();
|
||||
|
||||
|
@ -731,14 +731,14 @@ class CoreRequestBuilder {
|
|||
}
|
||||
|
||||
protected function limitToDBFieldInt(
|
||||
IQueryBuilder &$qb, string $field, int $value, string $alias = ''
|
||||
IQueryBuilder &$qb, string $field, int $value, string $alias = '',
|
||||
): void {
|
||||
$expr = $this->exprLimitToDBFieldInt($qb, $field, $value, $alias);
|
||||
$qb->andWhere($expr);
|
||||
}
|
||||
|
||||
protected function exprLimitToDBFieldInt(
|
||||
IQueryBuilder &$qb, string $field, int $value, string $alias = ''
|
||||
IQueryBuilder &$qb, string $field, int $value, string $alias = '',
|
||||
): string {
|
||||
$expr = $qb->expr();
|
||||
|
||||
|
@ -773,7 +773,7 @@ class CoreRequestBuilder {
|
|||
* @param bool $orNull
|
||||
*/
|
||||
protected function limitToDBFieldDateTime(
|
||||
IQueryBuilder &$qb, string $field, DateTime $date, bool $orNull = false
|
||||
IQueryBuilder &$qb, string $field, DateTime $date, bool $orNull = false,
|
||||
) {
|
||||
$expr = $qb->expr();
|
||||
$pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->defaultSelectAlias . '.' : '';
|
||||
|
@ -854,7 +854,7 @@ class CoreRequestBuilder {
|
|||
* @deprecated - use SocialCrossQueryBuilder:leftJoinCacheActor
|
||||
*/
|
||||
protected function leftJoinCacheActors(
|
||||
IQueryBuilder &$qb, string $fieldActorId, Person $author = null, string $alias = ''
|
||||
IQueryBuilder &$qb, string $fieldActorId, ?Person $author = null, string $alias = '',
|
||||
) {
|
||||
if ($qb->getType() !== QueryBuilder::SELECT) {
|
||||
return;
|
||||
|
@ -866,22 +866,22 @@ class CoreRequestBuilder {
|
|||
$pf = ($alias === '') ? $this->defaultSelectAlias : $alias;
|
||||
|
||||
$qb->selectAlias('ca.id', 'cacheactor_id')
|
||||
->selectAlias('ca.type', 'cacheactor_type')
|
||||
->selectAlias('ca.account', 'cacheactor_account')
|
||||
->selectAlias('ca.following', 'cacheactor_following')
|
||||
->selectAlias('ca.followers', 'cacheactor_followers')
|
||||
->selectAlias('ca.inbox', 'cacheactor_inbox')
|
||||
->selectAlias('ca.shared_inbox', 'cacheactor_shared_inbox')
|
||||
->selectAlias('ca.outbox', 'cacheactor_outbox')
|
||||
->selectAlias('ca.featured', 'cacheactor_featured')
|
||||
->selectAlias('ca.url', 'cacheactor_url')
|
||||
->selectAlias('ca.preferred_username', 'cacheactor_preferred_username')
|
||||
->selectAlias('ca.name', 'cacheactor_name')
|
||||
->selectAlias('ca.summary', 'cacheactor_summary')
|
||||
->selectAlias('ca.public_key', 'cacheactor_public_key')
|
||||
->selectAlias('ca.source', 'cacheactor_source')
|
||||
->selectAlias('ca.creation', 'cacheactor_creation')
|
||||
->selectAlias('ca.local', 'cacheactor_local');
|
||||
->selectAlias('ca.type', 'cacheactor_type')
|
||||
->selectAlias('ca.account', 'cacheactor_account')
|
||||
->selectAlias('ca.following', 'cacheactor_following')
|
||||
->selectAlias('ca.followers', 'cacheactor_followers')
|
||||
->selectAlias('ca.inbox', 'cacheactor_inbox')
|
||||
->selectAlias('ca.shared_inbox', 'cacheactor_shared_inbox')
|
||||
->selectAlias('ca.outbox', 'cacheactor_outbox')
|
||||
->selectAlias('ca.featured', 'cacheactor_featured')
|
||||
->selectAlias('ca.url', 'cacheactor_url')
|
||||
->selectAlias('ca.preferred_username', 'cacheactor_preferred_username')
|
||||
->selectAlias('ca.name', 'cacheactor_name')
|
||||
->selectAlias('ca.summary', 'cacheactor_summary')
|
||||
->selectAlias('ca.public_key', 'cacheactor_public_key')
|
||||
->selectAlias('ca.source', 'cacheactor_source')
|
||||
->selectAlias('ca.creation', 'cacheactor_creation')
|
||||
->selectAlias('ca.local', 'cacheactor_local');
|
||||
|
||||
$orX = $expr->orX();
|
||||
$orX->add($expr->eq($func->lower($pf . '.' . $fieldActorId), $func->lower('ca.id')));
|
||||
|
@ -910,7 +910,7 @@ class CoreRequestBuilder {
|
|||
* @param string $fieldActorId
|
||||
* @param string $alias
|
||||
*/
|
||||
protected function leftJoinAccounts(IQueryBuilder &$qb, string $fieldActorId, string $alias = ''
|
||||
protected function leftJoinAccounts(IQueryBuilder &$qb, string $fieldActorId, string $alias = '',
|
||||
) {
|
||||
if ($qb->getType() !== QueryBuilder::SELECT) {
|
||||
return;
|
||||
|
@ -922,11 +922,11 @@ class CoreRequestBuilder {
|
|||
$pf = ($alias === '') ? $this->defaultSelectAlias : $alias;
|
||||
|
||||
$qb->selectAlias('lja.id', 'accounts_id')
|
||||
->selectAlias('lja.user_id', 'accounts_user_id')
|
||||
->selectAlias('lja.preferred_username', 'accounts_preferred_username')
|
||||
->selectAlias('lja.name', 'accounts_name')
|
||||
->selectAlias('lja.summary', 'accounts_summary')
|
||||
->selectAlias('lja.public_key', 'accounts_public_key');
|
||||
->selectAlias('lja.user_id', 'accounts_user_id')
|
||||
->selectAlias('lja.preferred_username', 'accounts_preferred_username')
|
||||
->selectAlias('lja.name', 'accounts_name')
|
||||
->selectAlias('lja.summary', 'accounts_summary')
|
||||
->selectAlias('lja.public_key', 'accounts_public_key');
|
||||
|
||||
$on = $expr->eq(
|
||||
$func->lower($pf . '.' . $fieldActorId),
|
||||
|
@ -978,11 +978,11 @@ class CoreRequestBuilder {
|
|||
$expr = $qb->expr();
|
||||
|
||||
$qb->selectAlias('sa.id', 'streamaction_id')
|
||||
->selectAlias('sa.actor_id', 'streamaction_actor_id')
|
||||
->selectAlias('sa.stream_id', 'streamaction_stream_id')
|
||||
->selectAlias('sa.liked', 'streamaction_liked')
|
||||
->selectAlias('sa.boosted', 'streamaction_boosted')
|
||||
->selectAlias('sa.replied', 'streamaction_replied');
|
||||
->selectAlias('sa.actor_id', 'streamaction_actor_id')
|
||||
->selectAlias('sa.stream_id', 'streamaction_stream_id')
|
||||
->selectAlias('sa.liked', 'streamaction_liked')
|
||||
->selectAlias('sa.boosted', 'streamaction_boosted')
|
||||
->selectAlias('sa.replied', 'streamaction_replied');
|
||||
|
||||
$orX = $expr->orX();
|
||||
$orX->add($expr->eq('sa.stream_id_prim', $pf . '.id_prim'));
|
||||
|
@ -1043,9 +1043,9 @@ class CoreRequestBuilder {
|
|||
$pf = $this->defaultSelectAlias;
|
||||
|
||||
$qb->selectAlias('a.id', 'action_id')
|
||||
->selectAlias('a.actor_id', 'action_actor_id')
|
||||
->selectAlias('a.object_id', 'action_object_id')
|
||||
->selectAlias('a.type', 'action_type');
|
||||
->selectAlias('a.actor_id', 'action_actor_id')
|
||||
->selectAlias('a.object_id', 'action_object_id')
|
||||
->selectAlias('a.type', 'action_type');
|
||||
|
||||
$andX = $expr->andX();
|
||||
$andX->add($expr->eq($func->lower($pf . '.id'), $func->lower('a.object_id')));
|
||||
|
@ -1090,7 +1090,7 @@ class CoreRequestBuilder {
|
|||
*/
|
||||
protected function leftJoinFollowAsViewer(
|
||||
IQueryBuilder &$qb, string $fieldActorId, bool $asFollower = true,
|
||||
string $prefix = 'follow', string $pf = ''
|
||||
string $prefix = 'follow', string $pf = '',
|
||||
) {
|
||||
if ($qb->getType() !== QueryBuilder::SELECT) {
|
||||
return;
|
||||
|
@ -1135,15 +1135,15 @@ class CoreRequestBuilder {
|
|||
}
|
||||
|
||||
$qb->selectAlias($prefix . '_f.id', $prefix . '_id')
|
||||
->selectAlias($prefix . '_f.type', $prefix . '_type')
|
||||
->selectAlias($prefix . '_f.actor_id', $prefix . '_actor_id')
|
||||
->selectAlias($prefix . '_f.object_id', $prefix . '_object_id')
|
||||
->selectAlias($prefix . '_f.follow_id', $prefix . '_follow_id')
|
||||
->selectAlias($prefix . '_f.creation', $prefix . '_creation')
|
||||
->leftJoin(
|
||||
$this->defaultSelectAlias, CoreRequestBuilder::TABLE_FOLLOWS, $prefix . '_f',
|
||||
$andX
|
||||
);
|
||||
->selectAlias($prefix . '_f.type', $prefix . '_type')
|
||||
->selectAlias($prefix . '_f.actor_id', $prefix . '_actor_id')
|
||||
->selectAlias($prefix . '_f.object_id', $prefix . '_object_id')
|
||||
->selectAlias($prefix . '_f.follow_id', $prefix . '_follow_id')
|
||||
->selectAlias($prefix . '_f.creation', $prefix . '_creation')
|
||||
->leftJoin(
|
||||
$this->defaultSelectAlias, CoreRequestBuilder::TABLE_FOLLOWS, $prefix . '_f',
|
||||
$andX
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -34,14 +34,14 @@ class FollowsRequest extends FollowsRequestBuilder {
|
|||
public function save(Follow $follow) {
|
||||
$qb = $this->getFollowsInsertSql();
|
||||
$qb->setValue('id', $qb->createNamedParameter($follow->getId()))
|
||||
->setValue('actor_id', $qb->createNamedParameter($follow->getActorId()))
|
||||
->setValue('type', $qb->createNamedParameter($follow->getType()))
|
||||
->setValue('object_id', $qb->createNamedParameter($follow->getObjectId()))
|
||||
->setValue('follow_id', $qb->createNamedParameter($follow->getFollowId()))
|
||||
->setValue('accepted', $qb->createNamedParameter(($follow->isAccepted()) ? '1' : '0'))
|
||||
->setValue('actor_id_prim', $qb->createNamedParameter($qb->prim($follow->getActorId())))
|
||||
->setValue('object_id_prim', $qb->createNamedParameter($qb->prim($follow->getObjectId())))
|
||||
->setValue('follow_id_prim', $qb->createNamedParameter($qb->prim($follow->getFollowId())));
|
||||
->setValue('actor_id', $qb->createNamedParameter($follow->getActorId()))
|
||||
->setValue('type', $qb->createNamedParameter($follow->getType()))
|
||||
->setValue('object_id', $qb->createNamedParameter($follow->getObjectId()))
|
||||
->setValue('follow_id', $qb->createNamedParameter($follow->getFollowId()))
|
||||
->setValue('accepted', $qb->createNamedParameter(($follow->isAccepted()) ? '1' : '0'))
|
||||
->setValue('actor_id_prim', $qb->createNamedParameter($qb->prim($follow->getActorId())))
|
||||
->setValue('object_id_prim', $qb->createNamedParameter($qb->prim($follow->getObjectId())))
|
||||
->setValue('follow_id_prim', $qb->createNamedParameter($qb->prim($follow->getFollowId())));
|
||||
|
||||
try {
|
||||
$qb->setValue(
|
||||
|
@ -59,14 +59,14 @@ class FollowsRequest extends FollowsRequestBuilder {
|
|||
public function generateLoopbackAccount(Person $actor) {
|
||||
$qb = $this->getFollowsInsertSql();
|
||||
$qb->setValue('id', $qb->createNamedParameter($actor->getId()))
|
||||
->setValue('actor_id', $qb->createNamedParameter($actor->getId()))
|
||||
->setValue('type', $qb->createNamedParameter('Loopback'))
|
||||
->setValue('object_id', $qb->createNamedParameter($actor->getId()))
|
||||
->setValue('follow_id', $qb->createNamedParameter($actor->getId()))
|
||||
->setValue('accepted', $qb->createNamedParameter('1'))
|
||||
->setValue('actor_id_prim', $qb->createNamedParameter($qb->prim($actor->getId())))
|
||||
->setValue('object_id_prim', $qb->createNamedParameter($qb->prim($actor->getId())))
|
||||
->setValue('follow_id_prim', $qb->createNamedParameter($qb->prim($actor->getId())));
|
||||
->setValue('actor_id', $qb->createNamedParameter($actor->getId()))
|
||||
->setValue('type', $qb->createNamedParameter('Loopback'))
|
||||
->setValue('object_id', $qb->createNamedParameter($actor->getId()))
|
||||
->setValue('follow_id', $qb->createNamedParameter($actor->getId()))
|
||||
->setValue('accepted', $qb->createNamedParameter('1'))
|
||||
->setValue('actor_id_prim', $qb->createNamedParameter($qb->prim($actor->getId())))
|
||||
->setValue('object_id_prim', $qb->createNamedParameter($qb->prim($actor->getId())))
|
||||
->setValue('follow_id_prim', $qb->createNamedParameter($qb->prim($actor->getId())));
|
||||
|
||||
try {
|
||||
$qb->setValue(
|
||||
|
@ -290,9 +290,9 @@ class FollowsRequest extends FollowsRequestBuilder {
|
|||
public function moveAccountFollowers(string $actorId, Person $new): void {
|
||||
$qb = $this->getFollowsUpdateSql();
|
||||
$qb->set('object_id', $qb->createNamedParameter($new->getId()))
|
||||
->set('object_id_prim', $qb->createNamedParameter($qb->prim($new->getId())))
|
||||
->set('follow_id', $qb->createNamedParameter($new->getFollowers()))
|
||||
->set('follow_id_prim', $qb->createNamedParameter($qb->prim($new->getFollowers())));
|
||||
->set('object_id_prim', $qb->createNamedParameter($qb->prim($new->getId())))
|
||||
->set('follow_id', $qb->createNamedParameter($new->getFollowers()))
|
||||
->set('follow_id_prim', $qb->createNamedParameter($qb->prim($new->getFollowers())));
|
||||
|
||||
$qb->limitToObjectIdPrim($qb->prim($actorId));
|
||||
|
||||
|
@ -307,7 +307,7 @@ class FollowsRequest extends FollowsRequestBuilder {
|
|||
public function moveAccountFollowing(string $actorId, Person $new): void {
|
||||
$qb = $this->getFollowsUpdateSql();
|
||||
$qb->set('actor_id', $qb->createNamedParameter($new->getId()))
|
||||
->set('actor_id_prim', $qb->createNamedParameter($qb->prim($new->getId())));
|
||||
->set('actor_id_prim', $qb->createNamedParameter($qb->prim($new->getId())));
|
||||
|
||||
$qb->limitToActorIdPrim($qb->prim($actorId));
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ class FollowsRequestBuilder extends CoreRequestBuilder {
|
|||
$qb->select(
|
||||
'f.id', 'f.type', 'f.actor_id', 'f.object_id', 'f.follow_id', 'f.accepted', 'f.creation'
|
||||
)
|
||||
->from(self::TABLE_FOLLOWS, 'f');
|
||||
->from(self::TABLE_FOLLOWS, 'f');
|
||||
|
||||
$this->defaultSelectAlias = 'f';
|
||||
$qb->setDefaultSelectAlias('f');
|
||||
|
@ -79,7 +79,7 @@ class FollowsRequestBuilder extends CoreRequestBuilder {
|
|||
protected function countFollowsSelectSql(): SocialQueryBuilder {
|
||||
$qb = $this->getQueryBuilder();
|
||||
$qb->selectAlias($qb->createFunction('COUNT(*)'), 'count')
|
||||
->from(self::TABLE_FOLLOWS, 'f');
|
||||
->from(self::TABLE_FOLLOWS, 'f');
|
||||
|
||||
$qb->setDefaultSelectAlias('f');
|
||||
$this->defaultSelectAlias = 'f';
|
||||
|
|
|
@ -30,7 +30,7 @@ class HashtagsRequest extends HashtagsRequestBuilder {
|
|||
public function save(string $hashtag, array $trend) {
|
||||
$qb = $this->getHashtagsInsertSql();
|
||||
$qb->setValue('hashtag', $qb->createNamedParameter($hashtag))
|
||||
->setValue('trend', $qb->createNamedParameter(json_encode($trend)));
|
||||
->setValue('trend', $qb->createNamedParameter(json_encode($trend)));
|
||||
|
||||
$qb->execute();
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class HashtagsRequestBuilder extends CoreRequestBuilder {
|
|||
|
||||
/** @noinspection PhpMethodParametersCountMismatchInspection */
|
||||
$qb->select('h.hashtag', 'h.trend')
|
||||
->from(self::TABLE_HASHTAGS, 'h');
|
||||
->from(self::TABLE_HASHTAGS, 'h');
|
||||
|
||||
$this->defaultSelectAlias = 'h';
|
||||
$qb->setDefaultSelectAlias('h');
|
||||
|
|
|
@ -26,7 +26,7 @@ class InstancesRequest extends InstancesRequestBuilder {
|
|||
|
||||
/**
|
||||
* @param Instance $instance
|
||||
* TODO: store instance in db
|
||||
* TODO: store instance in db
|
||||
*/
|
||||
public function save(Instance $instance) {
|
||||
// $now = new DateTime('now');
|
||||
|
|
|
@ -63,7 +63,7 @@ class InstancesRequestBuilder extends CoreRequestBuilder {
|
|||
'i.local', 'i.uri', 'i.title', 'i.version', 'i.short_description', 'i.description', 'i.email',
|
||||
'i.urls', 'i.stats', 'i.usage', 'i.image', 'i.languages', 'i.contact', 'i.account_prim'
|
||||
)
|
||||
->from(self::TABLE_INSTANCE, 'i');
|
||||
->from(self::TABLE_INSTANCE, 'i');
|
||||
|
||||
$qb->setDefaultSelectAlias('i');
|
||||
|
||||
|
|
|
@ -42,17 +42,17 @@ class RequestQueueRequest extends RequestQueueRequestBuilder {
|
|||
public function create(RequestQueue $queue): void {
|
||||
$qb = $this->getRequestQueueInsertSql();
|
||||
$qb->setValue('token', $qb->createNamedParameter($queue->getToken()))
|
||||
->setValue('author', $qb->createNamedParameter($queue->getAuthor()))
|
||||
->setValue('author_prim', $qb->createNamedParameter($qb->prim($queue->getAuthor())))
|
||||
->setValue('activity', $qb->createNamedParameter($queue->getActivity()))
|
||||
->setValue(
|
||||
'instance', $qb->createNamedParameter(
|
||||
json_encode($queue->getInstance(), JSON_UNESCAPED_SLASHES)
|
||||
)
|
||||
)
|
||||
->setValue('priority', $qb->createNamedParameter($queue->getPriority()))
|
||||
->setValue('status', $qb->createNamedParameter($queue->getStatus()))
|
||||
->setValue('tries', $qb->createNamedParameter($queue->getTries()));
|
||||
->setValue('author', $qb->createNamedParameter($queue->getAuthor()))
|
||||
->setValue('author_prim', $qb->createNamedParameter($qb->prim($queue->getAuthor())))
|
||||
->setValue('activity', $qb->createNamedParameter($queue->getActivity()))
|
||||
->setValue(
|
||||
'instance', $qb->createNamedParameter(
|
||||
json_encode($queue->getInstance(), JSON_UNESCAPED_SLASHES)
|
||||
)
|
||||
)
|
||||
->setValue('priority', $qb->createNamedParameter($queue->getPriority()))
|
||||
->setValue('status', $qb->createNamedParameter($queue->getStatus()))
|
||||
->setValue('tries', $qb->createNamedParameter($queue->getTries()));
|
||||
$qb->executeStatement();
|
||||
}
|
||||
|
||||
|
@ -112,10 +112,10 @@ class RequestQueueRequest extends RequestQueueRequestBuilder {
|
|||
public function setAsRunning(RequestQueue &$queue): void {
|
||||
$qb = $this->getRequestQueueUpdateSql();
|
||||
$qb->set('status', $qb->createNamedParameter(RequestQueue::STATUS_RUNNING))
|
||||
->set(
|
||||
'last',
|
||||
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
||||
);
|
||||
->set(
|
||||
'last',
|
||||
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
||||
);
|
||||
$this->limitToId($qb, $queue->getId());
|
||||
$this->limitToStatus($qb, RequestQueue::STATUS_STANDBY);
|
||||
|
||||
|
@ -157,7 +157,7 @@ class RequestQueueRequest extends RequestQueueRequestBuilder {
|
|||
$expr = $qb->expr();
|
||||
|
||||
$qb->set('status', $qb->createNamedParameter(RequestQueue::STATUS_STANDBY))
|
||||
->set('tries', $func->add('tries', $expr->literal(1)));
|
||||
->set('tries', $func->add('tries', $expr->literal(1)));
|
||||
$this->limitToId($qb, $queue->getId());
|
||||
$this->limitToStatus($qb, RequestQueue::STATUS_RUNNING);
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class RequestQueueRequestBuilder extends CoreRequestBuilder {
|
|||
'rq.id', 'rq.token', 'rq.author', 'rq.activity', 'rq.instance', 'rq.priority',
|
||||
'rq.status', 'rq.tries', 'rq.last'
|
||||
)
|
||||
->from(self::TABLE_REQUEST_QUEUE, 'rq');
|
||||
->from(self::TABLE_REQUEST_QUEUE, 'rq');
|
||||
|
||||
$this->defaultSelectAlias = 'rq';
|
||||
$qb->setDefaultSelectAlias('rq');
|
||||
|
|
|
@ -22,15 +22,15 @@ use Psr\Log\LoggerInterface;
|
|||
* @package OCA\Social\Db
|
||||
*/
|
||||
class SocialCoreQueryBuilder extends ExtendedQueryBuilder {
|
||||
protected IURLGenerator $urlGenerator;
|
||||
private ?Person $viewer = null;
|
||||
|
||||
public function __construct(
|
||||
IDBConnection $connection, SystemConfig $systemConfig, LoggerInterface $logger, IURLGenerator $urlGenerator
|
||||
IDBConnection $connection,
|
||||
SystemConfig $systemConfig,
|
||||
LoggerInterface $logger,
|
||||
protected IURLGenerator $urlGenerator,
|
||||
) {
|
||||
parent::__construct($connection, $systemConfig, $logger);
|
||||
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -88,25 +88,25 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
}
|
||||
|
||||
$this->selectAlias($pf . '.id', 'cacheactor_id')
|
||||
->selectAlias($pf . '.nid', 'cacheactor_nid')
|
||||
->selectAlias($pf . '.type', 'cacheactor_type')
|
||||
->selectAlias($pf . '.icon_id', 'cacheactor_icon_id')
|
||||
->selectAlias($pf . '.account', 'cacheactor_account')
|
||||
->selectAlias($pf . '.following', 'cacheactor_following')
|
||||
->selectAlias($pf . '.followers', 'cacheactor_followers')
|
||||
->selectAlias($pf . '.inbox', 'cacheactor_inbox')
|
||||
->selectAlias($pf . '.shared_inbox', 'cacheactor_shared_inbox')
|
||||
->selectAlias($pf . '.outbox', 'cacheactor_outbox')
|
||||
->selectAlias($pf . '.featured', 'cacheactor_featured')
|
||||
->selectAlias($pf . '.url', 'cacheactor_url')
|
||||
->selectAlias($pf . '.preferred_username', 'cacheactor_preferred_username')
|
||||
->selectAlias($pf . '.name', 'cacheactor_name')
|
||||
->selectAlias($pf . '.summary', 'cacheactor_summary')
|
||||
->selectAlias($pf . '.public_key', 'cacheactor_public_key')
|
||||
->selectAlias($pf . '.source', 'cacheactor_source')
|
||||
->selectAlias($pf . '.details', 'cacheactor_details')
|
||||
->selectAlias($pf . '.creation', 'cacheactor_creation')
|
||||
->selectAlias($pf . '.local', 'cacheactor_local');
|
||||
->selectAlias($pf . '.nid', 'cacheactor_nid')
|
||||
->selectAlias($pf . '.type', 'cacheactor_type')
|
||||
->selectAlias($pf . '.icon_id', 'cacheactor_icon_id')
|
||||
->selectAlias($pf . '.account', 'cacheactor_account')
|
||||
->selectAlias($pf . '.following', 'cacheactor_following')
|
||||
->selectAlias($pf . '.followers', 'cacheactor_followers')
|
||||
->selectAlias($pf . '.inbox', 'cacheactor_inbox')
|
||||
->selectAlias($pf . '.shared_inbox', 'cacheactor_shared_inbox')
|
||||
->selectAlias($pf . '.outbox', 'cacheactor_outbox')
|
||||
->selectAlias($pf . '.featured', 'cacheactor_featured')
|
||||
->selectAlias($pf . '.url', 'cacheactor_url')
|
||||
->selectAlias($pf . '.preferred_username', 'cacheactor_preferred_username')
|
||||
->selectAlias($pf . '.name', 'cacheactor_name')
|
||||
->selectAlias($pf . '.summary', 'cacheactor_summary')
|
||||
->selectAlias($pf . '.public_key', 'cacheactor_public_key')
|
||||
->selectAlias($pf . '.source', 'cacheactor_source')
|
||||
->selectAlias($pf . '.details', 'cacheactor_details')
|
||||
->selectAlias($pf . '.creation', 'cacheactor_creation')
|
||||
->selectAlias($pf . '.local', 'cacheactor_local');
|
||||
|
||||
$this->leftJoinCacheDocuments('icon_id', $pf, 'cacheactor_cachedocument_', 'cacd');
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
public function parseLeftJoinStream(
|
||||
array $data,
|
||||
string $prefix = '',
|
||||
int $exportFormat = 0
|
||||
int $exportFormat = 0,
|
||||
): Stream {
|
||||
$new = [];
|
||||
foreach ($data as $k => $v) {
|
||||
|
@ -155,7 +155,7 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
public function parseLeftJoinCacheActors(
|
||||
array $data,
|
||||
string $prefix = '',
|
||||
int $exportFormat = 0
|
||||
int $exportFormat = 0,
|
||||
): Person {
|
||||
$new = [];
|
||||
|
||||
|
@ -199,7 +199,7 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
string $linkField,
|
||||
string $linkAlias = '',
|
||||
string $prefix = 'cachedocument_',
|
||||
string $alias = 'cd'
|
||||
string $alias = 'cd',
|
||||
) {
|
||||
if ($this->getType() !== QueryBuilder::SELECT) {
|
||||
return;
|
||||
|
@ -209,20 +209,20 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
$pf = (($linkAlias === '') ? $this->getDefaultSelectAlias() : $linkAlias);
|
||||
|
||||
$this->selectAlias($alias . '.id', $prefix . 'id')
|
||||
->selectAlias($alias . '.type', $prefix . 'type')
|
||||
->selectAlias($alias . '.mime_type', $prefix . 'mime_type')
|
||||
->selectAlias($alias . '.media_type', $prefix . 'media_type')
|
||||
->selectAlias($alias . '.url', $prefix . 'url')
|
||||
->selectAlias($alias . '.local_copy', $prefix . 'local_copy')
|
||||
->selectAlias($alias . '.resized_copy', $prefix . 'resized_copy')
|
||||
->selectAlias($alias . '.caching', $prefix . 'caching')
|
||||
->selectAlias($alias . '.public', $prefix . 'public')
|
||||
->selectAlias($alias . '.error', $prefix . 'error')
|
||||
->selectAlias($alias . '.creation', $prefix . 'creation')
|
||||
->leftJoin(
|
||||
$this->getDefaultSelectAlias(), CoreRequestBuilder::TABLE_CACHE_DOCUMENTS, $alias,
|
||||
$expr->eq($pf . '.' . $linkField, $alias . '.id_prim')
|
||||
);
|
||||
->selectAlias($alias . '.type', $prefix . 'type')
|
||||
->selectAlias($alias . '.mime_type', $prefix . 'mime_type')
|
||||
->selectAlias($alias . '.media_type', $prefix . 'media_type')
|
||||
->selectAlias($alias . '.url', $prefix . 'url')
|
||||
->selectAlias($alias . '.local_copy', $prefix . 'local_copy')
|
||||
->selectAlias($alias . '.resized_copy', $prefix . 'resized_copy')
|
||||
->selectAlias($alias . '.caching', $prefix . 'caching')
|
||||
->selectAlias($alias . '.public', $prefix . 'public')
|
||||
->selectAlias($alias . '.error', $prefix . 'error')
|
||||
->selectAlias($alias . '.creation', $prefix . 'creation')
|
||||
->leftJoin(
|
||||
$this->getDefaultSelectAlias(), CoreRequestBuilder::TABLE_CACHE_DOCUMENTS, $alias,
|
||||
$expr->eq($pf . '.' . $linkField, $alias . '.id_prim')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -259,7 +259,7 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
public function leftJoinObjectStatus(
|
||||
string $link = 'object_id_prim',
|
||||
string $alias = '',
|
||||
string $leftAlias = 'os'
|
||||
string $leftAlias = 'os',
|
||||
) {
|
||||
if ($this->getType() !== QueryBuilder::SELECT) {
|
||||
return;
|
||||
|
@ -299,7 +299,7 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
string $alias = '',
|
||||
string $leftAlias = 'ca',
|
||||
string $prefix = '',
|
||||
?Person $author = null
|
||||
?Person $author = null,
|
||||
) {
|
||||
if ($this->getType() !== QueryBuilder::SELECT) {
|
||||
return;
|
||||
|
@ -361,11 +361,11 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
$pf = (($alias === '') ? $this->getDefaultSelectAlias() : $alias);
|
||||
$this->from(CoreRequestBuilder::TABLE_STREAM_ACTIONS, $pf);
|
||||
$this->selectAlias('sa.id', 'streamaction_id')
|
||||
->selectAlias('sa.actor_id', 'streamaction_actor_id')
|
||||
->selectAlias('sa.stream_id', 'streamaction_stream_id')
|
||||
->selectAlias('sa.liked', 'streamaction_liked')
|
||||
->selectAlias('sa.boosted', 'streamaction_boosted')
|
||||
->selectAlias('sa.replied', 'streamaction_replied');
|
||||
->selectAlias('sa.actor_id', 'streamaction_actor_id')
|
||||
->selectAlias('sa.stream_id', 'streamaction_stream_id')
|
||||
->selectAlias('sa.liked', 'streamaction_liked')
|
||||
->selectAlias('sa.boosted', 'streamaction_boosted')
|
||||
->selectAlias('sa.replied', 'streamaction_replied');
|
||||
}
|
||||
|
||||
|
||||
|
@ -381,11 +381,11 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
$expr = $this->expr();
|
||||
|
||||
$this->selectAlias($alias . '.id', 'streamaction_id')
|
||||
->selectAlias($alias . '.actor_id', 'streamaction_actor_id')
|
||||
->selectAlias($alias . '.stream_id', 'streamaction_stream_id')
|
||||
->selectAlias($alias . '.liked', 'streamaction_liked')
|
||||
->selectAlias($alias . '.boosted', 'streamaction_boosted')
|
||||
->selectAlias($alias . '.replied', 'streamaction_replied');
|
||||
->selectAlias($alias . '.actor_id', 'streamaction_actor_id')
|
||||
->selectAlias($alias . '.stream_id', 'streamaction_stream_id')
|
||||
->selectAlias($alias . '.liked', 'streamaction_liked')
|
||||
->selectAlias($alias . '.boosted', 'streamaction_boosted')
|
||||
->selectAlias($alias . '.replied', 'streamaction_replied');
|
||||
|
||||
$orX = $expr->orX();
|
||||
$orX->add($expr->eq($alias . '.stream_id_prim', $pf . '.id_prim'));
|
||||
|
@ -411,7 +411,7 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
* @param string $alias
|
||||
*/
|
||||
public function innerJoinStreamDest(
|
||||
string $type, string $field = 'id_prim', string $aliasDest = 'sd', string $alias = ''
|
||||
string $type, string $field = 'id_prim', string $aliasDest = 'sd', string $alias = '',
|
||||
) {
|
||||
$this->andWhere($this->exprInnerJoinStreamDest($type, $field, $aliasDest, $alias));
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
* @return ICompositeExpression
|
||||
*/
|
||||
public function exprInnerJoinStreamDest(
|
||||
string $type, string $field = 'id_prim', string $aliasDest = 'sd', string $alias = ''
|
||||
string $type, string $field = 'id_prim', string $aliasDest = 'sd', string $alias = '',
|
||||
): ICompositeExpression {
|
||||
$expr = $this->expr();
|
||||
$andX = $expr->andX();
|
||||
|
@ -448,7 +448,7 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
*/
|
||||
public function innerJoinStreamDestFollowing(
|
||||
string $actorId, string $type, string $field = 'id_prim', string $aliasDest = 'sd',
|
||||
string $aliasFollowing = 'f', string $alias = ''
|
||||
string $aliasFollowing = 'f', string $alias = '',
|
||||
) {
|
||||
$this->andWhere(
|
||||
$this->exprInnerJoinStreamDestFollowing(
|
||||
|
@ -470,7 +470,7 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
*/
|
||||
public function exprInnerJoinStreamDestFollowing(
|
||||
string $actorId, string $type, string $field = 'id_prim', string $aliasDest = 'sd',
|
||||
string $aliasFollowing = 'f', string $alias = ''
|
||||
string $aliasFollowing = 'f', string $alias = '',
|
||||
): ICompositeExpression {
|
||||
$expr = $this->expr();
|
||||
$andX = $expr->andX();
|
||||
|
|
|
@ -387,7 +387,7 @@ class SocialLimitsQueryBuilder extends SocialCrossQueryBuilder {
|
|||
*
|
||||
* @return ICompositeExpression
|
||||
*/
|
||||
public function exprLimitToDest(string $actorId, string $type, string $subType = '', string $alias = 'sd'
|
||||
public function exprLimitToDest(string $actorId, string $type, string $subType = '', string $alias = 'sd',
|
||||
): ICompositeExpression {
|
||||
$expr = $this->expr();
|
||||
$andX = $expr->andX();
|
||||
|
@ -414,7 +414,7 @@ class SocialLimitsQueryBuilder extends SocialCrossQueryBuilder {
|
|||
*/
|
||||
public function limitToViewer(
|
||||
string $aliasDest = 'sd', string $aliasFollowing = 'f', bool $allowPublic = false,
|
||||
bool $allowDirect = false
|
||||
bool $allowDirect = false,
|
||||
) {
|
||||
if (!$this->hasViewer()) {
|
||||
$this->selectDestFollowing($aliasDest);
|
||||
|
|
|
@ -30,12 +30,12 @@ class StreamActionsRequest extends StreamActionsRequestBuilder {
|
|||
$replied = $this->getBool(StreamAction::REPLIED, $values, false);
|
||||
|
||||
$qb->setValue('actor_id', $qb->createNamedParameter($action->getActorId()))
|
||||
->setValue('actor_id_prim', $qb->createNamedParameter($qb->prim($action->getActorId())))
|
||||
->setValue('stream_id', $qb->createNamedParameter($action->getStreamId()))
|
||||
->setValue('stream_id_prim', $qb->createNamedParameter($qb->prim($action->getStreamId())))
|
||||
->setValue('liked', $qb->createNamedParameter(($liked) ? 1 : 0))
|
||||
->setValue('boosted', $qb->createNamedParameter(($boosted) ? 1 : 0))
|
||||
->setValue('replied', $qb->createNamedParameter(($replied) ? 1 : 0));
|
||||
->setValue('actor_id_prim', $qb->createNamedParameter($qb->prim($action->getActorId())))
|
||||
->setValue('stream_id', $qb->createNamedParameter($action->getStreamId()))
|
||||
->setValue('stream_id_prim', $qb->createNamedParameter($qb->prim($action->getStreamId())))
|
||||
->setValue('liked', $qb->createNamedParameter(($liked) ? 1 : 0))
|
||||
->setValue('boosted', $qb->createNamedParameter(($boosted) ? 1 : 0))
|
||||
->setValue('replied', $qb->createNamedParameter(($replied) ? 1 : 0));
|
||||
|
||||
$qb->executeStatement();
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class StreamActionsRequest extends StreamActionsRequestBuilder {
|
|||
|
||||
// update entry/field in database, based only on affected action
|
||||
// to avoid race condition on 2 different actions
|
||||
foreach($action->getAffected() as $entry) {
|
||||
foreach ($action->getAffected() as $entry) {
|
||||
$field = match ($entry) {
|
||||
StreamAction::LIKED => 'liked',
|
||||
StreamAction::BOOSTED => 'boosted',
|
||||
|
|
|
@ -60,7 +60,7 @@ class StreamActionsRequestBuilder extends CoreRequestBuilder {
|
|||
'sa.id', 'sa.actor_id', 'sa.stream_id',
|
||||
'sa.boosted', 'sa.liked', 'sa.replied'
|
||||
)
|
||||
->from(self::TABLE_STREAM_ACTIONS, 'sa');
|
||||
->from(self::TABLE_STREAM_ACTIONS, 'sa');
|
||||
|
||||
$this->defaultSelectAlias = 'sa';
|
||||
$qb->setDefaultSelectAlias('sa');
|
||||
|
|
|
@ -36,7 +36,7 @@ class StreamDestRequest extends StreamDestRequestBuilder {
|
|||
public function __construct(
|
||||
IDBConnection $connection, LoggerInterface $logger, IURLGenerator $urlGenerator,
|
||||
CacheActorService $cacheActorService,
|
||||
ConfigService $configService, MiscService $miscService
|
||||
ConfigService $configService, MiscService $miscService,
|
||||
) {
|
||||
parent::__construct($connection, $logger, $urlGenerator, $configService, $miscService);
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ class StreamDestRequestBuilder extends CoreRequestBuilder {
|
|||
|
||||
/** @noinspection PhpMethodParametersCountMismatchInspection */
|
||||
$qb->select('sd.actor_id', 'sd.stream_id', 'sd.type', 'sd.subtype')
|
||||
->from(self::TABLE_STREAM_DEST, 'sd');
|
||||
->from(self::TABLE_STREAM_DEST, 'sd');
|
||||
|
||||
$this->defaultSelectAlias = 'sd';
|
||||
$qb->setDefaultSelectAlias('sd');
|
||||
|
@ -87,7 +87,7 @@ class StreamDestRequestBuilder extends CoreRequestBuilder {
|
|||
protected function countStreamDestSelectSql(): SocialQueryBuilder {
|
||||
$qb = $this->getQueryBuilder();
|
||||
$qb->selectAlias($qb->createFunction('COUNT(*)'), 'count')
|
||||
->from(self::TABLE_STREAM_DEST, 'sd');
|
||||
->from(self::TABLE_STREAM_DEST, 'sd');
|
||||
|
||||
$this->defaultSelectAlias = 'sd';
|
||||
$qb->setDefaultSelectAlias('sd');
|
||||
|
|
|
@ -28,10 +28,10 @@ class StreamQueueRequest extends StreamQueueRequestBuilder {
|
|||
public function create(StreamQueue $queue) {
|
||||
$qb = $this->getStreamQueueInsertSql();
|
||||
$qb->setValue('token', $qb->createNamedParameter($queue->getToken()))
|
||||
->setValue('stream_id', $qb->createNamedParameter($queue->getStreamId()))
|
||||
->setValue('type', $qb->createNamedParameter($queue->getType()))
|
||||
->setValue('status', $qb->createNamedParameter($queue->getStatus()))
|
||||
->setValue('tries', $qb->createNamedParameter($queue->getTries()));
|
||||
->setValue('stream_id', $qb->createNamedParameter($queue->getStreamId()))
|
||||
->setValue('type', $qb->createNamedParameter($queue->getType()))
|
||||
->setValue('status', $qb->createNamedParameter($queue->getStatus()))
|
||||
->setValue('tries', $qb->createNamedParameter($queue->getTries()));
|
||||
$qb->execute();
|
||||
}
|
||||
|
||||
|
@ -87,10 +87,10 @@ class StreamQueueRequest extends StreamQueueRequestBuilder {
|
|||
public function setAsRunning(StreamQueue &$queue) {
|
||||
$qb = $this->getStreamQueueUpdateSql();
|
||||
$qb->set('status', $qb->createNamedParameter(StreamQueue::STATUS_RUNNING))
|
||||
->set(
|
||||
'last',
|
||||
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
||||
);
|
||||
->set(
|
||||
'last',
|
||||
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
||||
);
|
||||
$this->limitToId($qb, $queue->getId());
|
||||
$this->limitToStatus($qb, StreamQueue::STATUS_STANDBY);
|
||||
|
||||
|
@ -136,7 +136,7 @@ class StreamQueueRequest extends StreamQueueRequestBuilder {
|
|||
$expr = $qb->expr();
|
||||
|
||||
$qb->set('status', $qb->createNamedParameter(StreamQueue::STATUS_STANDBY))
|
||||
->set('tries', $func->add('tries', $expr->literal(1)));
|
||||
->set('tries', $func->add('tries', $expr->literal(1)));
|
||||
$this->limitToId($qb, $queue->getId());
|
||||
$this->limitToStatus($qb, StreamQueue::STATUS_RUNNING);
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class StreamQueueRequestBuilder extends CoreRequestBuilder {
|
|||
$qb->select(
|
||||
'qs.id', 'qs.token', 'qs.stream_id', 'qs.type', 'qs.status', 'qs.tries', 'qs.last'
|
||||
)
|
||||
->from(self::TABLE_STREAM_QUEUE, 'qs');
|
||||
->from(self::TABLE_STREAM_QUEUE, 'qs');
|
||||
|
||||
$this->defaultSelectAlias = 'qs';
|
||||
$qb->setDefaultSelectAlias('qs');
|
||||
|
|
|
@ -42,7 +42,7 @@ class StreamRequest extends StreamRequestBuilder {
|
|||
public function __construct(
|
||||
IDBConnection $connection, LoggerInterface $logger, IURLGenerator $urlGenerator,
|
||||
StreamDestRequest $streamDestRequest, StreamTagsRequest $streamTagsRequest,
|
||||
ConfigService $configService, MiscService $miscService
|
||||
ConfigService $configService, MiscService $miscService,
|
||||
) {
|
||||
parent::__construct($connection, $logger, $urlGenerator, $configService, $miscService);
|
||||
|
||||
|
@ -61,10 +61,10 @@ class StreamRequest extends StreamRequestBuilder {
|
|||
}
|
||||
|
||||
$qb->setValue('hashtags', $qb->createNamedParameter(json_encode($stream->getHashtags())))
|
||||
->setValue(
|
||||
'attachments', $qb->createNamedParameter(json_encode($attachments, JSON_UNESCAPED_SLASHES)
|
||||
)
|
||||
);
|
||||
->setValue(
|
||||
'attachments', $qb->createNamedParameter(json_encode($attachments, JSON_UNESCAPED_SLASHES)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -194,7 +194,7 @@ class StreamRequest extends StreamRequestBuilder {
|
|||
public function getStreamById(
|
||||
string $id,
|
||||
bool $asViewer = false,
|
||||
int $format = ACore::FORMAT_ACTIVITYPUB
|
||||
int $format = ACore::FORMAT_ACTIVITYPUB,
|
||||
): Stream {
|
||||
if ($id === '') {
|
||||
throw new StreamNotFoundException();
|
||||
|
@ -262,7 +262,7 @@ class StreamRequest extends StreamRequestBuilder {
|
|||
* @throws StreamNotFoundException
|
||||
* @throws DateTimeException
|
||||
*/
|
||||
public function getRepliesByParentId(string $id, int $since = 0, int $limit = 5, bool $asViewer = false
|
||||
public function getRepliesByParentId(string $id, int $since = 0, int $limit = 5, bool $asViewer = false,
|
||||
): array {
|
||||
if ($id === '') {
|
||||
throw new StreamNotFoundException();
|
||||
|
@ -309,7 +309,7 @@ class StreamRequest extends StreamRequestBuilder {
|
|||
* @return Stream
|
||||
* @throws StreamNotFoundException
|
||||
*/
|
||||
public function getStreamByObjectId(string $objectId, string $type, string $subType = ''
|
||||
public function getStreamByObjectId(string $objectId, string $type, string $subType = '',
|
||||
): Stream {
|
||||
if ($objectId === '') {
|
||||
throw new StreamNotFoundException('missing objectId');
|
||||
|
@ -593,7 +593,7 @@ class StreamRequest extends StreamRequestBuilder {
|
|||
* @deprecated - use getTimelineHome()
|
||||
*/
|
||||
public function getTimelineHome_dep(
|
||||
int $since = 0, int $limit = 5, int $format = Stream::FORMAT_ACTIVITYPUB
|
||||
int $since = 0, int $limit = 5, int $format = Stream::FORMAT_ACTIVITYPUB,
|
||||
): array {
|
||||
$qb = $this->getStreamSelectSql($format);
|
||||
|
||||
|
@ -739,7 +739,7 @@ class StreamRequest extends StreamRequestBuilder {
|
|||
* @throws DateTimeException
|
||||
* @deprecated - use getTimelinePublic()
|
||||
*/
|
||||
public function getTimelineGlobal_dep(int $since = 0, int $limit = 5, bool $localOnly = true
|
||||
public function getTimelineGlobal_dep(int $since = 0, int $limit = 5, bool $localOnly = true,
|
||||
): array {
|
||||
$qb = $this->getStreamSelectSql();
|
||||
$qb->limitPaginate($since, $limit);
|
||||
|
@ -873,7 +873,7 @@ class StreamRequest extends StreamRequestBuilder {
|
|||
public function updateAuthor(string $actorId, string $newId) {
|
||||
$qb = $this->getStreamUpdateSql();
|
||||
$qb->set('attributed_to', $qb->createNamedParameter($newId))
|
||||
->set('attributed_to_prim', $qb->createNamedParameter($qb->prim($newId)));
|
||||
->set('attributed_to_prim', $qb->createNamedParameter($qb->prim($newId)));
|
||||
$qb->limitToAttributedTo($actorId, true);
|
||||
|
||||
$qb->executeStatement();
|
||||
|
@ -902,7 +902,7 @@ class StreamRequest extends StreamRequestBuilder {
|
|||
$attributedTo = $stream->getAttributedTo();
|
||||
if ($attributedTo === '' && $stream->isLocal()) {
|
||||
$attributedTo = $stream->getActor()
|
||||
->getId();
|
||||
->getId();
|
||||
}
|
||||
|
||||
if ($stream->getNid() === 0) {
|
||||
|
@ -911,49 +911,49 @@ class StreamRequest extends StreamRequestBuilder {
|
|||
|
||||
$qb = $this->getStreamInsertSql();
|
||||
$qb->setValue('nid', $qb->createNamedParameter($stream->getNid()))
|
||||
->setValue('id', $qb->createNamedParameter($stream->getId()))
|
||||
->setValue('visibility', $qb->createNamedParameter($stream->getVisibility()))
|
||||
->setValue('type', $qb->createNamedParameter($stream->getType()))
|
||||
->setValue('subtype', $qb->createNamedParameter($stream->getSubType()))
|
||||
->setValue('to', $qb->createNamedParameter($stream->getTo()))
|
||||
->setValue(
|
||||
'to_array', $qb->createNamedParameter(
|
||||
json_encode($stream->getToArray(), JSON_UNESCAPED_SLASHES)
|
||||
)
|
||||
)
|
||||
->setValue(
|
||||
'cc', $qb->createNamedParameter(
|
||||
json_encode($stream->getCcArray(), JSON_UNESCAPED_SLASHES)
|
||||
)
|
||||
)
|
||||
->setValue(
|
||||
'bcc', $qb->createNamedParameter(
|
||||
json_encode($stream->getBccArray(), JSON_UNESCAPED_SLASHES)
|
||||
)
|
||||
)
|
||||
->setValue('content', $qb->createNamedParameter($stream->getContent()))
|
||||
->setValue('summary', $qb->createNamedParameter($stream->getSummary()))
|
||||
->setValue('published', $qb->createNamedParameter($stream->getPublished()))
|
||||
->setValue('attributed_to', $qb->createNamedParameter($attributedTo))
|
||||
->setValue('attributed_to_prim', $qb->createNamedParameter($qb->prim($attributedTo)))
|
||||
->setValue('in_reply_to', $qb->createNamedParameter($stream->getInReplyTo()))
|
||||
->setValue('in_reply_to_prim', $qb->createNamedParameter($qb->prim($stream->getInReplyTo())))
|
||||
->setValue('source', $qb->createNamedParameter($stream->getSource()))
|
||||
->setValue('activity_id', $qb->createNamedParameter($stream->getActivityId()))
|
||||
->setValue('object_id', $qb->createNamedParameter($stream->getObjectId()))
|
||||
->setValue('object_id_prim', $qb->createNamedParameter($qb->prim($stream->getObjectId())))
|
||||
->setValue('details', $qb->createNamedParameter(json_encode($stream->getDetailsAll())))
|
||||
->setValue('cache', $qb->createNamedParameter($cache))
|
||||
->setValue(
|
||||
'filter_duplicate',
|
||||
$qb->createNamedParameter(($stream->isFilterDuplicate()) ? '1' : '0')
|
||||
)
|
||||
->setValue(
|
||||
'instances', $qb->createNamedParameter(
|
||||
json_encode($stream->getInstancePaths(), JSON_UNESCAPED_SLASHES)
|
||||
)
|
||||
)
|
||||
->setValue('local', $qb->createNamedParameter(($stream->isLocal()) ? '1' : '0'));
|
||||
->setValue('id', $qb->createNamedParameter($stream->getId()))
|
||||
->setValue('visibility', $qb->createNamedParameter($stream->getVisibility()))
|
||||
->setValue('type', $qb->createNamedParameter($stream->getType()))
|
||||
->setValue('subtype', $qb->createNamedParameter($stream->getSubType()))
|
||||
->setValue('to', $qb->createNamedParameter($stream->getTo()))
|
||||
->setValue(
|
||||
'to_array', $qb->createNamedParameter(
|
||||
json_encode($stream->getToArray(), JSON_UNESCAPED_SLASHES)
|
||||
)
|
||||
)
|
||||
->setValue(
|
||||
'cc', $qb->createNamedParameter(
|
||||
json_encode($stream->getCcArray(), JSON_UNESCAPED_SLASHES)
|
||||
)
|
||||
)
|
||||
->setValue(
|
||||
'bcc', $qb->createNamedParameter(
|
||||
json_encode($stream->getBccArray(), JSON_UNESCAPED_SLASHES)
|
||||
)
|
||||
)
|
||||
->setValue('content', $qb->createNamedParameter($stream->getContent()))
|
||||
->setValue('summary', $qb->createNamedParameter($stream->getSummary()))
|
||||
->setValue('published', $qb->createNamedParameter($stream->getPublished()))
|
||||
->setValue('attributed_to', $qb->createNamedParameter($attributedTo))
|
||||
->setValue('attributed_to_prim', $qb->createNamedParameter($qb->prim($attributedTo)))
|
||||
->setValue('in_reply_to', $qb->createNamedParameter($stream->getInReplyTo()))
|
||||
->setValue('in_reply_to_prim', $qb->createNamedParameter($qb->prim($stream->getInReplyTo())))
|
||||
->setValue('source', $qb->createNamedParameter($stream->getSource()))
|
||||
->setValue('activity_id', $qb->createNamedParameter($stream->getActivityId()))
|
||||
->setValue('object_id', $qb->createNamedParameter($stream->getObjectId()))
|
||||
->setValue('object_id_prim', $qb->createNamedParameter($qb->prim($stream->getObjectId())))
|
||||
->setValue('details', $qb->createNamedParameter(json_encode($stream->getDetailsAll())))
|
||||
->setValue('cache', $qb->createNamedParameter($cache))
|
||||
->setValue(
|
||||
'filter_duplicate',
|
||||
$qb->createNamedParameter(($stream->isFilterDuplicate()) ? '1' : '0')
|
||||
)
|
||||
->setValue(
|
||||
'instances', $qb->createNamedParameter(
|
||||
json_encode($stream->getInstancePaths(), JSON_UNESCAPED_SLASHES)
|
||||
)
|
||||
)
|
||||
->setValue('local', $qb->createNamedParameter(($stream->isLocal()) ? '1' : '0'));
|
||||
|
||||
try {
|
||||
$dTime = new DateTime();
|
||||
|
@ -961,10 +961,10 @@ class StreamRequest extends StreamRequestBuilder {
|
|||
$qb->setValue(
|
||||
'published_time', $qb->createNamedParameter($dTime, IQueryBuilder::PARAM_DATE)
|
||||
)
|
||||
->setValue(
|
||||
'creation',
|
||||
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
||||
);
|
||||
->setValue(
|
||||
'creation',
|
||||
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ class StreamRequestBuilder extends CoreRequestBuilder {
|
|||
$qb->setFormat($format);
|
||||
|
||||
$qb->selectDistinct('s.id')
|
||||
->from(self::TABLE_STREAM, 's');
|
||||
->from(self::TABLE_STREAM, 's');
|
||||
foreach (self::$tables[self::TABLE_STREAM] as $field) {
|
||||
if ($field === 'id') {
|
||||
continue;
|
||||
|
@ -91,7 +91,7 @@ class StreamRequestBuilder extends CoreRequestBuilder {
|
|||
protected function countNotesSelectSql(): SocialQueryBuilder {
|
||||
$qb = $this->getQueryBuilder();
|
||||
$qb->selectAlias($qb->createFunction('COUNT(*)'), 'count')
|
||||
->from(self::TABLE_STREAM, 's');
|
||||
->from(self::TABLE_STREAM, 's');
|
||||
|
||||
$qb->setDefaultSelectAlias('s');
|
||||
|
||||
|
@ -118,7 +118,7 @@ class StreamRequestBuilder extends CoreRequestBuilder {
|
|||
* @param string $aliasFollow
|
||||
*/
|
||||
protected function timelineHomeLinkCacheActor(
|
||||
SocialQueryBuilder $qb, string $alias = 'ca', string $aliasFollow = 'f'
|
||||
SocialQueryBuilder $qb, string $alias = 'ca', string $aliasFollow = 'f',
|
||||
) {
|
||||
$qb->linkToCacheActors($alias, 's.attributed_to_prim');
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class StreamTagsRequest extends StreamTagsRequestBuilder {
|
|||
$qb->executeStatement();
|
||||
} catch (DBException $e) {
|
||||
Server::get(LoggerInterface::class)
|
||||
->log(1, 'Social - Duplicate hashtag on Stream ' . json_encode($stream));
|
||||
->log(1, 'Social - Duplicate hashtag on Stream ' . json_encode($stream));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ class StreamTagsRequestBuilder extends CoreRequestBuilder {
|
|||
|
||||
/** @noinspection PhpMethodParametersCountMismatchInspection */
|
||||
$qb->select('st.stream_id', 'st.hashtag')
|
||||
->from(self::TABLE_STREAM_TAGS, 'st');
|
||||
->from(self::TABLE_STREAM_TAGS, 'st');
|
||||
|
||||
$this->defaultSelectAlias = 'st';
|
||||
$qb->setDefaultSelectAlias('st');
|
||||
|
|
|
@ -36,7 +36,7 @@ class MoveInterface extends AbstractActivityPubInterface implements IActivityPub
|
|||
FollowsRequest $followsRequest,
|
||||
StreamRequest $streamRequest,
|
||||
StreamDestRequest $streamDestRequest,
|
||||
CacheActorService $cacheActorService
|
||||
CacheActorService $cacheActorService,
|
||||
) {
|
||||
$this->actionsRequest = $actionsRequest;
|
||||
$this->cacheDocumentsRequest = $cacheDocumentsRequest;
|
||||
|
|
|
@ -57,7 +57,7 @@ class PersonInterface extends AbstractActivityPubInterface implements IActivityP
|
|||
StreamRequest $streamRequest,
|
||||
StreamDestRequest $streamDestRequest,
|
||||
ActorService $actorService,
|
||||
ConfigService $configService
|
||||
ConfigService $configService,
|
||||
) {
|
||||
$this->actionsRequest = $actionsRequest;
|
||||
$this->cacheActorsRequest = $cacheActorsRequest;
|
||||
|
|
|
@ -33,7 +33,7 @@ class SocialAppNotificationInterface extends AbstractActivityPubInterface implem
|
|||
return;
|
||||
}
|
||||
|
||||
$notification->setPublished(date("c"));
|
||||
$notification->setPublished(date('c'));
|
||||
$notification->convertPublished();
|
||||
|
||||
$this->miscService->log(
|
||||
|
|
|
@ -61,7 +61,7 @@ class AnnounceInterface extends AbstractActivityPubInterface implements IActivit
|
|||
public function __construct(
|
||||
StreamRequest $streamRequest, ActionsRequest $actionsRequest,
|
||||
StreamQueueService $streamQueueService, CacheActorService $cacheActorService,
|
||||
MiscService $miscService
|
||||
MiscService $miscService,
|
||||
) {
|
||||
$this->streamRequest = $streamRequest;
|
||||
$this->actionsRequest = $actionsRequest;
|
||||
|
@ -213,7 +213,7 @@ class AnnounceInterface extends AbstractActivityPubInterface implements IActivit
|
|||
$objectId = $item->getObjectId();
|
||||
try {
|
||||
$cachedItem = $item->getCache()
|
||||
->getItem($objectId);
|
||||
->getItem($objectId);
|
||||
} catch (CacheItemNotFoundException $e) {
|
||||
return;
|
||||
}
|
||||
|
@ -296,12 +296,12 @@ class AnnounceInterface extends AbstractActivityPubInterface implements IActivit
|
|||
$notification->setDetailItem('post', $post);
|
||||
$notification->addDetail('accounts', $author->getAccount());
|
||||
$notification->setAttributedTo($author->getId())
|
||||
->setSubType(Announce::TYPE)
|
||||
->setId($post->getId() . '/notification+boost')
|
||||
->setSummary('{accounts} boosted your post')
|
||||
->setObjectId($post->getId())
|
||||
->setTo($post->getAttributedTo())
|
||||
->setLocal(true);
|
||||
->setSubType(Announce::TYPE)
|
||||
->setId($post->getId() . '/notification+boost')
|
||||
->setSummary('{accounts} boosted your post')
|
||||
->setObjectId($post->getId())
|
||||
->setTo($post->getAttributedTo())
|
||||
->setLocal(true);
|
||||
|
||||
$notificationInterface->save($notification);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class DocumentInterface extends AbstractActivityPubInterface implements IActivit
|
|||
|
||||
public function __construct(
|
||||
CacheDocumentService $cacheDocumentService,
|
||||
CacheDocumentsRequest $cacheDocumentsRequest
|
||||
CacheDocumentsRequest $cacheDocumentsRequest,
|
||||
) {
|
||||
$this->cacheDocumentService = $cacheDocumentService;
|
||||
$this->cacheDocumentsRequest = $cacheDocumentsRequest;
|
||||
|
@ -45,7 +45,7 @@ class DocumentInterface extends AbstractActivityPubInterface implements IActivit
|
|||
if (!$item->isRoot()) {
|
||||
$item->setParentId(
|
||||
$item->getParent()
|
||||
->getId()
|
||||
->getId()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class FollowInterface extends AbstractActivityPubInterface implements IActivityP
|
|||
public function __construct(
|
||||
FollowsRequest $followsRequest, CacheActorService $cacheActorService,
|
||||
AccountService $accountService, ActivityService $activityService,
|
||||
MiscService $miscService
|
||||
MiscService $miscService,
|
||||
) {
|
||||
$this->followsRequest = $followsRequest;
|
||||
$this->cacheActorService = $cacheActorService;
|
||||
|
@ -177,12 +177,12 @@ class FollowInterface extends AbstractActivityPubInterface implements IActivityP
|
|||
$notification->setDetail('account', $follower->getAccount());
|
||||
$notification->setDetailItem('actor', $follower);
|
||||
$notification->setAttributedTo($follow->getActorId())
|
||||
->setId($follow->getId() . '/notification')
|
||||
->setSubType(Follow::TYPE)
|
||||
->setActorId($follower->getId())
|
||||
->setSummary('{account} is following you')
|
||||
->setTo($follow->getObjectId())
|
||||
->setLocal(true);
|
||||
->setId($follow->getId() . '/notification')
|
||||
->setSubType(Follow::TYPE)
|
||||
->setActorId($follower->getId())
|
||||
->setSummary('{account} is following you')
|
||||
->setTo($follow->getObjectId())
|
||||
->setLocal(true);
|
||||
|
||||
$notificationInterface->save($notification);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class ImageInterface extends DocumentInterface implements IActivityPubInterface
|
|||
*/
|
||||
public function __construct(
|
||||
CacheDocumentsRequest $cacheDocumentsRequest,
|
||||
CacheDocumentService $cacheDocumentService
|
||||
CacheDocumentService $cacheDocumentService,
|
||||
) {
|
||||
parent::__construct($cacheDocumentService, $cacheDocumentsRequest);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class LikeInterface extends AbstractActivityPubInterface implements IActivityPub
|
|||
|
||||
public function __construct(
|
||||
ActionsRequest $actionsRequest, StreamRequest $streamRequest,
|
||||
CacheActorService $cacheActorService
|
||||
CacheActorService $cacheActorService,
|
||||
) {
|
||||
$this->actionsRequest = $actionsRequest;
|
||||
$this->streamRequest = $streamRequest;
|
||||
|
@ -187,12 +187,12 @@ class LikeInterface extends AbstractActivityPubInterface implements IActivityPub
|
|||
$notification->setDetailItem('post', $post);
|
||||
$notification->addDetail('accounts', $author->getAccount());
|
||||
$notification->setAttributedTo($author->getId())
|
||||
->setSubType(Like::TYPE)
|
||||
->setId($post->getId() . '/notification+like')
|
||||
->setSummary('{accounts} liked your post')
|
||||
->setObjectId($post->getId())
|
||||
->setTo($post->getAttributedTo())
|
||||
->setLocal(true);
|
||||
->setSubType(Like::TYPE)
|
||||
->setId($post->getId() . '/notification+like')
|
||||
->setSummary('{accounts} liked your post')
|
||||
->setObjectId($post->getId())
|
||||
->setTo($post->getAttributedTo())
|
||||
->setLocal(true);
|
||||
|
||||
$notificationInterface->save($notification);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class NoteInterface extends AbstractActivityPubInterface implements IActivityPub
|
|||
public function __construct(
|
||||
StreamRequest $streamRequest,
|
||||
CacheActorsRequest $cacheActorsRequest,
|
||||
PushService $pushService
|
||||
PushService $pushService,
|
||||
) {
|
||||
$this->streamRequest = $streamRequest;
|
||||
$this->cacheActorsRequest = $cacheActorsRequest;
|
||||
|
@ -135,12 +135,12 @@ class NoteInterface extends AbstractActivityPubInterface implements IActivityPub
|
|||
$notification->setDetailItem('post', $post);
|
||||
$notification->addDetail('account', $post->getActor()->getAccount());
|
||||
$notification->setAttributedTo($recipient->getId())
|
||||
->setSubType(Mention::TYPE)
|
||||
->setId($post->getId() . '/notification+mention')
|
||||
->setSummary('{account} mentioned you in a post')
|
||||
->setObjectId($post->getId())
|
||||
->setTo($recipient->getId())
|
||||
->setLocal(true);
|
||||
->setSubType(Mention::TYPE)
|
||||
->setId($post->getId() . '/notification+mention')
|
||||
->setSummary('{account} mentioned you in a post')
|
||||
->setObjectId($post->getId())
|
||||
->setTo($recipient->getId())
|
||||
->setLocal(true);
|
||||
|
||||
$notificationInterface->save($notification);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ use Psr\Log\LoggerInterface;
|
|||
class UserAccountListener implements IEventListener {
|
||||
public function __construct(
|
||||
private AccountService $accountService,
|
||||
private LoggerInterface $logger
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class RenameDocumentLocalCopy implements IRepairStep {
|
|||
|
||||
public function __construct(
|
||||
ConfigService $configService,
|
||||
CacheDocumentsRequest $cacheDocumentsRequest
|
||||
CacheDocumentsRequest $cacheDocumentsRequest,
|
||||
) {
|
||||
$this->configService = $configService;
|
||||
$this->cacheDocumentsRequest = $cacheDocumentsRequest;
|
||||
|
|
|
@ -79,7 +79,7 @@ class ACore extends Item implements JsonSerializable, IQueryRow {
|
|||
return $this->requestToken;
|
||||
} else {
|
||||
return $this->getRoot()
|
||||
->getRequestToken();
|
||||
->getRequestToken();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ class ACore extends Item implements JsonSerializable, IQueryRow {
|
|||
public function getObjectId(): string {
|
||||
if ($this->hasObject()) {
|
||||
return $this->getObject()
|
||||
->getId();
|
||||
->getId();
|
||||
}
|
||||
|
||||
return parent::getObjectId();
|
||||
|
@ -278,7 +278,7 @@ class ACore extends Item implements JsonSerializable, IQueryRow {
|
|||
public function checkOrigin(string $id) {
|
||||
$host = parse_url($id, PHP_URL_HOST);
|
||||
$origin = $this->getRoot()
|
||||
->getOrigin();
|
||||
->getOrigin();
|
||||
|
||||
if ($id !== '' && $origin === $host && $host !== '') {
|
||||
return;
|
||||
|
@ -335,7 +335,7 @@ class ACore extends Item implements JsonSerializable, IQueryRow {
|
|||
}
|
||||
|
||||
return $this->getParent()
|
||||
->getRoot($chain);
|
||||
->getRoot($chain);
|
||||
}
|
||||
|
||||
|
||||
|
@ -691,7 +691,7 @@ class ACore extends Item implements JsonSerializable, IQueryRow {
|
|||
if ($this->hasActor()) {
|
||||
$this->addEntry(
|
||||
'actor', $this->getActor()
|
||||
->getId()
|
||||
->getId()
|
||||
);
|
||||
if ($this->isCompleteDetails()) {
|
||||
$this->addEntryItem('actor_info', $this->getActor());
|
||||
|
|
|
@ -166,7 +166,7 @@ class Person extends ACore implements IQueryRow, JsonSerializable {
|
|||
public function getAvatar(): string {
|
||||
if ($this->hasIcon()) {
|
||||
return $this->getIcon()
|
||||
->getUrl();
|
||||
->getUrl();
|
||||
}
|
||||
|
||||
return $this->avatar;
|
||||
|
@ -600,15 +600,15 @@ class Person extends ACore implements IQueryRow, JsonSerializable {
|
|||
public function import(array $data) {
|
||||
parent::import($data);
|
||||
$this->setPreferredUsername($this->validate(ACore::AS_USERNAME, 'preferredUsername', $data, ''))
|
||||
->setPublicKey($this->get('publicKey.publicKeyPem', $data))
|
||||
->setSharedInbox($this->validate(ACore::AS_URL, 'endpoints.sharedInbox', $data))
|
||||
->setName($this->validate(ACore::AS_USERNAME, 'name', $data, ''))
|
||||
->setAccount($this->validate(ACore::AS_ACCOUNT, 'account', $data, ''))
|
||||
->setInbox($this->validate(ACore::AS_URL, 'inbox', $data, ''))
|
||||
->setOutbox($this->validate(ACore::AS_URL, 'outbox', $data, ''))
|
||||
->setFollowers($this->validate(ACore::AS_URL, 'followers', $data, ''))
|
||||
->setFollowing($this->validate(ACore::AS_URL, 'following', $data, ''))
|
||||
->setFeatured($this->validate(ACore::AS_URL, 'featured', $data, ''));
|
||||
->setPublicKey($this->get('publicKey.publicKeyPem', $data))
|
||||
->setSharedInbox($this->validate(ACore::AS_URL, 'endpoints.sharedInbox', $data))
|
||||
->setName($this->validate(ACore::AS_USERNAME, 'name', $data, ''))
|
||||
->setAccount($this->validate(ACore::AS_ACCOUNT, 'account', $data, ''))
|
||||
->setInbox($this->validate(ACore::AS_URL, 'inbox', $data, ''))
|
||||
->setOutbox($this->validate(ACore::AS_URL, 'outbox', $data, ''))
|
||||
->setFollowers($this->validate(ACore::AS_URL, 'followers', $data, ''))
|
||||
->setFollowing($this->validate(ACore::AS_URL, 'following', $data, ''))
|
||||
->setFeatured($this->validate(ACore::AS_URL, 'featured', $data, ''));
|
||||
|
||||
/** @var Image $icon */
|
||||
$icon = AP::$activityPub->getItemFromType(Image::TYPE);
|
||||
|
@ -668,19 +668,19 @@ class Person extends ACore implements IQueryRow, JsonSerializable {
|
|||
public function importFromDatabase(array $data) {
|
||||
parent::importFromDatabase($data);
|
||||
$this->setPreferredUsername($this->validate(self::AS_USERNAME, 'preferred_username', $data, ''))
|
||||
->setUserId($this->get('user_id', $data, ''))
|
||||
->setName($this->validate(self::AS_USERNAME, 'name', $data, ''))
|
||||
->setDescription($this->validate(self::AS_CONTENT, 'summary', $data))
|
||||
->setAccount($this->validate(self::AS_ACCOUNT, 'account', $data, ''))
|
||||
->setPublicKey($this->get('public_key', $data, ''))
|
||||
->setPrivateKey($this->get('private_key', $data, ''))
|
||||
->setInbox($this->validate(self::AS_URL, 'inbox', $data, ''))
|
||||
->setOutbox($this->validate(self::AS_URL, 'outbox', $data, ''))
|
||||
->setFollowers($this->validate(self::AS_URL, 'followers', $data, ''))
|
||||
->setFollowing($this->validate(self::AS_URL, 'following', $data, ''))
|
||||
->setSharedInbox($this->validate(self::AS_URL, 'shared_inbox', $data, ''))
|
||||
->setFeatured($this->validate(self::AS_URL, 'featured', $data, ''))
|
||||
->setDetailsAll($this->getArray('details', $data, []));
|
||||
->setUserId($this->get('user_id', $data, ''))
|
||||
->setName($this->validate(self::AS_USERNAME, 'name', $data, ''))
|
||||
->setDescription($this->validate(self::AS_CONTENT, 'summary', $data))
|
||||
->setAccount($this->validate(self::AS_ACCOUNT, 'account', $data, ''))
|
||||
->setPublicKey($this->get('public_key', $data, ''))
|
||||
->setPrivateKey($this->get('private_key', $data, ''))
|
||||
->setInbox($this->validate(self::AS_URL, 'inbox', $data, ''))
|
||||
->setOutbox($this->validate(self::AS_URL, 'outbox', $data, ''))
|
||||
->setFollowers($this->validate(self::AS_URL, 'followers', $data, ''))
|
||||
->setFollowing($this->validate(self::AS_URL, 'following', $data, ''))
|
||||
->setSharedInbox($this->validate(self::AS_URL, 'shared_inbox', $data, ''))
|
||||
->setFeatured($this->validate(self::AS_URL, 'featured', $data, ''))
|
||||
->setDetailsAll($this->getArray('details', $data, []));
|
||||
|
||||
try {
|
||||
$cTime = new DateTime($this->get('creation', $data, 'yesterday'));
|
||||
|
|
|
@ -189,7 +189,7 @@ class Item {
|
|||
public function getActorId(): string {
|
||||
if ($this->hasActor()) {
|
||||
return $this->getActor()
|
||||
->getId();
|
||||
->getId();
|
||||
}
|
||||
|
||||
return $this->actorId;
|
||||
|
|
|
@ -371,11 +371,11 @@ class Document extends ACore implements JsonSerializable {
|
|||
*/
|
||||
public function convertToMediaAttachment(
|
||||
?IURLGenerator $urlGenerator = null,
|
||||
int $exportFormat = self::FORMAT_LOCAL
|
||||
int $exportFormat = self::FORMAT_LOCAL,
|
||||
): MediaAttachment {
|
||||
$media = new MediaAttachment();
|
||||
$media->setId((string)$this->getNid())
|
||||
->setExportFormat($exportFormat);
|
||||
->setExportFormat($exportFormat);
|
||||
|
||||
$mime = '';
|
||||
if (strpos($this->getMediaType(), '/')) {
|
||||
|
@ -393,15 +393,15 @@ class Document extends ACore implements JsonSerializable {
|
|||
if ($this->getMeta() === null) {
|
||||
$meta = new AttachmentMeta();
|
||||
$meta->setOriginal(new AttachmentMetaDim($this->getLocalCopySize()))
|
||||
->setSmall(new AttachmentMetaDim($this->getResizedCopySize()))
|
||||
->setFocus(new AttachmentMetaFocus(0, 0));
|
||||
->setSmall(new AttachmentMetaDim($this->getResizedCopySize()))
|
||||
->setFocus(new AttachmentMetaFocus(0, 0));
|
||||
|
||||
$this->setMeta($meta);
|
||||
}
|
||||
|
||||
$media->setMeta($this->getMeta())
|
||||
->setDescription($this->getDescription())
|
||||
->setBlurHash($this->getBlurHash());
|
||||
->setDescription($this->getDescription())
|
||||
->setBlurHash($this->getBlurHash());
|
||||
|
||||
return $media;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ use OCA\Social\Model\ActivityPub\Stream;
|
|||
class Mention extends Stream implements JsonSerializable {
|
||||
public const TYPE = 'Mention';
|
||||
|
||||
public function __construct(ACore $parent = null) {
|
||||
public function __construct(?ACore $parent = null) {
|
||||
parent::__construct($parent);
|
||||
|
||||
$this->setType(self::TYPE);
|
||||
|
|
|
@ -22,7 +22,7 @@ class Note extends Stream implements JsonSerializable {
|
|||
|
||||
private array $hashtags = [];
|
||||
|
||||
public function __construct(ACore $parent = null) {
|
||||
public function __construct(?ACore $parent = null) {
|
||||
parent::__construct($parent);
|
||||
|
||||
$this->setType(self::TYPE);
|
||||
|
|
|
@ -57,8 +57,8 @@ class OrderedCollection extends ACore implements JsonSerializable {
|
|||
public function import(array $data): self {
|
||||
parent::import($data);
|
||||
$this->setFirst($this->validate(ACore::AS_USERNAME, 'first', $data, ''))
|
||||
->setLast($this->validate(ACore::AS_USERNAME, 'last', $data, ''))
|
||||
->setTotalItems($this->getInt('totalItems', $data));
|
||||
->setLast($this->validate(ACore::AS_USERNAME, 'last', $data, ''))
|
||||
->setTotalItems($this->getInt('totalItems', $data));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -340,7 +340,7 @@ class Stream extends ACore implements IQueryRow, JsonSerializable {
|
|||
}
|
||||
|
||||
$this->getCache()
|
||||
->addItem($cacheItem);
|
||||
->addItem($cacheItem);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -518,15 +518,15 @@ class Stream extends ACore implements IQueryRow, JsonSerializable {
|
|||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
// "in_reply_to_id" => null,
|
||||
// "in_reply_to_account_id" => null,
|
||||
// 'replies_count' => 0,
|
||||
// 'reblogs_count' => 0,
|
||||
// 'favourites_count' => 0,
|
||||
// 'muted' => false,
|
||||
// 'bookmarked' => false,
|
||||
// "reblog" => null,
|
||||
// 'noindex' => false
|
||||
// "in_reply_to_id" => null,
|
||||
// "in_reply_to_account_id" => null,
|
||||
// 'replies_count' => 0,
|
||||
// 'reblogs_count' => 0,
|
||||
// 'favourites_count' => 0,
|
||||
// 'muted' => false,
|
||||
// 'bookmarked' => false,
|
||||
// "reblog" => null,
|
||||
// 'noindex' => false
|
||||
|
||||
$attachments = [];
|
||||
foreach ($this->getArray('media_attachments', $data) as $dataAttachment) {
|
||||
|
@ -602,14 +602,14 @@ class Stream extends ACore implements IQueryRow, JsonSerializable {
|
|||
}
|
||||
}
|
||||
$result = [
|
||||
"local" => $this->isLocal(),
|
||||
"content" => $this->getContent(),
|
||||
"sensitive" => $this->isSensitive(),
|
||||
"spoiler_text" => $this->getSpoilerText(),
|
||||
'local' => $this->isLocal(),
|
||||
'content' => $this->getContent(),
|
||||
'sensitive' => $this->isSensitive(),
|
||||
'spoiler_text' => $this->getSpoilerText(),
|
||||
'visibility' => $this->getVisibility(),
|
||||
"language" => $this->getLanguage(),
|
||||
"in_reply_to_id" => null,
|
||||
"in_reply_to_account_id" => null,
|
||||
'language' => $this->getLanguage(),
|
||||
'in_reply_to_id' => null,
|
||||
'in_reply_to_account_id' => null,
|
||||
'mentions' => $this->getMentions(),
|
||||
'replies_count' => $this->getDetailInt('replies'),
|
||||
'reblogs_count' => $this->getDetailInt('boosts'),
|
||||
|
@ -620,9 +620,9 @@ class Stream extends ACore implements IQueryRow, JsonSerializable {
|
|||
'bookmarked' => false,
|
||||
'uri' => $this->getId(),
|
||||
'url' => $this->getId(),
|
||||
"reblog" => null,
|
||||
'reblog' => null,
|
||||
'media_attachments' => $this->getAttachments(),
|
||||
"created_at" => date('Y-m-d\TH:i:s', $this->getPublishedTime()) . '.000Z',
|
||||
'created_at' => date('Y-m-d\TH:i:s', $this->getPublishedTime()) . '.000Z',
|
||||
'noindex' => false
|
||||
];
|
||||
|
||||
|
|
|
@ -111,12 +111,12 @@ class AttachmentMetaDim implements JsonSerializable {
|
|||
|
||||
public function import(array $data): self {
|
||||
$this->setWidth($this->getInt('width', $data))
|
||||
->setHeight($this->getInt('height', $data))
|
||||
->setSize($this->get('size', $data))
|
||||
->setAspect($this->getFloat('aspect', $data))
|
||||
->setDuration($this->getInt('duration', $data))
|
||||
->setBitrate($this->getInt('bitrate', $data))
|
||||
->setFrameRate($this->getFloat('frame_rate', $data));
|
||||
->setHeight($this->getInt('height', $data))
|
||||
->setSize($this->get('size', $data))
|
||||
->setAspect($this->getFloat('aspect', $data))
|
||||
->setDuration($this->getInt('duration', $data))
|
||||
->setBitrate($this->getInt('bitrate', $data))
|
||||
->setFrameRate($this->getFloat('frame_rate', $data));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ class MediaAttachment implements JsonSerializable {
|
|||
'remote_url' => $this->getRemoteUrl(),
|
||||
'meta' => $this->getMeta(),
|
||||
'description' => $this->getDescription(),
|
||||
"blurhash" => $this->getBlurHash()
|
||||
'blurhash' => $this->getBlurHash()
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class ProbeOptions extends CoreOptions implements JsonSerializable {
|
|||
*
|
||||
* @param IRequest|null $request
|
||||
*/
|
||||
public function __construct(IRequest $request = null) {
|
||||
public function __construct(?IRequest $request = null) {
|
||||
if ($request !== null) {
|
||||
$this->fromArray($request->getParams());
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class Notifier implements INotifier {
|
|||
|
||||
public function __construct(
|
||||
IL10N $l10n, IFactory $factory, IManager $contactsManager, IURLGenerator $url,
|
||||
ICloudIdManager $cloudIdManager
|
||||
ICloudIdManager $cloudIdManager,
|
||||
) {
|
||||
$this->l10n = $l10n;
|
||||
$this->factory = $factory;
|
||||
|
@ -106,7 +106,7 @@ class Notifier implements INotifier {
|
|||
switch ($action->getLabel()) {
|
||||
case 'help':
|
||||
$action->setParsedLabel($l10n->t('Help'))
|
||||
->setPrimary(true);
|
||||
->setPrimary(true);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class ContactsMenuProvider implements IProvider {
|
|||
*/
|
||||
public function __construct(
|
||||
IActionFactory $actionFactory, IURLGenerator $urlGenerator, IUserManager $userManager, IL10N $l10n,
|
||||
AccountService $accountService
|
||||
AccountService $accountService,
|
||||
) {
|
||||
$this->actionFactory = $actionFactory;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
|
|
|
@ -73,7 +73,7 @@ class UnifiedSearchProvider implements IProvider {
|
|||
AccountService $accountService,
|
||||
SearchService $searchService,
|
||||
ConfigService $configService,
|
||||
LoggerInterface $logger
|
||||
LoggerInterface $logger,
|
||||
) {
|
||||
$this->l10n = $l10n;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
|
@ -180,7 +180,7 @@ class UnifiedSearchProvider implements IProvider {
|
|||
$result = [];
|
||||
foreach ($accounts as $account) {
|
||||
$icon = ($account->hasIcon()) ? $account->getIcon()
|
||||
->getUrl() : '';
|
||||
->getUrl() : '';
|
||||
$result[] = new UnifiedSearchResult(
|
||||
$icon,
|
||||
$account->getPreferredUsername(),
|
||||
|
|
|
@ -30,7 +30,7 @@ class UnifiedSearchResult extends SearchResultEntry {
|
|||
public function __construct(
|
||||
string $thumbnailUrl = '', string $title = '', string $subline = '', string $resourceUrl = '',
|
||||
string $icon = '',
|
||||
bool $rounded = false
|
||||
bool $rounded = false,
|
||||
) {
|
||||
parent::__construct($thumbnailUrl, $title, $subline, $resourceUrl, $icon, $rounded);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ class AccountService {
|
|||
DocumentService $documentService,
|
||||
SignatureService $signatureService,
|
||||
ConfigService $configService,
|
||||
LoggerInterface $logger
|
||||
LoggerInterface $logger,
|
||||
) {
|
||||
$this->userManager = $userManager;
|
||||
$this->userSession = $userSession;
|
||||
|
@ -278,7 +278,7 @@ class AccountService {
|
|||
try {
|
||||
$iconId = $this->documentService->cacheLocalAvatarByUsername($actor);
|
||||
$actor->setIconId($iconId);
|
||||
} catch (ItemUnknownException | ItemAlreadyExistsException $e) {
|
||||
} catch (ItemUnknownException|ItemAlreadyExistsException $e) {
|
||||
}
|
||||
|
||||
$this->addLocalActorDetailCount($actor);
|
||||
|
|
|
@ -53,7 +53,7 @@ class ActionService {
|
|||
StreamService $streamService,
|
||||
BoostService $boostService,
|
||||
LikeService $likeService,
|
||||
StreamActionService $streamActionService
|
||||
StreamActionService $streamActionService,
|
||||
) {
|
||||
$this->streamService = $streamService;
|
||||
$this->boostService = $boostService;
|
||||
|
|
|
@ -71,7 +71,7 @@ class ActivityService {
|
|||
RequestQueueService $requestQueueService,
|
||||
CurlService $curlService,
|
||||
ConfigService $configService,
|
||||
LoggerInterface $logger
|
||||
LoggerInterface $logger,
|
||||
) {
|
||||
$this->streamRequest = $streamRequest;
|
||||
$this->followsRequest = $followsRequest;
|
||||
|
@ -92,7 +92,7 @@ class ActivityService {
|
|||
* @return string
|
||||
* @throws SocialAppConfigException
|
||||
*/
|
||||
public function createActivity(Person $actor, ACore $item, ACore &$activity = null): string {
|
||||
public function createActivity(Person $actor, ACore $item, ?ACore &$activity = null): string {
|
||||
$activity = new Create();
|
||||
$item->setParent($activity);
|
||||
|
||||
|
@ -212,7 +212,7 @@ class ActivityService {
|
|||
*/
|
||||
public function manageRequest(RequestQueue $queue) {
|
||||
$host = $queue->getInstance()
|
||||
->getAddress();
|
||||
->getAddress();
|
||||
if (in_array($host, $this->failInstances)) {
|
||||
return;
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ class ActivityService {
|
|||
try {
|
||||
$this->requestQueueService->initRequest($queue);
|
||||
} catch (QueueStatusException $e) {
|
||||
$this->logger->error("Error while trying to init request", [
|
||||
$this->logger->error('Error while trying to init request', [
|
||||
'exception' => $e,
|
||||
]);
|
||||
|
||||
|
@ -233,15 +233,15 @@ class ActivityService {
|
|||
$this->signatureService->signRequest($request, $queue);
|
||||
$this->curlService->retrieveJson($request);
|
||||
$this->requestQueueService->endRequest($queue, true);
|
||||
} catch (UnauthorizedFediverseException | RequestResultNotJsonException $e) {
|
||||
} catch (UnauthorizedFediverseException|RequestResultNotJsonException $e) {
|
||||
$this->requestQueueService->endRequest($queue, true);
|
||||
} catch (ActorDoesNotExistException | RequestContentException | RequestResultSizeException $e) {
|
||||
} catch (ActorDoesNotExistException|RequestContentException|RequestResultSizeException $e) {
|
||||
$this->logger->notice(
|
||||
'Error while managing request: ' . json_encode($request) . ' ' . get_class($e) . ': '
|
||||
. $e->getMessage()
|
||||
);
|
||||
$this->requestQueueService->deleteRequest($queue);
|
||||
} catch (RequestNetworkException | RequestServerException $e) {
|
||||
} catch (RequestNetworkException|RequestServerException $e) {
|
||||
$this->logger->notice(
|
||||
'Temporary error while managing request: RequestServerException - ' . json_encode($request)
|
||||
. ' - ' . get_class($e) . ': ' . $e->getMessage()
|
||||
|
@ -298,7 +298,7 @@ class ActivityService {
|
|||
}
|
||||
|
||||
$sharedInbox = $follow->getActor()
|
||||
->getSharedInbox();
|
||||
->getSharedInbox();
|
||||
if (in_array($sharedInbox, $sharedInboxes)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ class ActivityService {
|
|||
private function getAuthorFromItem(Acore $activity): string {
|
||||
if ($activity->hasActor()) {
|
||||
return $activity->getActor()
|
||||
->getId();
|
||||
->getId();
|
||||
}
|
||||
|
||||
return $activity->getActorId();
|
||||
|
|
|
@ -50,7 +50,7 @@ class ActorService {
|
|||
CacheActorsRequest $cacheActorsRequest, CacheDocumentsRequest $cacheDocumentsRequest,
|
||||
CurlService $curlService,
|
||||
ConfigService $configService,
|
||||
MiscService $miscService
|
||||
MiscService $miscService,
|
||||
) {
|
||||
$this->cacheActorsRequest = $cacheActorsRequest;
|
||||
$this->cacheDocumentsRequest = $cacheDocumentsRequest;
|
||||
|
|
|
@ -42,7 +42,7 @@ class BoostService {
|
|||
public function __construct(
|
||||
StreamRequest $streamRequest, StreamService $streamService, SignatureService $signatureService,
|
||||
ActivityService $activityService, StreamActionService $streamActionService,
|
||||
StreamQueueService $streamQueueService
|
||||
StreamQueueService $streamQueueService,
|
||||
) {
|
||||
$this->streamRequest = $streamRequest;
|
||||
$this->streamService = $streamService;
|
||||
|
|
|
@ -63,7 +63,7 @@ class CacheActorService {
|
|||
CurlService $curlService,
|
||||
FediverseService $fediverseService,
|
||||
ConfigService $configService,
|
||||
LoggerInterface $logger
|
||||
LoggerInterface $logger,
|
||||
) {
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->actorsRequest = $actorsRequest;
|
||||
|
@ -164,7 +164,7 @@ class CacheActorService {
|
|||
$instance = '';
|
||||
$account = ltrim($account, '@');
|
||||
if (strrpos($account, '@')) {
|
||||
list($account, $instance) = explode('@', $account, 2);
|
||||
[$account, $instance] = explode('@', $account, 2);
|
||||
}
|
||||
|
||||
if ($instance !== ''
|
||||
|
|
|
@ -48,7 +48,7 @@ class CacheDocumentService {
|
|||
IAppData $appData,
|
||||
CurlService $curlService,
|
||||
BlurService $blurService,
|
||||
ConfigService $configService
|
||||
ConfigService $configService,
|
||||
) {
|
||||
$this->appData = $appData;
|
||||
$this->curlService = $curlService;
|
||||
|
@ -243,7 +243,7 @@ class CacheDocumentService {
|
|||
|
||||
try {
|
||||
return $this->appData->getFolder($this->generatePath($filename))
|
||||
->getFile($filename);
|
||||
->getFile($filename);
|
||||
} catch (Exception $e) {
|
||||
throw new CacheContentException();
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ class CacheDocumentService {
|
|||
public function getFromUuid(string $uuid): ISimpleFile {
|
||||
try {
|
||||
return $this->appData->getFolder($this->generatePath($uuid))
|
||||
->getFile($uuid);
|
||||
->getFile($uuid);
|
||||
} catch (NotFoundException $e) {
|
||||
throw new NotFoundException('document not found');
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ class CheckService {
|
|||
IRequest $request, IURLGenerator $urlGenerator, FollowsRequest $followRequest,
|
||||
CacheActorsRequest $cacheActorsRequest, StreamDestRequest $streamDestRequest,
|
||||
StreamRequest $streamRequest, AccountService $accountService, ConfigService $configService,
|
||||
MiscService $miscService
|
||||
MiscService $miscService,
|
||||
) {
|
||||
$this->userManager = $userManager;
|
||||
$this->cache = $cache;
|
||||
|
@ -250,7 +250,7 @@ class CheckService {
|
|||
$options['verify'] = $this->config->getSystemValue('social.checkssl', true);
|
||||
|
||||
$response = $this->clientService->newClient()
|
||||
->get($url, $options);
|
||||
->get($url, $options);
|
||||
if ($response->getStatusCode() === Http::STATUS_OK) {
|
||||
$this->cache->set(self::CACHE_PREFIX . 'wellknown', 'true', 3600);
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ class ConfigService {
|
|||
|
||||
public function __construct(
|
||||
?string $userId, IConfig $config, IRequest $request, IURLGenerator $urlGenerator,
|
||||
MiscService $miscService
|
||||
MiscService $miscService,
|
||||
) {
|
||||
$this->userId = $userId;
|
||||
$this->config = $config;
|
||||
|
|
|
@ -58,7 +58,7 @@ class CurlService {
|
|||
public function __construct(
|
||||
ConfigService $configService,
|
||||
FediverseService $fediverseService,
|
||||
LoggerInterface $logger
|
||||
LoggerInterface $logger,
|
||||
) {
|
||||
$this->configService = $configService;
|
||||
$this->fediverseService = $fediverseService;
|
||||
|
@ -113,7 +113,7 @@ class CurlService {
|
|||
$this->logger->notice('webfingerAccount, request result', ['request' => $request]);
|
||||
|
||||
$subject = $this->get('subject', $result, '');
|
||||
list($type, $temp) = explode(':', $subject, 2);
|
||||
[$type, $temp] = explode(':', $subject, 2);
|
||||
if ($type === 'acct') {
|
||||
$account = $temp;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class DetailsService {
|
|||
*/
|
||||
public function __construct(
|
||||
StreamService $streamService, AccountService $accountService,
|
||||
FollowService $followService, CacheActorService $cacheActorService
|
||||
FollowService $followService, CacheActorService $cacheActorService,
|
||||
) {
|
||||
$this->streamService = $streamService;
|
||||
$this->accountService = $accountService;
|
||||
|
|
|
@ -71,7 +71,7 @@ class DocumentService {
|
|||
public function __construct(
|
||||
IUrlGenerator $urlGenerator, CacheDocumentsRequest $cacheDocumentsRequest,
|
||||
ActorsRequest $actorRequest, StreamRequest $streamRequest,
|
||||
CacheDocumentService $cacheService, ConfigService $configService, MiscService $miscService
|
||||
CacheDocumentService $cacheService, ConfigService $configService, MiscService $miscService,
|
||||
) {
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->cacheDocumentsRequest = $cacheDocumentsRequest;
|
||||
|
@ -187,7 +187,7 @@ class DocumentService {
|
|||
* @throws SocialAppConfigException
|
||||
*/
|
||||
public function getFromCache(
|
||||
string $id, string &$mimeType = '', bool $public = false
|
||||
string $id, string &$mimeType = '', bool $public = false,
|
||||
): ISimpleFile {
|
||||
$document = $this->cacheRemoteDocument($id, $public);
|
||||
$mimeType = $document->getMimeType();
|
||||
|
|
|
@ -31,7 +31,7 @@ class FediverseService {
|
|||
* @param MiscService $miscService
|
||||
*/
|
||||
public function __construct(
|
||||
ConfigService $configService, MiscService $miscService
|
||||
ConfigService $configService, MiscService $miscService,
|
||||
) {
|
||||
$this->configService = $configService;
|
||||
$this->miscService = $miscService;
|
||||
|
|
|
@ -66,7 +66,7 @@ class FollowService {
|
|||
ActivityService $activityService,
|
||||
CacheActorService $cacheActorService,
|
||||
ConfigService $configService,
|
||||
LoggerInterface $logger
|
||||
LoggerInterface $logger,
|
||||
) {
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->followsRequest = $followsRequest;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Ładowanie…
Reference in New Issue