Signed-off-by: Carl Schwan <carl@carlschwan.eu>
pull/1377/head
Carl Schwan 2022-04-15 13:34:01 +02:00
rodzic be80ca5d0f
commit 9e20993c4d
211 zmienionych plików z 4577 dodań i 2966 usunięć

Wyświetl plik

@ -0,0 +1,31 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
name: Lint
on:
pull_request:
push:
branches:
- master
- stable*
jobs:
xml-linters:
runs-on: ubuntu-latest
name: info.xml lint
steps:
- name: Checkout
uses: actions/checkout@master
- name: Download schema
run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd
- name: Lint info.xml
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: ./appinfo/info.xml
xml-schema-file: ./info.xsd

Wyświetl plik

@ -0,0 +1,36 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
name: Lint
on:
pull_request:
push:
branches:
- main
- master
- stable*
jobs:
lint:
runs-on: ubuntu-latest
name: php-cs
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
coverage: none
- name: Install dependencies
run: composer i
- name: Lint
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

48
.github/workflows/lint-php.yml vendored 100644
Wyświetl plik

@ -0,0 +1,48 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
name: Lint
on:
pull_request:
push:
branches:
- main
- master
- stable*
jobs:
php-lint:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["7.4", "8.0"]
name: php-lint
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Lint
run: composer run lint
summary:
runs-on: ubuntu-latest
needs: php-lint
if: always()
name: php-lint-summary
steps:
- name: Summary status
run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi

2
.gitignore vendored
Wyświetl plik

@ -6,3 +6,5 @@ img/twemoji/
cypress/screenshots cypress/screenshots
cypress/snapshots cypress/snapshots
.php-cs-fixer.cache

Wyświetl plik

@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
require_once './vendor/autoload.php';
use Nextcloud\CodingStandard\Config;
$config = new Config();
$config
->getFinder()
->notPath('build')
->notPath('l10n')
->notPath('src')
->notPath('vendor')
->in(__DIR__);
return $config;

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,19 +31,17 @@ declare(strict_types=1);
namespace OCA\Social\AppInfo; namespace OCA\Social\AppInfo;
use OCA\Social\Service\CurlService; use OCA\Social\Service\CurlService;
return [ return [
'routes' => [ 'routes' => [
['name' => 'Navigation#navigate', 'url' => '/', 'verb' => 'GET'], ['name' => 'Navigation#navigate', 'url' => '/', 'verb' => 'GET'],
['name' => 'Config#local', 'url' => '/local/', 'verb' => 'GET'], ['name' => 'Config#local', 'url' => '/local/', 'verb' => 'GET'],
['name' => 'Config#remote', 'url' => '/test/{account}/', 'verb' => 'GET'], ['name' => 'Config#remote', 'url' => '/test/{account}/', 'verb' => 'GET'],
[ [
'name' => 'Navigation#timeline', 'url' => '/timeline/{path}', 'verb' => 'GET', 'name' => 'Navigation#timeline', 'url' => '/timeline/{path}', 'verb' => 'GET',
'requirements' => ['path' => '.+'], 'requirements' => ['path' => '.+'],
'defaults' => ['path' => ''] 'defaults' => ['path' => '']
], ],
['name' => 'Navigation#documentGet', 'url' => '/document/get', 'verb' => 'GET'], ['name' => 'Navigation#documentGet', 'url' => '/document/get', 'verb' => 'GET'],
['name' => 'Navigation#documentGetPublic', 'url' => '/document/public', 'verb' => 'GET'], ['name' => 'Navigation#documentGetPublic', 'url' => '/document/public', 'verb' => 'GET'],

Wyświetl plik

@ -29,8 +29,20 @@
}, },
"require-dev": { "require-dev": {
"jakub-onderka/php-parallel-lint": "^1.0", "jakub-onderka/php-parallel-lint": "^1.0",
"phpunit/phpunit": "^6.4", "rector/rector": "^0.12.20",
"rector/rector": "^0.12.20" "phpunit/phpunit": "^9.5",
"nextcloud/coding-standard": "^1.0.0",
"christophwurst/nextcloud": "dev-master",
"vimeo/psalm": "^4.22.0"
},
"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",
"cs:fix": "php-cs-fixer fix",
"psalm": "psalm --threads=1",
"psalm:update-baseline": "psalm --threads=1 --update-baseline",
"psalm:clear": "psalm --clear-cache && psalm --clear-global-cache",
"psalm:fix": "psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType"
}, },
"repositories": [ "repositories": [
{ {

4085
composer.lock wygenerowano

Plik diff jest za duży Load Diff

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social; namespace OCA\Social;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OC; use OC;
use OCA\Social\Exceptions\ItemUnknownException; use OCA\Social\Exceptions\ItemUnknownException;
@ -85,19 +85,16 @@ use OCA\Social\Model\ActivityPub\Stream;
use OCA\Social\Service\ConfigService; use OCA\Social\Service\ConfigService;
use OCP\AppFramework\QueryException; use OCP\AppFramework\QueryException;
/** /**
* Class AP * Class AP
* *
* @package OCA\Social * @package OCA\Social
*/ */
class AP { class AP {
use TArrayTools; use TArrayTools;
const REDUNDANCY_LIMIT = 10; public const REDUNDANCY_LIMIT = 10;
/** @var AcceptInterface */ /** @var AcceptInterface */
@ -304,7 +301,6 @@ class AP {
* @throws SocialAppConfigException * @throws SocialAppConfigException
*/ */
public function getItemFromType(string $type): ACore { public function getItemFromType(string $type): ACore {
switch ($type) { switch ($type) {
case Accept::TYPE: case Accept::TYPE:
$item = new Accept(); $item = new Accept();
@ -525,9 +521,7 @@ class AP {
return (in_array($item->getType(), $types)); return (in_array($item->getType(), $types));
} }
} }
AP::init(); AP::init();

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\AppInfo; namespace OCA\Social\AppInfo;
use Closure; use Closure;
use OC\DB\SchemaWrapper; use OC\DB\SchemaWrapper;
use OCA\Social\Notification\Notifier; use OCA\Social\Notification\Notifier;
@ -55,7 +55,7 @@ require_once __DIR__ . '/../../vendor/autoload.php';
* @package OCA\Social\AppInfo * @package OCA\Social\AppInfo
*/ */
class Application extends App implements IBootstrap { class Application extends App implements IBootstrap {
const APP_NAME = 'social'; public const APP_NAME = 'social';
public function __construct(array $params = []) { public function __construct(array $params = []) {
parent::__construct(self::APP_NAME, $params); parent::__construct(self::APP_NAME, $params);
@ -113,6 +113,4 @@ class Application extends App implements IBootstrap {
$configService->setAppValue('update_checked', '0.3'); $configService->setAppValue('update_checked', '0.3');
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Command; namespace OCA\Social\Command;
use Exception; use Exception;
use OC\Core\Command\Base; use OC\Core\Command\Base;
use OCA\Social\Service\AccountService; use OCA\Social\Service\AccountService;
@ -43,7 +43,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
class AccountCreate extends Base { class AccountCreate extends Base {
private IUserManager $userManager; private IUserManager $userManager;
private AccountService $accountService; private AccountService $accountService;
@ -90,4 +89,3 @@ class AccountCreate extends Base {
$this->accountService->createActor($userId, $handle); $this->accountService->createActor($userId, $handle);
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Command; namespace OCA\Social\Command;
use Exception; use Exception;
use OC\Core\Command\Base; use OC\Core\Command\Base;
use OCA\Social\Service\AccountService; use OCA\Social\Service\AccountService;
@ -43,7 +43,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
class AccountFollowing extends Base { class AccountFollowing extends Base {
private AccountService $accountService; private AccountService $accountService;
private CacheActorService $cacheActorService; private CacheActorService $cacheActorService;
@ -93,6 +92,4 @@ class AccountFollowing extends Base {
$this->followService->followAccount($actor, $account); $this->followService->followAccount($actor, $account);
} }
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,19 +31,15 @@ declare(strict_types=1);
namespace OCA\Social\Command; namespace OCA\Social\Command;
use Exception; use Exception;
use OC\Core\Command\Base; use OC\Core\Command\Base;
use OCA\Social\Service\AccountService; use OCA\Social\Service\AccountService;
use OCA\Social\Service\CacheActorService; use OCA\Social\Service\CacheActorService;
use OCA\Social\Service\ConfigService;
use OCA\Social\Service\DocumentService; use OCA\Social\Service\DocumentService;
use OCA\Social\Service\HashtagService; use OCA\Social\Service\HashtagService;
use OCA\Social\Service\MiscService;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
class CacheRefresh extends Base { class CacheRefresh extends Base {
private AccountService $accountService; private AccountService $accountService;
private CacheActorService $cacheActorService; private CacheActorService $cacheActorService;
@ -71,7 +68,6 @@ class CacheRefresh extends Base {
* @throws Exception * @throws Exception
*/ */
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output) {
$result = $this->accountService->blindKeyRotation(); $result = $this->accountService->blindKeyRotation();
$output->writeLn($result . ' key pairs refreshed'); $output->writeLn($result . ' key pairs refreshed');
@ -91,4 +87,3 @@ class CacheRefresh extends Base {
$output->writeLn($result . ' hashtags updated'); $output->writeLn($result . ' hashtags updated');
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Command; namespace OCA\Social\Command;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use Exception; use Exception;
use OC\Core\Command\Base; use OC\Core\Command\Base;
@ -49,46 +49,19 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\ConfirmationQuestion;
class CheckInstall extends Base { class CheckInstall extends Base {
use TArrayTools; use TArrayTools;
private IUserManager $userManager; private IUserManager $userManager;
private StreamRequest $streamRequest; private StreamRequest $streamRequest;
private CacheActorService $cacheActorService; private CacheActorService $cacheActorService;
private StreamDestRequest $streamDestRequest; private StreamDestRequest $streamDestRequest;
private StreamTagsRequest $streamTagsRequest; private StreamTagsRequest $streamTagsRequest;
private CheckService $checkService; private CheckService $checkService;
private ConfigService $configService;
/** @var */
private $configService;
private PushService $pushService; private PushService $pushService;
private MiscService $miscService; private MiscService $miscService;
/**
* CacheUpdate constructor.
*
* @param IUserManager $userManager
* @param StreamRequest $streamRequest
* @param StreamDestRequest $streamDestRequest
* @param StreamTagsRequest $streamTagsRequest
* @param CacheActorService $cacheActorService
* @param CheckService $checkService
* @param ConfigService $configService
* @param PushService $pushService
* @param MiscService $miscService
*/
public function __construct( public function __construct(
IUserManager $userManager, StreamRequest $streamRequest, StreamDestRequest $streamDestRequest, IUserManager $userManager, StreamRequest $streamRequest, StreamDestRequest $streamDestRequest,
StreamTagsRequest $streamTagsRequest, CacheActorService $cacheActorService, StreamTagsRequest $streamTagsRequest, CacheActorService $cacheActorService,
@ -108,10 +81,6 @@ class CheckInstall extends Base {
$this->pushService = $pushService; $this->pushService = $pushService;
} }
/**
*
*/
protected function configure() { protected function configure() {
parent::configure(); parent::configure();
$this->setName('social:check:install') $this->setName('social:check:install')
@ -126,9 +95,6 @@ class CheckInstall extends Base {
/** /**
* @param InputInterface $input
* @param OutputInterface $output
*
* @throws Exception * @throws Exception
*/ */
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output) {
@ -150,7 +116,6 @@ class CheckInstall extends Base {
$output->writeln(json_encode($this->configService->getConfig(), JSON_PRETTY_PRINT)); $output->writeln(json_encode($this->configService->getConfig(), JSON_PRETTY_PRINT));
} }
/** /**
* @param InputInterface $input * @param InputInterface $input
* @param OutputInterface $output * @param OutputInterface $output
@ -210,10 +175,6 @@ class CheckInstall extends Base {
return true; return true;
} }
/**
* @param OutputInterface $output
*/
private function regenerateIndex(OutputInterface $output) { private function regenerateIndex(OutputInterface $output) {
$streams = $this->streamRequest->getAll(); $streams = $this->streamRequest->getAll();
$progressBar = new ProgressBar($output, count($streams)); $progressBar = new ProgressBar($output, count($streams));
@ -232,6 +193,4 @@ class CheckInstall extends Base {
$progressBar->finish(); $progressBar->finish();
$output->writeln(''); $output->writeln('');
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,7 +30,6 @@ declare(strict_types=1);
namespace OCA\Social\Command; namespace OCA\Social\Command;
use daita\MySmallPhpTools\Exceptions\CacheItemNotFoundException; use daita\MySmallPhpTools\Exceptions\CacheItemNotFoundException;
use OC\Core\Command\Base; use OC\Core\Command\Base;
use OCA\Social\AP; use OCA\Social\AP;
@ -41,18 +41,11 @@ use OCA\Social\Model\ActivityPub\Stream;
use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
class ExtendedBase extends Base { class ExtendedBase extends Base {
protected ?OutputInterface $output = null; protected ?OutputInterface $output = null;
protected bool $asJson = false; protected bool $asJson = false;
protected function outputActor(Person $actor): void {
/**
* @param Person $actor
*/
protected function outputActor(Person $actor) {
if ($this->asJson) { if ($this->asJson) {
$this->output->writeln(json_encode($actor, JSON_PRETTY_PRINT)); $this->output->writeln(json_encode($actor, JSON_PRETTY_PRINT));
} }
@ -60,7 +53,6 @@ class ExtendedBase extends Base {
$this->output->writeln('<info>Account</info>: ' . $actor->getAccount()); $this->output->writeln('<info>Account</info>: ' . $actor->getAccount());
$this->output->writeln('<info>Id</info>: ' . $actor->getId()); $this->output->writeln('<info>Id</info>: ' . $actor->getId());
$this->output->writeln(''); $this->output->writeln('');
} }
@ -128,5 +120,4 @@ class ExtendedBase extends Base {
); );
$this->output->writeln('type: <info>' . $stream->getType() . '</info>'); $this->output->writeln('type: <info>' . $stream->getType() . '</info>');
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,59 +31,29 @@ declare(strict_types=1);
namespace OCA\Social\Command; namespace OCA\Social\Command;
use Exception; use Exception;
use OC\Core\Command\Base; use OC\Core\Command\Base;
use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Exceptions\UnauthorizedFediverseException; use OCA\Social\Exceptions\UnauthorizedFediverseException;
use OCA\Social\Service\ConfigService;
use OCA\Social\Service\FediverseService; use OCA\Social\Service\FediverseService;
use OCA\Social\Service\MiscService;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
/** /**
* Class Fediverse * Class Fediverse
* *
* @package OCA\Social\Command * @package OCA\Social\Command
*/ */
class Fediverse extends Base { class Fediverse extends Base {
private FediverseService $fediverseService; private FediverseService $fediverseService;
private ConfigService $configService;
private MiscService $miscService;
private ?OutputInterface $output = null; private ?OutputInterface $output = null;
public function __construct(FediverseService $fediverseService) {
/**
* CacheUpdate constructor.
*
* @param FediverseService $fediverseService
* @param ConfigService $configService
* @param MiscService $miscService
*/
public function __construct(
FediverseService $fediverseService, ConfigService $configService,
MiscService $miscService
) {
parent::__construct(); parent::__construct();
$this->fediverseService = $fediverseService; $this->fediverseService = $fediverseService;
$this->configService = $configService;
$this->miscService = $miscService;
} }
/**
*
*/
protected function configure() { protected function configure() {
parent::configure(); parent::configure();
$this->setName('social:fediverse') $this->setName('social:fediverse')
@ -95,11 +66,7 @@ class Fediverse extends Base {
->setDescription('Allow or deny access to the fediverse'); ->setDescription('Allow or deny access to the fediverse');
} }
/** /**
* @param InputInterface $input
* @param OutputInterface $output
*
* @throws Exception * @throws Exception
*/ */
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output) {
@ -143,14 +110,10 @@ class Fediverse extends Base {
} }
} }
/** /**
* @param string $type
*
* @return bool
* @throws Exception * @throws Exception
*/ */
private function typeAccess(string $type) { private function typeAccess(string $type): bool {
if ($type === '') { if ($type === '') {
return false; return false;
} }
@ -160,12 +123,7 @@ class Fediverse extends Base {
return true; return true;
} }
private function listAddresses(bool $allKnownAddress = false): void {
/**
* @param bool $allKnownAddress
*/
private function listAddresses(bool $allKnownAddress = false) {
if ($allKnownAddress) { if ($allKnownAddress) {
$this->output->writeln('- Known address:'); $this->output->writeln('- Known address:');
foreach ($this->fediverseService->getKnownAddresses() as $address) { foreach ($this->fediverseService->getKnownAddresses() as $address) {
@ -177,35 +135,26 @@ class Fediverse extends Base {
foreach ($this->fediverseService->getListedAddresses() as $address) { foreach ($this->fediverseService->getListedAddresses() as $address) {
$this->output->writeln(' <info>' . $address . '</info>'); $this->output->writeln(' <info>' . $address . '</info>');
} }
} }
/** /**
* @param string $address
*
* @throws Exception * @throws Exception
*/ */
private function addAddress(string $address) { private function addAddress(string $address): void {
$this->fediverseService->addAddress($address); $this->fediverseService->addAddress($address);
$this->output->writeln('<info>' . $address . '</info> added to the list'); $this->output->writeln('<info>' . $address . '</info> added to the list');
} }
/** /**
* @param string $address
*
* @throws Exception * @throws Exception
*/ */
private function removeAddress(string $address) { private function removeAddress(string $address): void {
$this->fediverseService->removeAddress($address); $this->fediverseService->removeAddress($address);
$this->output->writeln('<info>' . $address . '</info> removed from the list'); $this->output->writeln('<info>' . $address . '</info> removed from the list');
} }
/** /**
* @param string $address
*
* @throws SocialAppConfigException * @throws SocialAppConfigException
*/ */
private function testAddress(string $address) { private function testAddress(string $address) {
@ -217,15 +166,8 @@ class Fediverse extends Base {
} }
} }
/**
*
*/
private function resetAddresses() { private function resetAddresses() {
$this->fediverseService->resetAddresses(); $this->fediverseService->resetAddresses();
$this->output->writeln('list is now empty'); $this->output->writeln('list is now empty');
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Command; namespace OCA\Social\Command;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use Exception; use Exception;
use OC\Core\Command\Base; use OC\Core\Command\Base;
@ -46,58 +46,47 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\ConfirmationQuestion;
class MigrateAlpha3 extends Base { class MigrateAlpha3 extends Base {
use TArrayTools; use TArrayTools;
private IDBConnection $dbConnection; private IDBConnection $dbConnection;
private CoreRequestBuilder $coreRequestBuilder; private CoreRequestBuilder $coreRequestBuilder;
private CheckService $checkService; private CheckService $checkService;
private ConfigService $configService; private ConfigService $configService;
private MiscService $miscService; private MiscService $miscService;
private array $done = []; private array $done = [];
public array $tables = [ public array $tables = [
'social_a2_actions' => [ 'social_a2_actions' => [
['id_prim'], ['id_prim'],
'social_3_action', 'social_3_action',
[ [
'actor_id_prim' => 'PRIM:actor_id', 'actor_id_prim' => 'PRIM:actor_id',
'object_id_prim' => 'PRIM:object_id' 'object_id_prim' => 'PRIM:object_id'
] ]
], ],
'social_a2_actors' => [['user_id'], 'social_3_actor', []], 'social_a2_actors' => [['user_id'], 'social_3_actor', []],
'social_a2_cache_actors' => [['id_prim'], 'social_3_cache_actor', []], 'social_a2_cache_actors' => [['id_prim'], 'social_3_cache_actor', []],
'social_a2_cache_documts' => [['id_prim'], 'social_3_cache_doc', []], 'social_a2_cache_documts' => [['id_prim'], 'social_3_cache_doc', []],
'social_a2_follows' => [ 'social_a2_follows' => [
['id_prim'], ['id_prim'],
'social_3_follow', 'social_3_follow',
[ [
'actor_id_prim' => 'PRIM:actor_id', 'actor_id_prim' => 'PRIM:actor_id',
'object_id_prim' => 'PRIM:object_id', 'object_id_prim' => 'PRIM:object_id',
'follow_id_prim' => 'PRIM:follow_id' 'follow_id_prim' => 'PRIM:follow_id'
] ]
], ],
'social_a2_hashtags' => [['hashtag'], 'social_3_hashtag', []], 'social_a2_hashtags' => [['hashtag'], 'social_3_hashtag', []],
'social_a2_request_queue' => [['id'], 'social_3_req_queue', []], 'social_a2_request_queue' => [['id'], 'social_3_req_queue', []],
'social_a2_stream' => [ 'social_a2_stream' => [
['id_prim'], ['id_prim'],
'social_3_stream', 'social_3_stream',
[ [
'object_id_prim' => 'PRIM:object_id', 'object_id_prim' => 'PRIM:object_id',
'in_reply_to_prim' => 'PRIM:in_reply_to', 'in_reply_to_prim' => 'PRIM:in_reply_to',
'attributed_to_prim' => 'PRIM:attributed_to', 'attributed_to_prim' => 'PRIM:attributed_to',
'filter_duplicate' => 'COPY:hidden_on_timeline', 'filter_duplicate' => 'COPY:hidden_on_timeline',
'hidden_on_timeline' => 'REMOVED:' 'hidden_on_timeline' => 'REMOVED:'
] ]
], ],
@ -105,24 +94,14 @@ class MigrateAlpha3 extends Base {
['id'], ['id'],
'social_3_stream_act', 'social_3_stream_act',
[ [
'actor_id_prim' => 'PRIM:actor_id', 'actor_id_prim' => 'PRIM:actor_id',
'stream_id_prim' => 'PRIM:stream_id', 'stream_id_prim' => 'PRIM:stream_id',
'_function_' => 'migrateTableStreamAction' '_function_' => 'migrateTableStreamAction'
] ]
], ],
'social_a2_stream_queue' => [['id'], 'social_3_stream_queue', []] 'social_a2_stream_queue' => [['id'], 'social_3_stream_queue', []]
]; ];
/**
* CacheUpdate constructor.
*
* @param IDBConnection $dbConnection
* @param CoreRequestBuilder $coreRequestBuilder
* @param CheckService $checkService
* @param ConfigService $configService
* @param MiscService $miscService
*/
public function __construct( public function __construct(
IDBConnection $dbConnection, CoreRequestBuilder $coreRequestBuilder, CheckService $checkService, IDBConnection $dbConnection, CoreRequestBuilder $coreRequestBuilder, CheckService $checkService,
ConfigService $configService, MiscService $miscService ConfigService $configService, MiscService $miscService
@ -135,10 +114,6 @@ class MigrateAlpha3 extends Base {
$this->miscService = $miscService; $this->miscService = $miscService;
} }
/**
*
*/
protected function configure() { protected function configure() {
parent::configure(); parent::configure();
$this->setName('social:migrate:alpha3') $this->setName('social:migrate:alpha3')
@ -153,9 +128,6 @@ class MigrateAlpha3 extends Base {
/** /**
* @param InputInterface $input
* @param OutputInterface $output
*
* @throws Exception * @throws Exception
*/ */
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output) {
@ -216,8 +188,6 @@ class MigrateAlpha3 extends Base {
/** /**
* @param InputInterface $input * @param InputInterface $input
* @param OutputInterface $output * @param OutputInterface $output
*
* @return bool
*/ */
private function confirmExecute(InputInterface $input, OutputInterface $output): bool { private function confirmExecute(InputInterface $input, OutputInterface $output): bool {
$helper = $this->getHelper('question'); $helper = $this->getHelper('question');
@ -234,11 +204,7 @@ class MigrateAlpha3 extends Base {
} }
/** private function migrateTables(OutputInterface $output, array $tables): void {
* @param OutputInterface $output
* @param array $tables
*/
private function migrateTables(OutputInterface $output, array $tables) {
foreach ($tables as $table) { foreach ($tables as $table) {
try { try {
$this->migrateTable($output, $table); $this->migrateTable($output, $table);
@ -250,15 +216,9 @@ class MigrateAlpha3 extends Base {
); );
} }
} }
} }
private function migrateTable(OutputInterface $output, string $table): void {
/**
* @param OutputInterface $output
* @param string $table
*/
private function migrateTable(OutputInterface $output, string $table) {
$output->writeln(''); $output->writeln('');
$output->writeln('Retrieving data from \'' . $table . '\'.'); $output->writeln('Retrieving data from \'' . $table . '\'.');
$fullContent = $this->getContentFromTable($table); $fullContent = $this->getContentFromTable($table);
@ -282,12 +242,6 @@ class MigrateAlpha3 extends Base {
$this->done[] = $table; $this->done[] = $table;
} }
/**
* @param string $table
*
* @return array
*/
private function getContentFromTable(string $table): array { private function getContentFromTable(string $table): array {
$qb = $this->dbConnection->getQueryBuilder(); $qb = $this->dbConnection->getQueryBuilder();
@ -304,13 +258,6 @@ class MigrateAlpha3 extends Base {
return $entries; return $entries;
} }
/**
* @param string $table
* @param $entry
*
* @return bool
*/
private function migrateEntry(string $table, $entry): bool { private function migrateEntry(string $table, $entry): bool {
if (!$this->checkUnique($table, $entry)) { if (!$this->checkUnique($table, $entry)) {
return false; return false;
@ -333,7 +280,7 @@ class MigrateAlpha3 extends Base {
if ($this->get($k, $entry, '') !== '') { if ($this->get($k, $entry, '') !== '') {
$this->manageDefault($qb, $this->get($k, $destDefault), $entry); $this->manageDefault($qb, $this->get($k, $destDefault), $entry);
$value = $entry[$k]; $value = $entry[$k];
} else if (array_key_exists($k, $destDefault)) { } elseif (array_key_exists($k, $destDefault)) {
$value = $this->manageDefault($qb, $destDefault[$k], $entry); $value = $this->manageDefault($qb, $destDefault[$k], $entry);
} }
} catch (Exception $e) { } catch (Exception $e) {
@ -354,13 +301,6 @@ class MigrateAlpha3 extends Base {
return true; return true;
} }
/**
* @param string $table
* @param $entry
*
* @return bool
*/
private function checkUnique(string $table, $entry): bool { private function checkUnique(string $table, $entry): bool {
list($unique, $destTable) = $this->tables[$table]; list($unique, $destTable) = $this->tables[$table];
@ -375,7 +315,7 @@ class MigrateAlpha3 extends Base {
} }
$qb->andWhere($andX); $qb->andWhere($andX);
$cursor = $qb->execute(); $cursor = $qb->executeQuery();
$data = $cursor->fetch(); $data = $cursor->fetch();
$cursor->closeCursor(); $cursor->closeCursor();
@ -388,10 +328,6 @@ class MigrateAlpha3 extends Base {
/** /**
* @param IQueryBuilder $qb
* @param string $default
* @param array $entry
*
* @return IParameter|string * @return IParameter|string
* @throws Exception * @throws Exception
*/ */
@ -423,11 +359,6 @@ class MigrateAlpha3 extends Base {
return ''; return '';
} }
/**
* @param InputInterface $input
* @param OutputInterface $output
*/
private function dropDeprecatedTables(InputInterface $input, OutputInterface $output) { private function dropDeprecatedTables(InputInterface $input, OutputInterface $output) {
$helper = $this->getHelper('question'); $helper = $this->getHelper('question');
$output->writeln(''); $output->writeln('');
@ -445,20 +376,11 @@ class MigrateAlpha3 extends Base {
} }
} }
private function dropTable(string $table): void {
/**
* @param string $table
*/
private function dropTable(string $table) {
$this->dbConnection->dropTable($table); $this->dbConnection->dropTable($table);
} }
public function migrateTableStreamAction(IQueryBuilder $qb, array $entry): void {
/**
* @param IQueryBuilder $qb
* @param array $entry
*/
public function migrateTableStreamAction(IQueryBuilder $qb, array $entry) {
$values = json_decode($entry['values'], true); $values = json_decode($entry['values'], true);
if ($values === null) { if ($values === null) {
return; return;
@ -470,6 +392,4 @@ class MigrateAlpha3 extends Base {
$qb->setValue('liked', $qb->createNamedParameter($liked)); $qb->setValue('liked', $qb->createNamedParameter($liked));
$qb->setValue('boosted', $qb->createNamedParameter($boosted)); $qb->setValue('boosted', $qb->createNamedParameter($boosted));
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Command; namespace OCA\Social\Command;
use Exception; use Exception;
use OC\Core\Command\Base; use OC\Core\Command\Base;
use OCA\Social\Service\AccountService; use OCA\Social\Service\AccountService;
@ -42,14 +42,12 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
/** /**
* Class NoteBoost * Class NoteBoost
* *
* @package OCA\Social\Command * @package OCA\Social\Command
*/ */
class NoteBoost extends Base { class NoteBoost extends Base {
private StreamService $streamService; private StreamService $streamService;
private AccountService $accountService; private AccountService $accountService;
@ -115,6 +113,4 @@ class NoteBoost extends Base {
echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n"; echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";
echo 'token: ' . $token . "\n"; echo 'token: ' . $token . "\n";
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Command; namespace OCA\Social\Command;
use Exception; use Exception;
use OC\Core\Command\Base; use OC\Core\Command\Base;
use OCA\Social\Model\Post; use OCA\Social\Model\Post;
@ -45,15 +45,12 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
/** /**
* Class NoteCreate * Class NoteCreate
* *
* @package OCA\Social\Command * @package OCA\Social\Command
*/ */
class NoteCreate extends Base { class NoteCreate extends Base {
private ConfigService $configService; private ConfigService $configService;
private ActivityService $activityService; private ActivityService $activityService;
@ -125,7 +122,6 @@ class NoteCreate extends Base {
* @throws Exception * @throws Exception
*/ */
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output) {
$userId = $input->getArgument('userid'); $userId = $input->getArgument('userid');
$content = $input->getArgument('content'); $content = $input->getArgument('content');
$to = $input->getOption('to'); $to = $input->getOption('to');
@ -146,6 +142,4 @@ class NoteCreate extends Base {
echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n"; echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";
echo 'token: ' . $token . "\n"; echo 'token: ' . $token . "\n";
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Command; namespace OCA\Social\Command;
use Exception; use Exception;
use OC\Core\Command\Base; use OC\Core\Command\Base;
use OCA\Social\Service\AccountService; use OCA\Social\Service\AccountService;
@ -42,15 +42,12 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
/** /**
* Class NoteLike * Class NoteLike
* *
* @package OCA\Social\Command * @package OCA\Social\Command
*/ */
class NoteLike extends Base { class NoteLike extends Base {
private StreamService $streamService; private StreamService $streamService;
private AccountService $accountService; private AccountService $accountService;
@ -116,6 +113,4 @@ class NoteLike extends Base {
echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n"; echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";
echo 'token: ' . $token . "\n"; echo 'token: ' . $token . "\n";
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Command; namespace OCA\Social\Command;
use OC\Core\Command\Base; use OC\Core\Command\Base;
use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Service\ActivityService; use OCA\Social\Service\ActivityService;
@ -41,10 +41,7 @@ use OCA\Social\Service\StreamQueueService;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
class QueueProcess extends Base { class QueueProcess extends Base {
private ActivityService $activityService; private ActivityService $activityService;
private StreamQueueService $streamQueueService; private StreamQueueService $streamQueueService;
@ -95,7 +92,6 @@ class QueueProcess extends Base {
* @param OutputInterface $output * @param OutputInterface $output
*/ */
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeLn('processing requests queue'); $output->writeLn('processing requests queue');
$this->processRequestQueue($output); $this->processRequestQueue($output);
@ -156,5 +152,4 @@ class QueueProcess extends Base {
$output->writeLn('done'); $output->writeLn('done');
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -39,10 +40,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
class QueueStatus extends Base { class QueueStatus extends Base {
private ConfigService $configService; private ConfigService $configService;
private RequestQueueService $requestQueueService; private RequestQueueService $requestQueueService;
@ -88,7 +86,6 @@ class QueueStatus extends Base {
* @throws Exception * @throws Exception
*/ */
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output) {
$token = $input->getOption('token'); $token = $input->getOption('token');
if ($token === null) { if ($token === null) {
@ -100,8 +97,5 @@ class QueueStatus extends Base {
foreach ($requests as $request) { foreach ($requests as $request) {
$output->writeLn(json_encode($request)); $output->writeLn(json_encode($request));
} }
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Command; namespace OCA\Social\Command;
use Exception; use Exception;
use OC\Core\Command\Base; use OC\Core\Command\Base;
use OCA\Social\Db\CoreRequestBuilder; use OCA\Social\Db\CoreRequestBuilder;
@ -43,10 +43,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Question\Question;
class Reset extends Base { class Reset extends Base {
private CoreRequestBuilder $coreRequestBuilder; private CoreRequestBuilder $coreRequestBuilder;
private CheckService $checkService; private CheckService $checkService;
@ -95,7 +92,6 @@ class Reset extends Base {
* @throws Exception * @throws Exception
*/ */
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output) {
$helper = $this->getHelper('question'); $helper = $this->getHelper('question');
$output->writeln( $output->writeln(
'<error>Beware, this operation will delete all content from the Social App.</error>' '<error>Beware, this operation will delete all content from the Social App.</error>'
@ -192,6 +188,4 @@ class Reset extends Base {
$this->configService->unsetCoreValue('public_host-meta-json'); $this->configService->unsetCoreValue('public_host-meta-json');
} }
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Command; namespace OCA\Social\Command;
use Exception; use Exception;
use OCA\Social\Exceptions\StreamNotFoundException; use OCA\Social\Exceptions\StreamNotFoundException;
use OCA\Social\Model\ActivityPub\Actor\Person; use OCA\Social\Model\ActivityPub\Actor\Person;
@ -43,15 +43,12 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
/** /**
* Class StreamDetails * Class StreamDetails
* *
* @package OCA\Social\Command * @package OCA\Social\Command
*/ */
class StreamDetails extends ExtendedBase { class StreamDetails extends ExtendedBase {
private StreamService $streamService; private StreamService $streamService;
private DetailsService $detailsService; private DetailsService $detailsService;
@ -121,14 +118,14 @@ class StreamDetails extends ExtendedBase {
$this->output->writeln('<comment>Affected Timelines</comment>:'); $this->output->writeln('<comment>Affected Timelines</comment>:');
$home = array_map( $home = array_map(
function(Person $item): string { function (Person $item): string {
return $item->getUserId(); return $item->getUserId();
}, $details->getHomeViewers() }, $details->getHomeViewers()
); );
$this->output->writeln('* <info>Home</info>: ' . json_encode($home, JSON_PRETTY_PRINT)); $this->output->writeln('* <info>Home</info>: ' . json_encode($home, JSON_PRETTY_PRINT));
$direct = array_map( $direct = array_map(
function(Person $item): string { function (Person $item): string {
return $item->getUserId(); return $item->getUserId();
}, $details->getDirectViewers() }, $details->getDirectViewers()
); );
@ -137,6 +134,4 @@ class StreamDetails extends ExtendedBase {
$this->output->writeln('* <info>Public</info>: ' . ($details->isPublic() ? 'true' : 'false')); $this->output->writeln('* <info>Public</info>: ' . ($details->isPublic() ? 'true' : 'false'));
$this->output->writeln('* <info>Federated</info>: ' . ($details->isFederated() ? 'true' : 'false')); $this->output->writeln('* <info>Federated</info>: ' . ($details->isFederated() ? 'true' : 'false'));
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Command; namespace OCA\Social\Command;
use Exception; use Exception;
use OCA\Social\Db\StreamRequest; use OCA\Social\Db\StreamRequest;
use OCA\Social\Model\ActivityPub\Actor\Person; use OCA\Social\Model\ActivityPub\Actor\Person;
@ -44,14 +44,12 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
/** /**
* Class Stream * Class Stream
* *
* @package OCA\Social\Command * @package OCA\Social\Command
*/ */
class Timeline extends ExtendedBase { class Timeline extends ExtendedBase {
private IUserManager $userManager; private IUserManager $userManager;
private StreamRequest $streamRequest; private StreamRequest $streamRequest;
@ -178,6 +176,4 @@ class Timeline extends ExtendedBase {
); );
} }
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,7 +30,6 @@ declare(strict_types=1);
namespace OCA\Social\Controller; namespace OCA\Social\Controller;
use daita\MySmallPhpTools\Traits\Nextcloud\nc20\TNC20Logger; use daita\MySmallPhpTools\Traits\Nextcloud\nc20\TNC20Logger;
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse; use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
use daita\MySmallPhpTools\Traits\TAsync; use daita\MySmallPhpTools\Traits\TAsync;
@ -59,55 +59,24 @@ use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\Response;
use OCP\IRequest; use OCP\IRequest;
class ActivityPubController extends Controller { class ActivityPubController extends Controller {
use TNCDataResponse; use TNCDataResponse;
use TStringTools; use TStringTools;
use TAsync; use TAsync;
use TNC20Logger; use TNC20Logger;
private SocialPubController $socialPubController; private SocialPubController $socialPubController;
private FediverseService $fediverseService; private FediverseService $fediverseService;
private CacheActorService $cacheActorService; private CacheActorService $cacheActorService;
private SignatureService $signatureService; private SignatureService $signatureService;
private StreamQueueService $streamQueueService; private StreamQueueService $streamQueueService;
private ImportService $importService; private ImportService $importService;
private AccountService $accountService; private AccountService $accountService;
private FollowService $followService; private FollowService $followService;
private StreamService $streamService; private StreamService $streamService;
private ConfigService $configService; private ConfigService $configService;
private MiscService $miscService; private MiscService $miscService;
/**
* ActivityPubController constructor.
*
* @param IRequest $request
* @param SocialPubController $socialPubController
* @param FediverseService $fediverseService
* @param CacheActorService $cacheActorService
* @param SignatureService $signatureService
* @param StreamQueueService $streamQueueService
* @param ImportService $importService
* @param AccountService $accountService
* @param FollowService $followService
* @param StreamService $streamService
* @param ConfigService $configService
* @param MiscService $miscService
*/
public function __construct( public function __construct(
IRequest $request, SocialPubController $socialPubController, FediverseService $fediverseService, IRequest $request, SocialPubController $socialPubController, FediverseService $fediverseService,
CacheActorService $cacheActorService, SignatureService $signatureService, CacheActorService $cacheActorService, SignatureService $signatureService,
@ -465,5 +434,3 @@ use TNC20Logger;
return substr($header, 0, $pos); return substr($header, 0, $pos);
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,7 +30,6 @@ declare(strict_types=1);
namespace OCA\Social\Controller; namespace OCA\Social\Controller;
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse; use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
use Exception; use Exception;
use OCA\Social\AppInfo\Application; use OCA\Social\AppInfo\Application;
@ -55,58 +55,27 @@ use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest; use OCP\IRequest;
use OCP\IUserSession; use OCP\IUserSession;
/** /**
* Class ApiController * Class ApiController
* *
* @package OCA\Social\Controller * @package OCA\Social\Controller
*/ */
class ApiController extends Controller { class ApiController extends Controller {
use TNCDataResponse; use TNCDataResponse;
private IUserSession $userSession; private IUserSession $userSession;
private InstanceService $instanceService; private InstanceService $instanceService;
private ClientService $clientService; private ClientService $clientService;
private AccountService $accountService; private AccountService $accountService;
private CacheActorService $cacheActorService; private CacheActorService $cacheActorService;
private FollowService $followService; private FollowService $followService;
private StreamService $streamService; private StreamService $streamService;
private ConfigService $configService; private ConfigService $configService;
private MiscService $miscService; private MiscService $miscService;
private string $bearer = ''; private string $bearer = '';
private ?SocialClient $client = null; private ?SocialClient $client = null;
private ?Person $viewer = null; private ?Person $viewer = null;
/**
* ActivityStreamController constructor.
*
* @param IRequest $request
* @param IUserSession $userSession
* @param InstanceService $instanceService
* @param ClientService $clientService
* @param AccountService $accountService
* @param CacheActorService $cacheActorService
* @param FollowService $followService
* @param StreamService $streamService
* @param ConfigService $configService
* @param MiscService $miscService
*/
public function __construct( public function __construct(
IRequest $request, IUserSession $userSession, InstanceService $instanceService, IRequest $request, IUserSession $userSession, InstanceService $instanceService,
ClientService $clientService, AccountService $accountService, CacheActorService $cacheActorService, ClientService $clientService, AccountService $accountService, CacheActorService $cacheActorService,
@ -148,14 +117,14 @@ class ApiController extends Controller {
if ($this->client === null) { if ($this->client === null) {
return new DataResponse( return new DataResponse(
[ [
'name' => 'Nextcloud Social', 'name' => 'Nextcloud Social',
'website' => 'https://github.com/nextcloud/social/' 'website' => 'https://github.com/nextcloud/social/'
], Http::STATUS_OK ], Http::STATUS_OK
); );
} else { } else {
return new DataResponse( return new DataResponse(
[ [
'name' => $this->client->getAppName(), 'name' => $this->client->getAppName(),
'website' => $this->client->getAppWebsite() 'website' => $this->client->getAppWebsite()
], Http::STATUS_OK ], Http::STATUS_OK
); );
@ -163,7 +132,6 @@ class ApiController extends Controller {
} catch (Exception $e) { } catch (Exception $e) {
return $this->error($e->getMessage()); return $this->error($e->getMessage());
} }
} }
@ -335,7 +303,4 @@ class ApiController extends Controller {
private function error(string $error): DataResponse { private function error(string $error): DataResponse {
return new DataResponse(['error' => $error], Http::STATUS_UNAUTHORIZED); return new DataResponse(['error' => $error], Http::STATUS_UNAUTHORIZED);
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
/** /**
@ -37,20 +38,13 @@ use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest; use OCP\IRequest;
class ConfigController extends Controller { class ConfigController extends Controller {
use TNCDataResponse; use TNCDataResponse;
private TestService $testService; private TestService $testService;
private ConfigService $configService; private ConfigService $configService;
private MiscService $miscService; private MiscService $miscService;
public function __construct( public function __construct(
string $appName, IRequest $request, TestService $testService, string $appName, IRequest $request, TestService $testService,
ConfigService $configService, MiscService $miscService ConfigService $configService, MiscService $miscService
@ -62,11 +56,6 @@ class ConfigController extends Controller {
$this->miscService = $miscService; $this->miscService = $miscService;
} }
/**
* @param string $cloudAddress
*
* @return DataResponse
*/
public function setCloudAddress(string $cloudAddress): DataResponse { public function setCloudAddress(string $cloudAddress): DataResponse {
$this->configService->setCloudUrl($cloudAddress); $this->configService->setCloudUrl($cloudAddress);
@ -79,8 +68,6 @@ class ConfigController extends Controller {
* *
* @NoCSRFRequired * @NoCSRFRequired
* @PublicPage * @PublicPage
*
* @return DataResponse
*/ */
public function local(): DataResponse { public function local(): DataResponse {
$setup = false; $setup = false;
@ -93,7 +80,7 @@ class ConfigController extends Controller {
return $this->success( return $this->success(
[ [
'version' => $this->configService->getAppValue('installed_version'), 'version' => $this->configService->getAppValue('installed_version'),
'setup' => $setup 'setup' => $setup
] ]
); );
} }
@ -104,10 +91,6 @@ class ConfigController extends Controller {
* *
* @NoCSRFRequired * @NoCSRFRequired
* @PublicPage * @PublicPage
*
* @param string $account
*
* @return DataResponse
*/ */
public function remote(string $account): DataResponse { public function remote(string $account): DataResponse {
if ($account === '' || $this->configService->getSystemValue('social.tests') === '') { if ($account === '' || $this->configService->getSystemValue('social.tests') === '') {
@ -122,7 +105,7 @@ class ConfigController extends Controller {
$tests = new SimpleDataStore( $tests = new SimpleDataStore(
[ [
'account' => $account, 'account' => $account,
'endpoint' => $this->configService->getSystemValue('social.tests') 'endpoint' => $this->configService->getSystemValue('social.tests')
] ]
); );
@ -134,6 +117,4 @@ class ConfigController extends Controller {
return $this->success([$tests]); return $this->success([$tests]);
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Controller; namespace OCA\Social\Controller;
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse; use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use Exception; use Exception;
@ -59,66 +59,31 @@ use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\Response;
use OCP\IRequest; use OCP\IRequest;
/** /**
* Class LocalController * Class LocalController
* *
* @package OCA\Social\Controller * @package OCA\Social\Controller
*/ */
class LocalController extends Controller { class LocalController extends Controller {
use TArrayTools; use TArrayTools;
use TNCDataResponse; use TNCDataResponse;
private ?string $userId = null;
private string $userId;
private CacheActorService $cacheActorService; private CacheActorService $cacheActorService;
private HashtagService $hashtagService; private HashtagService $hashtagService;
private FollowService $followService; private FollowService $followService;
private BoostService $boostService; private BoostService $boostService;
private LikeService $likeService; private LikeService $likeService;
private PostService $postService; private PostService $postService;
private StreamService $streamService; private StreamService $streamService;
private SearchService $searchService; private SearchService $searchService;
private AccountService $accountService; private AccountService $accountService;
private DocumentService $documentService; private DocumentService $documentService;
private MiscService $miscService; private MiscService $miscService;
private ?Person $viewer = null; private ?Person $viewer = null;
/**
* LocalController constructor.
*
* @param IRequest $request
* @param string $userId
* @param AccountService $accountService
* @param CacheActorService $cacheActorService
* @param HashtagService $hashtagService
* @param FollowService $followService
* @param PostService $postService
* @param StreamService $streamService
* @param SearchService $searchService
* @param BoostService $boostService
* @param LikeService $likeService
* @param DocumentService $documentService
* @param MiscService $miscService
*/
public function __construct( public function __construct(
IRequest $request, $userId, AccountService $accountService, CacheActorService $cacheActorService, IRequest $request, ?string $userId, AccountService $accountService, CacheActorService $cacheActorService,
HashtagService $hashtagService, HashtagService $hashtagService,
FollowService $followService, PostService $postService, StreamService $streamService, FollowService $followService, PostService $postService, StreamService $streamService,
SearchService $searchService, SearchService $searchService,
@ -146,10 +111,6 @@ class LocalController extends Controller {
* Create a new post. * Create a new post.
* *
* @NoAdminRequired * @NoAdminRequired
*
* @param array $data
*
* @return DataResponse
*/ */
public function postCreate(array $data): DataResponse { public function postCreate(array $data): DataResponse {
try { try {
@ -168,7 +129,7 @@ class LocalController extends Controller {
return $this->success( return $this->success(
[ [
'post' => $activity->getObject(), 'post' => $activity->getObject(),
'token' => $token 'token' => $token
] ]
); );
@ -179,15 +140,11 @@ class LocalController extends Controller {
/** /**
* get info about a post (limited to viewer rights). * Get info about a post (limited to viewer rights).
* *
* @NoAdminRequired * @NoAdminRequired
* @PublicPage * @PublicPage
* @NoCSRFRequired * @NoCSRFRequired
*
* @param string $id
*
* @return DataResponse
*/ */
public function postGet(string $id): DataResponse { public function postGet(string $id): DataResponse {
try { try {
@ -202,16 +159,10 @@ class LocalController extends Controller {
/** /**
* get replies about a post (limited to viewer rights). * Get replies about a post (limited to viewer rights).
* *
* @NoAdminRequired * @NoAdminRequired
* @NoCSRFRequired * @NoCSRFRequired
*
* @param string $id
* @param int $since
* @param int $limit
*
* @return DataResponse
*/ */
public function postReplies(string $id, int $since = 0, int $limit = 5): DataResponse { public function postReplies(string $id, int $since = 0, int $limit = 5): DataResponse {
try { try {
@ -254,10 +205,6 @@ class LocalController extends Controller {
* Create a new boost. * Create a new boost.
* *
* @NoAdminRequired * @NoAdminRequired
*
* @param string $postId
*
* @return DataResponse
*/ */
public function postBoost(string $postId): DataResponse { public function postBoost(string $postId): DataResponse {
try { try {
@ -280,10 +227,6 @@ class LocalController extends Controller {
* Delete a boost. * Delete a boost.
* *
* @NoAdminRequired * @NoAdminRequired
*
* @param string $postId
*
* @return DataResponse
*/ */
public function postUnboost(string $postId): DataResponse { public function postUnboost(string $postId): DataResponse {
try { try {
@ -306,10 +249,6 @@ class LocalController extends Controller {
* Like a post. * Like a post.
* *
* @NoAdminRequired * @NoAdminRequired
*
* @param string $postId
*
* @return DataResponse
*/ */
public function postLike(string $postId): DataResponse { public function postLike(string $postId): DataResponse {
try { try {
@ -318,7 +257,7 @@ class LocalController extends Controller {
return $this->success( return $this->success(
[ [
'like' => $announce, 'like' => $announce,
'token' => $token 'token' => $token
] ]
); );
@ -329,13 +268,9 @@ class LocalController extends Controller {
/** /**
* unlike a post. * Unlike a post.
* *
* @NoAdminRequired * @NoAdminRequired
*
* @param string $postId
*
* @return DataResponse
*/ */
public function postUnlike(string $postId): DataResponse { public function postUnlike(string $postId): DataResponse {
try { try {
@ -344,7 +279,7 @@ class LocalController extends Controller {
return $this->success( return $this->success(
[ [
'like' => $like, 'like' => $like,
'token' => $token 'token' => $token
] ]
); );
@ -357,13 +292,8 @@ class LocalController extends Controller {
/** /**
* @NoCSRFRequired * @NoCSRFRequired
* @NoAdminRequired * @NoAdminRequired
*
* @param int $since
* @param int $limit
*
* @return DataResponse
*/ */
public function streamHome($since = 0, int $limit = 5): DataResponse { public function streamHome(int $since = 0, int $limit = 5): DataResponse {
try { try {
$this->initViewer(true); $this->initViewer(true);
$posts = $this->streamService->getStreamHome($since, $limit); $posts = $this->streamService->getStreamHome($since, $limit);
@ -378,13 +308,8 @@ class LocalController extends Controller {
/** /**
* @NoCSRFRequired * @NoCSRFRequired
* @NoAdminRequired * @NoAdminRequired
*
* @param int $since
* @param int $limit
*
* @return DataResponse
*/ */
public function streamNotifications($since = 0, int $limit = 5): DataResponse { public function streamNotifications(int $since = 0, int $limit = 5): DataResponse {
try { try {
$this->initViewer(true); $this->initViewer(true);
$posts = $this->streamService->getStreamNotifications($since, $limit); $posts = $this->streamService->getStreamNotifications($since, $limit);
@ -399,14 +324,8 @@ class LocalController extends Controller {
/** /**
* @NoAdminRequired * @NoAdminRequired
* @PublicPage * @PublicPage
*
* @param string $username
* @param int $since
* @param int $limit
*
* @return DataResponse
*/ */
public function streamAccount(string $username, $since = 0, int $limit = 5): DataResponse { public function streamAccount(string $username, int $since = 0, int $limit = 5): DataResponse {
try { try {
$this->initViewer(); $this->initViewer();
@ -423,11 +342,6 @@ class LocalController extends Controller {
/** /**
* @NoAdminRequired * @NoAdminRequired
* @NoCSRFRequired * @NoCSRFRequired
*
* @param int $since
* @param int $limit
*
* @return DataResponse
*/ */
public function streamDirect(int $since = 0, int $limit = 5): DataResponse { public function streamDirect(int $since = 0, int $limit = 5): DataResponse {
try { try {
@ -446,11 +360,6 @@ class LocalController extends Controller {
* *
* @NoAdminRequired * @NoAdminRequired
* @NoCSRFRequired * @NoCSRFRequired
*
* @param int $since
* @param int $limit
*
* @return DataResponse
*/ */
public function streamTimeline(int $since = 0, int $limit = 5): DataResponse { public function streamTimeline(int $since = 0, int $limit = 5): DataResponse {
try { try {
@ -468,12 +377,6 @@ class LocalController extends Controller {
* Get timeline * Get timeline
* *
* @NoAdminRequired * @NoAdminRequired
*
* @param string $hashtag
* @param int $since
* @param int $limit
*
* @return DataResponse
*/ */
public function streamTag(string $hashtag, int $since = 0, int $limit = 5): DataResponse { public function streamTag(string $hashtag, int $since = 0, int $limit = 5): DataResponse {
try { try {
@ -491,11 +394,6 @@ class LocalController extends Controller {
* Get timeline * Get timeline
* *
* @NoAdminRequired * @NoAdminRequired
*
* @param int $since
* @param int $limit
*
* @return DataResponse
*/ */
public function streamFederated(int $since = 0, int $limit = 5): DataResponse { public function streamFederated(int $since = 0, int $limit = 5): DataResponse {
try { try {
@ -513,11 +411,6 @@ class LocalController extends Controller {
* Get liked post * Get liked post
* *
* @NoAdminRequired * @NoAdminRequired
*
* @param int $since
* @param int $limit
*
* @return DataResponse
*/ */
public function streamLiked(int $since = 0, int $limit = 5): DataResponse { public function streamLiked(int $since = 0, int $limit = 5): DataResponse {
try { try {
@ -533,10 +426,6 @@ class LocalController extends Controller {
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @param string $account
*
* @return DataResponse
*/ */
public function actionFollow(string $account): DataResponse { public function actionFollow(string $account): DataResponse {
try { try {
@ -553,10 +442,6 @@ class LocalController extends Controller {
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @param string $account
*
* @return DataResponse
*/ */
public function actionUnfollow(string $account): DataResponse { public function actionUnfollow(string $account): DataResponse {
try { try {
@ -590,8 +475,6 @@ class LocalController extends Controller {
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @return DataResponse
*/ */
public function currentFollowers(): DataResponse { public function currentFollowers(): DataResponse {
try { try {
@ -609,8 +492,6 @@ class LocalController extends Controller {
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @return DataResponse
*/ */
public function currentFollowing(): DataResponse { public function currentFollowing(): DataResponse {
try { try {
@ -629,10 +510,6 @@ class LocalController extends Controller {
/** /**
* @NoAdminRequired * @NoAdminRequired
* @PublicPage * @PublicPage
*
* @param string $username
*
* @return DataResponse
*/ */
public function accountInfo(string $username): DataResponse { public function accountInfo(string $username): DataResponse {
try { try {
@ -651,35 +528,8 @@ class LocalController extends Controller {
/** /**
* @NoAdminRequired * @NoAdminRequired
* @PublicPage * @PublicPage
*
* @param string $username
*
* @return DataResponse
*/
public function accountFollowers(string $username): DataResponse {
try {
$this->initViewer();
$actor = $this->cacheActorService->getFromLocalAccount($username);
$followers = $this->followService->getFollowers($actor);
return $this->success($followers);
} catch (Exception $e) {
return $this->fail($e);
}
}
/**
* @NoAdminRequired
* @PublicPage
*
* @param string $username
*
* @return DataResponse
*/ */
public function accountFollowing(string $username): DataResponse { public function accountFollowing(string $username): DataResponse {
try { try {
$this->initViewer(); $this->initViewer();
@ -695,10 +545,6 @@ class LocalController extends Controller {
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @param string $account
*
* @return DataResponse
*/ */
public function globalAccountInfo(string $account): DataResponse { public function globalAccountInfo(string $account): DataResponse {
try { try {
@ -715,10 +561,6 @@ class LocalController extends Controller {
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @param string $id
*
* @return DataResponse
*/ */
public function globalActorInfo(string $id): DataResponse { public function globalActorInfo(string $id): DataResponse {
try { try {
@ -735,10 +577,6 @@ class LocalController extends Controller {
* @NoCSRFRequired * @NoCSRFRequired
* @NoAdminRequired * @NoAdminRequired
* @PublicPage * @PublicPage
*
* @param string $id
*
* @return DataResponse
*/ */
public function globalActorAvatar(string $id): Response { public function globalActorAvatar(string $id): Response {
try { try {
@ -764,10 +602,6 @@ class LocalController extends Controller {
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @param string $search
*
* @return DataResponse
* @throws Exception * @throws Exception
*/ */
public function globalAccountsSearch(string $search): DataResponse { public function globalAccountsSearch(string $search): DataResponse {
@ -801,10 +635,6 @@ class LocalController extends Controller {
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @param string $search
*
* @return DataResponse
* @throws Exception * @throws Exception
*/ */
public function globalTagsSearch(string $search): DataResponse { public function globalTagsSearch(string $search): DataResponse {
@ -834,14 +664,10 @@ class LocalController extends Controller {
} }
/** // TODO - remove this tag /**
* * TODO - remove this tag
* @NoCSRFRequired * @NoCSRFRequired
* @NoAdminRequired * @NoAdminRequired
*
* @param string $search
*
* @return DataResponse
* @throws Exception * @throws Exception
*/ */
public function search(string $search): DataResponse { public function search(string $search): DataResponse {
@ -851,7 +677,7 @@ class LocalController extends Controller {
$result = [ $result = [
'accounts' => $this->searchService->searchAccounts($search), 'accounts' => $this->searchService->searchAccounts($search),
'hashtags' => $this->searchService->searchHashtags($search), 'hashtags' => $this->searchService->searchHashtags($search),
'content' => $this->searchService->searchStreamContent($search) 'content' => $this->searchService->searchStreamContent($search)
]; ];
return $this->success($result); return $this->success($result);
@ -860,10 +686,6 @@ class LocalController extends Controller {
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @param array $documents
*
* @return DataResponse
*/ */
public function documentsCache(array $documents): DataResponse { public function documentsCache(array $documents): DataResponse {
try { try {
@ -884,9 +706,6 @@ class LocalController extends Controller {
/** /**
*
* @param bool $exception
*
* @throws AccountDoesNotExistException * @throws AccountDoesNotExistException
*/ */
private function initViewer(bool $exception = false) { private function initViewer(bool $exception = false) {
@ -912,6 +731,4 @@ class LocalController extends Controller {
} }
} }
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Controller; namespace OCA\Social\Controller;
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse; use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use Exception; use Exception;
@ -56,7 +56,6 @@ use OCP\IL10N;
use OCP\IRequest; use OCP\IRequest;
use OCP\IURLGenerator; use OCP\IURLGenerator;
/** /**
* Class NavigationController * Class NavigationController
* *
@ -116,12 +115,12 @@ class NavigationController extends Controller {
*/ */
public function navigate(string $path = ''): TemplateResponse { public function navigate(string $path = ''): TemplateResponse {
$serverData = [ $serverData = [
'public' => false, 'public' => false,
'firstrun' => false, 'firstrun' => false,
'setup' => false, 'setup' => false,
'isAdmin' => OC::$server->getGroupManager() 'isAdmin' => OC::$server->getGroupManager()
->isAdmin($this->userId), ->isAdmin($this->userId),
'cliUrl' => $this->getCliUrl() 'cliUrl' => $this->getCliUrl()
]; ];
try { try {
@ -250,7 +249,6 @@ class NavigationController extends Controller {
$file = $this->documentService->getFromCache($id, $mime); $file = $this->documentService->getFromCache($id, $mime);
return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $mime]); return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $mime]);
} catch (Exception $e) { } catch (Exception $e) {
return $this->fail($e); return $this->fail($e);
} }
@ -266,7 +264,6 @@ class NavigationController extends Controller {
* @return Response * @return Response
*/ */
public function documentGetPublic(string $id): Response { public function documentGetPublic(string $id): Response {
try { try {
$mime = ''; $mime = '';
$file = $this->documentService->getFromCache($id, $mime, true); $file = $this->documentService->getFromCache($id, $mime, true);
@ -287,7 +284,6 @@ class NavigationController extends Controller {
* @return Response * @return Response
*/ */
public function resizedGet(string $id): Response { public function resizedGet(string $id): Response {
try { try {
$mime = ''; $mime = '';
$file = $this->documentService->getResizedFromCache($id, $mime); $file = $this->documentService->getResizedFromCache($id, $mime);
@ -308,7 +304,6 @@ class NavigationController extends Controller {
* @return Response * @return Response
*/ */
public function resizedGetPublic(string $id): Response { public function resizedGetPublic(string $id): Response {
try { try {
$mime = ''; $mime = '';
$file = $this->documentService->getResizedFromCache($id, $mime, true); $file = $this->documentService->getResizedFromCache($id, $mime, true);
@ -318,6 +313,4 @@ class NavigationController extends Controller {
return $this->fail($e); return $this->fail($e);
} }
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,7 +30,6 @@ declare(strict_types=1);
namespace OCA\Social\Controller; namespace OCA\Social\Controller;
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse; use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
use Exception; use Exception;
use OCA\Social\AppInfo\Application; use OCA\Social\AppInfo\Application;
@ -51,43 +51,18 @@ use OCP\IRequest;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use OCP\IUserSession; use OCP\IUserSession;
class OAuthController extends Controller { class OAuthController extends Controller {
use TNCDataResponse; use TNCDataResponse;
private IUserSession $userSession; private IUserSession $userSession;
private IURLGenerator $urlGenerator; private IURLGenerator $urlGenerator;
private InstanceService $instanceService; private InstanceService $instanceService;
private AccountService $accountService; private AccountService $accountService;
private CacheActorService $cacheActorService; private CacheActorService $cacheActorService;
private ClientService $clientService; private ClientService $clientService;
private ConfigService $configService; private ConfigService $configService;
private MiscService $miscService; private MiscService $miscService;
/**
* ActivityStreamController constructor.
*
* @param IRequest $request
* @param IUserSession $userSession
* @param IURLGenerator $urlGenerator
* @param InstanceService $instanceService
* @param AccountService $accountService
* @param CacheActorService $cacheActorService
* @param ClientService $clientService
* @param ConfigService $configService
* @param MiscService $miscService
*/
public function __construct( public function __construct(
IRequest $request, IUserSession $userSession, IURLGenerator $urlGenerator, IRequest $request, IUserSession $userSession, IURLGenerator $urlGenerator,
InstanceService $instanceService, AccountService $accountService, InstanceService $instanceService, AccountService $accountService,
@ -113,13 +88,11 @@ class OAuthController extends Controller {
/** /**
* @NoCSRFRequired * @NoCSRFRequired
* @PublicPage * @PublicPage
*
* @return Response
*/ */
public function nodeinfo(): Response { public function nodeinfo(): DataResponse {
$nodeInfo = [ $nodeInfo = [
'links' => [ 'links' => [
'rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0', 'rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0',
'href' => $this->urlGenerator->linkToRouteAbsolute('social.OAuth.nodeinfo2') 'href' => $this->urlGenerator->linkToRouteAbsolute('social.OAuth.nodeinfo2')
] ]
]; ];
@ -131,10 +104,8 @@ class OAuthController extends Controller {
/** /**
* @NoCSRFRequired * @NoCSRFRequired
* @PublicPage * @PublicPage
*
* @return Response
*/ */
public function nodeinfo2() { public function nodeinfo2(): Response {
try { try {
$local = $this->instanceService->getLocal(); $local = $this->instanceService->getLocal();
$name = $local->getTitle(); $name = $local->getTitle();
@ -150,15 +121,15 @@ class OAuthController extends Controller {
} }
$nodeInfo = [ $nodeInfo = [
"version" => "2.0", "version" => "2.0",
"software" => [ "software" => [
"name" => $name, "name" => $name,
"version" => $version "version" => $version
], ],
"protocols" => [ "protocols" => [
"activitypub" "activitypub"
], ],
"usage" => $usage, "usage" => $usage,
"openRegistrations" => $openReg "openRegistrations" => $openReg
]; ];
@ -169,18 +140,11 @@ class OAuthController extends Controller {
/** /**
* @NoCSRFRequired * @NoCSRFRequired
* @PublicPage * @PublicPage
*
* @param string $website
* @param string $redirect_uris
* @param string $scopes
* @param string $client_name
*
* @return Response
* @throws ClientException * @throws ClientException
*/ */
public function apps( public function apps(
string $client_name = '', string $redirect_uris = '', string $website = '', string $scopes = 'read' string $client_name = '', string $redirect_uris = '', string $website = '', string $scopes = 'read'
): Response { ): DataResponse {
// TODO: manage array from request // TODO: manage array from request
if (!is_array($redirect_uris)) { if (!is_array($redirect_uris)) {
$redirect_uris = [$redirect_uris]; $redirect_uris = [$redirect_uris];
@ -196,11 +160,11 @@ class OAuthController extends Controller {
return new DataResponse( return new DataResponse(
[ [
'id' => $client->getId(), 'id' => $client->getId(),
'name' => $client->getAppName(), 'name' => $client->getAppName(),
'website' => $client->getAppWebsite(), 'website' => $client->getAppWebsite(),
'scopes' => implode(' ', $client->getAppScopes()), 'scopes' => implode(' ', $client->getAppScopes()),
'client_id' => $client->getAppClientId(), 'client_id' => $client->getAppClientId(),
'client_secret' => $client->getAppClientSecret() 'client_secret' => $client->getAppClientSecret()
], Http::STATUS_OK ], Http::STATUS_OK
); );
@ -210,13 +174,6 @@ class OAuthController extends Controller {
/** /**
* @NoCSRFRequired * @NoCSRFRequired
* @NoAdminRequired * @NoAdminRequired
*
* @param string $client_id
* @param string $redirect_uri
* @param string $response_type
* @param string $scope
*
* @return DataResponse
*/ */
public function authorize( public function authorize(
string $client_id, string $redirect_uri, string $response_type, string $scope = 'read' string $client_id, string $redirect_uri, string $response_type, string $scope = 'read'
@ -253,10 +210,10 @@ class OAuthController extends Controller {
// TODO : finalize result if no redirect_url // TODO : finalize result if no redirect_url
return new DataResponse( return new DataResponse(
[ [
// 'access_token' => '', // 'access_token' => '',
// "token_type" => "Bearer", // "token_type" => "Bearer",
// "scope" => "read write follow push", // "scope" => "read write follow push",
// "created_at" => 1573979017 // "created_at" => 1573979017
], Http::STATUS_OK ], Http::STATUS_OK
); );
} catch (Exception $e) { } catch (Exception $e) {
@ -270,28 +227,19 @@ class OAuthController extends Controller {
* @NoCSRFRequired * @NoCSRFRequired
* @NoAdminRequired * @NoAdminRequired
* @PublicPage * @PublicPage
*
* @param string $client_id
* @param string $client_secret
* @param string $redirect_uri
* @param string $grant_type
* @param string $scope
* @param string $code
*
* @return DataResponse
*/ */
public function token( public function token(
string $client_id, string $client_secret, string $redirect_uri, string $grant_type, string $client_id, string $client_secret, string $redirect_uri, string $grant_type,
string $scope = 'read', string $code = '' string $scope = 'read', string $code = ''
) { ): DataResponse {
try { try {
$client = $this->clientService->getFromClientId($client_id); $client = $this->clientService->getFromClientId($client_id);
$this->clientService->confirmData( $this->clientService->confirmData(
$client, $client,
[ [
'client_secret' => $client_secret, 'client_secret' => $client_secret,
'redirect_uri' => $redirect_uri, 'redirect_uri' => $redirect_uri,
'auth_scopes' => $scope 'auth_scopes' => $scope
] ]
); );
@ -302,7 +250,7 @@ class OAuthController extends Controller {
$this->clientService->confirmData($client, ['code' => $code]); $this->clientService->confirmData($client, ['code' => $code]);
$this->clientService->generateToken($client); $this->clientService->generateToken($client);
} else if ($grant_type === 'client_credentials') { } elseif ($grant_type === 'client_credentials') {
// TODO: manage client_credentials // TODO: manage client_credentials
} else { } else {
return new DataResponse( return new DataResponse(
@ -319,9 +267,9 @@ class OAuthController extends Controller {
return new DataResponse( return new DataResponse(
[ [
"access_token" => $client->getToken(), "access_token" => $client->getToken(),
"token_type" => 'Bearer', "token_type" => 'Bearer',
"scope" => $scope, "scope" => $scope,
"created_at" => $client->getCreation() "created_at" => $client->getCreation()
], Http::STATUS_OK ], Http::STATUS_OK
); );
} catch (ClientNotFoundException $e) { } catch (ClientNotFoundException $e) {
@ -330,6 +278,4 @@ class OAuthController extends Controller {
return new DataResponse(['error' => $e->getMessage()], Http::STATUS_UNAUTHORIZED); return new DataResponse(['error' => $e->getMessage()], Http::STATUS_UNAUTHORIZED);
} }
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Controller; namespace OCA\Social\Controller;
use daita\MySmallPhpTools\Exceptions\ArrayNotFoundException; use daita\MySmallPhpTools\Exceptions\ArrayNotFoundException;
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse; use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
@ -47,40 +47,19 @@ use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\TemplateResponse;
use OCP\IInitialStateService; use OCP\IInitialStateService;
use OCP\IRequest; use OCP\IRequest;
use OCP\IUserManager;
use OCP\IUserSession; use OCP\IUserSession;
class OStatusController extends Controller { class OStatusController extends Controller {
use TNCDataResponse; use TNCDataResponse;
use TArrayTools; use TArrayTools;
private CacheActorService $cacheActorService; private CacheActorService $cacheActorService;
private AccountService $accountService; private AccountService $accountService;
private CurlService $curlService; private CurlService $curlService;
private MiscService $miscService; private MiscService $miscService;
private IUserSession $userSession;
private IUserManager $userSession;
private IInitialStateService $initialStateService; private IInitialStateService $initialStateService;
/**
* OStatusController constructor.
*
* @param IRequest $request
* @param IInitialStateService $initialStateService
* @param CacheActorService $cacheActorService
* @param AccountService $accountService
* @param CurlService $curlService
* @param MiscService $miscService
* @param IUserSession $userSession
*/
public function __construct( public function __construct(
IRequest $request, IInitialStateService $initialStateService, CacheActorService $cacheActorService, AccountService $accountService, IRequest $request, IInitialStateService $initialStateService, CacheActorService $cacheActorService, AccountService $accountService,
CurlService $curlService, MiscService $miscService, IUserSession $userSession CurlService $curlService, MiscService $miscService, IUserSession $userSession
@ -99,14 +78,9 @@ class OStatusController extends Controller {
/** /**
* @NoCSRFRequired * @NoCSRFRequired
* @NoAdminRequired * @NoAdminRequired
*
* @param string $uri
*
* @return Response
*/ */
public function subscribe(string $uri): Response { public function subscribe(string $uri): Response {
try { try {
try { try {
$actor = $this->cacheActorService->getFromAccount($uri); $actor = $this->cacheActorService->getFromAccount($uri);
} catch (InvalidResourceException $e) { } catch (InvalidResourceException $e) {
@ -138,10 +112,6 @@ class OStatusController extends Controller {
* @NoCSRFRequired * @NoCSRFRequired
* @NoAdminRequired * @NoAdminRequired
* @PublicPage * @PublicPage
*
* @param string $local
*
* @return Response
*/ */
public function followRemote(string $local): Response { public function followRemote(string $local): Response {
try { try {
@ -163,14 +133,8 @@ class OStatusController extends Controller {
* @NoCSRFRequired * @NoCSRFRequired
* @NoAdminRequired * @NoAdminRequired
* @PublicPage * @PublicPage
*
* @param string $local
* @param string $account
*
* @return Response
*/ */
public function getLink(string $local, string $account): Response { public function getLink(string $local, string $account): Response {
try { try {
$following = $this->accountService->getActor($local); $following = $this->accountService->getActor($local);
$result = $this->curlService->webfingerAccount($account); $result = $this->curlService->webfingerAccount($account);
@ -192,6 +156,4 @@ class OStatusController extends Controller {
return $this->fail($e); return $this->fail($e);
} }
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,7 +30,6 @@ declare(strict_types=1);
namespace OCA\Social\Controller; namespace OCA\Social\Controller;
use daita\MySmallPhpTools\Traits\TAsync; use daita\MySmallPhpTools\Traits\TAsync;
use OCA\Social\AppInfo\Application; use OCA\Social\AppInfo\Application;
use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Exceptions\SocialAppConfigException;
@ -40,32 +40,18 @@ use OCA\Social\Service\RequestQueueService;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\IRequest; use OCP\IRequest;
/** /**
* Class QueueController * Class QueueController
* *
* @package OCA\Social\Controller * @package OCA\Social\Controller
*/ */
class QueueController extends Controller { class QueueController extends Controller {
use TAsync; use TAsync;
private RequestQueueService $requestQueueService; private RequestQueueService $requestQueueService;
private ActivityService $activityService; private ActivityService $activityService;
private MiscService $miscService; private MiscService $miscService;
/**
* QueueController constructor.
*
* @param IRequest $request
* @param RequestQueueService $requestQueueService
* @param ActivityService $activityService
* @param MiscService $miscService
*/
public function __construct( public function __construct(
IRequest $request, RequestQueueService $requestQueueService, ActivityService $activityService, IRequest $request, RequestQueueService $requestQueueService, ActivityService $activityService,
MiscService $miscService MiscService $miscService
@ -81,8 +67,6 @@ class QueueController extends Controller {
/** /**
* @PublicPage * @PublicPage
* @NoCSRFRequired * @NoCSRFRequired
*
* @param string $token
*/ */
public function asyncForRequest(string $token) { public function asyncForRequest(string $token) {
$requests = $this->requestQueueService->getRequestFromToken($token, RequestQueue::STATUS_STANDBY); $requests = $this->requestQueueService->getRequestFromToken($token, RequestQueue::STATUS_STANDBY);
@ -102,6 +86,4 @@ class QueueController extends Controller {
// or it will feed the logs. // or it will feed the logs.
exit(); exit();
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Controller; namespace OCA\Social\Controller;
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse; use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
use Exception; use Exception;
use OCA\Social\AppInfo\Application; use OCA\Social\AppInfo\Application;
@ -39,7 +39,6 @@ use OCA\Social\Exceptions\CacheActorDoesNotExistException;
use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Exceptions\StreamNotFoundException; use OCA\Social\Exceptions\StreamNotFoundException;
use OCA\Social\Exceptions\UrlCloudException; use OCA\Social\Exceptions\UrlCloudException;
use OCA\Social\Model\ActivityPub\Actor\Person;
use OCA\Social\Service\AccountService; use OCA\Social\Service\AccountService;
use OCA\Social\Service\CacheActorService; use OCA\Social\Service\CacheActorService;
use OCA\Social\Service\ConfigService; use OCA\Social\Service\ConfigService;
@ -53,47 +52,24 @@ use OCP\IInitialStateService;
use OCP\IL10N; use OCP\IL10N;
use OCP\IRequest; use OCP\IRequest;
/** /**
* Class SocialPubController * Class SocialPubController
* *
* @package OCA\Social\Controller * @package OCA\Social\Controller
*/ */
class SocialPubController extends Controller { class SocialPubController extends Controller {
use TNCDataResponse; use TNCDataResponse;
private ?string $userId = null;
private string $userId;
private IL10N $l10n; private IL10N $l10n;
private NavigationController $navigationController; private NavigationController $navigationController;
private AccountService $accountService; private AccountService $accountService;
private CacheActorService $cacheActorService; private CacheActorService $cacheActorService;
private StreamService $streamService; private StreamService $streamService;
private ConfigService $configService; private ConfigService $configService;
/**
* SocialPubController constructor.
*
* @param $userId
* @param IRequest $request
* @param IL10N $l10n
* @param NavigationController $navigationController
* @param CacheActorService $cacheActorService
* @param AccountService $accountService
* @param StreamService $streamService
* @param ConfigService $configService
*/
public function __construct( public function __construct(
$userId, IInitialStateService $initialStateService, IRequest $request, IL10N $l10n, NavigationController $navigationController, ?string $userId, IInitialStateService $initialStateService, IRequest $request, IL10N $l10n, NavigationController $navigationController,
CacheActorService $cacheActorService, AccountService $accountService, StreamService $streamService, CacheActorService $cacheActorService, AccountService $accountService, StreamService $streamService,
ConfigService $configService ConfigService $configService
) { ) {
@ -111,13 +87,10 @@ class SocialPubController extends Controller {
/** /**
* @param $username
*
* @return Response
* @throws UrlCloudException * @throws UrlCloudException
* @throws SocialAppConfigException * @throws SocialAppConfigException
*/ */
private function renderPage($username): Response { private function renderPage(string $username): Response {
if ($this->userId) { if ($this->userId) {
return $this->navigationController->navigate(''); return $this->navigationController->navigate('');
} }
@ -148,15 +121,12 @@ class SocialPubController extends Controller {
/** /**
* return webpage content for human navigation. * Return webpage content for human navigation.
* Should return information about a Social account, based on username. * Should return information about a Social account, based on username.
* *
* @NoCSRFRequired * @NoCSRFRequired
* @PublicPage * @PublicPage
* *
* @param string $username
*
* @return Response
* @throws UrlCloudException * @throws UrlCloudException
* @throws SocialAppConfigException * @throws SocialAppConfigException
*/ */
@ -166,15 +136,11 @@ class SocialPubController extends Controller {
/** /**
* return webpage content for human navigation. * Return webpage content for human navigation.
* Should return followers of a Social account, based on username. * Should return followers of a Social account, based on username.
* *
* @NoCSRFRequired * @NoCSRFRequired
* @PublicPage * @PublicPage
*
* @param string $username
*
* @return TemplateResponse
* @throws UrlCloudException * @throws UrlCloudException
* @throws SocialAppConfigException * @throws SocialAppConfigException
*/ */
@ -184,15 +150,11 @@ class SocialPubController extends Controller {
/** /**
* return webpage content for human navigation. * Return webpage content for human navigation.
* Should return following of a Social account, based on username. * Should return following of a Social account, based on username.
* *
* @NoCSRFRequired * @NoCSRFRequired
* @PublicPage * @PublicPage
*
* @param string $username
*
* @return TemplateResponse
* @throws UrlCloudException * @throws UrlCloudException
* @throws SocialAppConfigException * @throws SocialAppConfigException
*/ */
@ -206,11 +168,6 @@ class SocialPubController extends Controller {
* *
* @NoCSRFRequired * @NoCSRFRequired
* @PublicPage * @PublicPage
*
* @param string $username
* @param string $token
*
* @return TemplateResponse
* @throws SocialAppConfigException * @throws SocialAppConfigException
* @throws StreamNotFoundException * @throws StreamNotFoundException
*/ */
@ -225,17 +182,14 @@ class SocialPubController extends Controller {
$stream = $this->streamService->getStreamById($postId, true); $stream = $this->streamService->getStreamById($postId, true);
$data = [ $data = [
'id' => $postId, 'id' => $postId,
'application' => 'Social' 'application' => 'Social'
]; ];
$this->initialStateService->provideInitialState(Application::APP_NAME, 'item', $stream ); $this->initialStateService->provideInitialState(Application::APP_NAME, 'item', $stream);
$this->initialStateService->provideInitialState(Application::APP_NAME, 'serverData', [ $this->initialStateService->provideInitialState(Application::APP_NAME, 'serverData', [
'public' => ($this->userId === null), 'public' => ($this->userId === null),
]); ]);
return new TemplateResponse(Application::APP_NAME, 'main', $data); return new TemplateResponse(Application::APP_NAME, 'main', $data);
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,9 +31,9 @@ declare(strict_types=1);
namespace OCA\Social\Cron; namespace OCA\Social\Cron;
use Exception; use Exception;
use OC\BackgroundJob\TimedJob; use OC\AppFramework\Utility\TimeFactory;
use OCP\BackgroundJob\TimedJob;
use OCA\Social\AppInfo\Application; use OCA\Social\AppInfo\Application;
use OCA\Social\Service\AccountService; use OCA\Social\Service\AccountService;
use OCA\Social\Service\CacheActorService; use OCA\Social\Service\CacheActorService;
@ -40,28 +41,19 @@ use OCA\Social\Service\DocumentService;
use OCA\Social\Service\HashtagService; use OCA\Social\Service\HashtagService;
use OCP\AppFramework\QueryException; use OCP\AppFramework\QueryException;
/** /**
* Class Cache * Class Cache
* *
* @package OCA\Social\Cron * @package OCA\Social\Cron
*/ */
class Cache extends TimedJob { class Cache extends TimedJob {
private ?AccountService $accountService = null; private ?AccountService $accountService = null;
private ?CacheActorService $cacheActorService = null; private ?CacheActorService $cacheActorService = null;
private ?DocumentService $documentService = null; private ?DocumentService $documentService = null;
private ?HashtagService $hashtagService = null; private ?HashtagService $hashtagService = null;
public function __construct(TimeFactory $time) {
/** parent::__construct($time);
* Cache constructor.
*/
public function __construct() {
$this->setInterval(12 * 60); // 12 minutes $this->setInterval(12 * 60); // 12 minutes
} }
@ -72,13 +64,13 @@ class Cache extends TimedJob {
* @throws QueryException * @throws QueryException
*/ */
protected function run($argument) { protected function run($argument) {
$app = \OC::$server->query(Application::class); $app = \OC::$server->get(Application::class);
$c = $app->getContainer(); $c = $app->getContainer();
$this->accountService = $c->query(AccountService::class); $this->accountService = $c->get(AccountService::class);
$this->cacheActorService = $c->query(CacheActorService::class); $this->cacheActorService = $c->get(CacheActorService::class);
$this->documentService = $c->query(DocumentService::class); $this->documentService = $c->get(DocumentService::class);
$this->hashtagService = $c->query(HashtagService::class); $this->hashtagService = $c->get(HashtagService::class);
$this->manageCache(); $this->manageCache();
} }
@ -110,6 +102,4 @@ class Cache extends TimedJob {
} catch (Exception $e) { } catch (Exception $e) {
} }
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,31 +31,24 @@ declare(strict_types=1);
namespace OCA\Social\Cron; namespace OCA\Social\Cron;
use OC\AppFramework\Utility\TimeFactory;
use OC\BackgroundJob\TimedJob; use OCP\BackgroundJob\TimedJob;
use OCA\Social\AppInfo\Application; use OCA\Social\AppInfo\Application;
use OCA\Social\Service\ConfigService; use OCA\Social\Service\ConfigService;
use OCA\Social\Service\MiscService; use OCA\Social\Service\MiscService;
use OCP\AppFramework\QueryException; use OCP\AppFramework\QueryException;
/** /**
* Class Queue * Class Queue
* *
* @package OCA\Social\Cron * @package OCA\Social\Cron
*/ */
class Chunk extends TimedJob { class Chunk extends TimedJob {
private ?ConfigService $configService = null; private ?ConfigService $configService = null;
private ?MiscService $miscService = null; public function __construct(TimeFactory $time) {
parent::__construct($time);
$this->setInterval(12 * 3600); // 12 hours
/**
* Cache constructor.
*/
public function __construct() {
$this->setInterval(12 * 3600); // 12 heures
} }
@ -79,8 +73,5 @@ class Chunk extends TimedJob {
* @param int $size * @param int $size
*/ */
private function morphChunks(int $size) { private function morphChunks(int $size) {
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Social\Cron; namespace OCA\Social\Cron;
use OC\AppFramework\Utility\TimeFactory;
use OC\BackgroundJob\TimedJob; use OCP\BackgroundJob\TimedJob;
use OCA\Social\AppInfo\Application; use OCA\Social\AppInfo\Application;
use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Service\ActivityService; use OCA\Social\Service\ActivityService;
@ -40,28 +41,22 @@ use OCA\Social\Service\RequestQueueService;
use OCA\Social\Service\StreamQueueService; use OCA\Social\Service\StreamQueueService;
use OCP\AppFramework\QueryException; use OCP\AppFramework\QueryException;
/** /**
* Class Queue * Class Queue
* *
* @package OCA\Social\Cron * @package OCA\Social\Cron
*/ */
class Queue extends TimedJob { class Queue extends TimedJob {
private ?ActivityService $activityService = null; private ?ActivityService $activityService = null;
private ?RequestQueueService $requestQueueService = null; private ?RequestQueueService $requestQueueService = null;
private ?StreamQueueService $streamQueueService = null; private ?StreamQueueService $streamQueueService = null;
private ?MiscService $miscService = null;
/** /**
* Cache constructor. * Cache constructor.
*/ */
public function __construct() { public function __construct(TimeFactory $time) {
parent::__construct($time);
$this->setInterval(12 * 60); // 12 minutes $this->setInterval(12 * 60); // 12 minutes
} }
@ -72,13 +67,14 @@ class Queue extends TimedJob {
* @throws QueryException * @throws QueryException
*/ */
protected function run($argument) { protected function run($argument) {
$app = \OC::$server->query(Application::class); /** @var Application $app */
$app = \OC::$server->get(Application::class);
$c = $app->getContainer(); $c = $app->getContainer();
$this->requestQueueService = $c->query(RequestQueueService::class); $this->requestQueueService = $c->get(RequestQueueService::class);
$this->streamQueueService = $c->query(StreamQueueService::class); $this->streamQueueService = $c->get(StreamQueueService::class);
$this->activityService = $c->query(ActivityService::class); $this->activityService = $c->get(ActivityService::class);
$this->miscService = $c->query(MiscService::class); $this->miscService = $c->get(MiscService::class);
$this->manageRequestQueue(); $this->manageRequestQueue();
$this->manageStreamQueue(); $this->manageStreamQueue();
@ -98,7 +94,6 @@ class Queue extends TimedJob {
} catch (SocialAppConfigException $e) { } catch (SocialAppConfigException $e) {
} }
} }
} }
@ -110,7 +105,4 @@ class Queue extends TimedJob {
$this->streamQueueService->manageStreamQueue($item); $this->streamQueueService->manageStreamQueue($item);
} }
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use DateTime; use DateTime;
use Exception; use Exception;
@ -39,24 +39,18 @@ use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\ActivityPub\Object\Like; use OCA\Social\Model\ActivityPub\Object\Like;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
/** /**
* Class ActionsRequest * Class ActionsRequest
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class ActionsRequest extends ActionsRequestBuilder { class ActionsRequest extends ActionsRequestBuilder {
use TArrayTools; use TArrayTools;
/** /**
* Insert a new Note in the database. * Insert a new Note in the database.
*
* @param ACore $like
*/ */
public function save(ACore $like) { public function save(ACore $like): void {
$qb = $this->getActionsInsertSql(); $qb = $this->getActionsInsertSql();
$qb->setValue('id', $qb->createNamedParameter($like->getId())) $qb->setValue('id', $qb->createNamedParameter($like->getId()))
->setValue('actor_id', $qb->createNamedParameter($like->getActorId())) ->setValue('actor_id', $qb->createNamedParameter($like->getActorId()))
@ -169,6 +163,4 @@ class ActionsRequest extends ActionsRequestBuilder {
// //
// $qb->execute(); // $qb->execute();
// } // }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,21 +31,18 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Exceptions\RowNotFoundException; use daita\MySmallPhpTools\Exceptions\RowNotFoundException;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OCA\Social\Exceptions\ActionDoesNotExistException; use OCA\Social\Exceptions\ActionDoesNotExistException;
use OCA\Social\Exceptions\InvalidResourceException; use OCA\Social\Exceptions\InvalidResourceException;
use OCA\Social\Model\ActivityPub\ACore; use OCA\Social\Model\ActivityPub\ACore;
/** /**
* Class ActionsRequestBuilder * Class ActionsRequestBuilder
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class ActionsRequestBuilder extends CoreRequestBuilder { class ActionsRequestBuilder extends CoreRequestBuilder {
use TArrayTools; use TArrayTools;
protected function getActionsInsertSql(): SocialQueryBuilder { protected function getActionsInsertSql(): SocialQueryBuilder {
@ -164,6 +162,4 @@ class ActionsRequestBuilder extends CoreRequestBuilder {
return $item; return $item;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,29 +30,21 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use DateTime; use DateTime;
use Exception; use Exception;
use OCA\Social\Exceptions\ActorDoesNotExistException; use OCA\Social\Exceptions\ActorDoesNotExistException;
use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Model\ActivityPub\Actor\Person; use OCA\Social\Model\ActivityPub\Actor\Person;
use OCA\Social\Service\ConfigService;
use OCA\Social\Service\MiscService;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
class ActorsRequest extends ActorsRequestBuilder { class ActorsRequest extends ActorsRequestBuilder {
/** /**
* create a new Person in the database. * Create a new Person in the database.
*
* @param Person $actor
*
* @throws SocialAppConfigException * @throws SocialAppConfigException
*/ */
public function create(Person $actor) { public function create(Person $actor): void {
$actor->setId($this->configService->getSocialUrl() . '@' . $actor->getPreferredUsername()); $actor->setId($this->configService->getSocialUrl() . '@' . $actor->getPreferredUsername());
$qb = $this->getActorsInsertSql(); $qb = $this->getActorsInsertSql();
@ -71,26 +64,18 @@ class ActorsRequest extends ActorsRequestBuilder {
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE) $qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
); );
$qb->execute(); $qb->executeStatement();
} }
public function update(Person $actor): void {
/**
* @param Person $actor
*/
public function update(Person $actor) {
$qb = $this->getActorsUpdateSql(); $qb = $this->getActorsUpdateSql();
$qb->set('avatar_version', $qb->createNamedParameter($actor->getAvatarVersion())); $qb->set('avatar_version', $qb->createNamedParameter($actor->getAvatarVersion()));
$this->limitToIdString($qb, $actor->getId()); $this->limitToIdString($qb, $actor->getId());
$qb->execute(); $qb->executeStatement();
} }
public function refreshKeys(Person $actor): void {
/**
* @param Person $actor
*/
public function refreshKeys(Person $actor) {
$qb = $this->getActorsUpdateSql(); $qb = $this->getActorsUpdateSql();
$qb->set('public_key', $qb->createNamedParameter($actor->getPublicKey())) $qb->set('public_key', $qb->createNamedParameter($actor->getPublicKey()))
->set('private_key', $qb->createNamedParameter($actor->getPrivateKey())); ->set('private_key', $qb->createNamedParameter($actor->getPrivateKey()));
@ -105,16 +90,13 @@ class ActorsRequest extends ActorsRequestBuilder {
$this->limitToIdString($qb, $actor->getId()); $this->limitToIdString($qb, $actor->getId());
$qb->execute(); $qb->executeStatement();
} }
/** /**
* return Actor from database based on the username * Return Actor from database based on the username
* *
* @param string $username
*
* @return Person
* @throws ActorDoesNotExistException * @throws ActorDoesNotExistException
* @throws SocialAppConfigException * @throws SocialAppConfigException
*/ */
@ -122,7 +104,7 @@ class ActorsRequest extends ActorsRequestBuilder {
$qb = $this->getActorsSelectSql(); $qb = $this->getActorsSelectSql();
$this->limitToPreferredUsername($qb, $username); $this->limitToPreferredUsername($qb, $username);
$cursor = $qb->execute(); $cursor = $qb->executeQuery();
$data = $cursor->fetch(); $data = $cursor->fetch();
$cursor->closeCursor(); $cursor->closeCursor();
@ -134,9 +116,6 @@ class ActorsRequest extends ActorsRequestBuilder {
} }
/** /**
* @param string $id
*
* @return Person
* @throws ActorDoesNotExistException * @throws ActorDoesNotExistException
* @throws SocialAppConfigException * @throws SocialAppConfigException
*/ */
@ -144,7 +123,7 @@ class ActorsRequest extends ActorsRequestBuilder {
$qb = $this->getActorsSelectSql(); $qb = $this->getActorsSelectSql();
$this->limitToIdString($qb, $id); $this->limitToIdString($qb, $id);
$cursor = $qb->execute(); $cursor = $qb->executeQuery();
$data = $cursor->fetch(); $data = $cursor->fetch();
$cursor->closeCursor(); $cursor->closeCursor();
@ -169,7 +148,7 @@ class ActorsRequest extends ActorsRequestBuilder {
$qb = $this->getActorsSelectSql(); $qb = $this->getActorsSelectSql();
$this->limitToUserId($qb, $userId); $this->limitToUserId($qb, $userId);
$cursor = $qb->execute(); $cursor = $qb->executeQuery();
$data = $cursor->fetch(); $data = $cursor->fetch();
$cursor->closeCursor(); $cursor->closeCursor();
@ -189,7 +168,7 @@ class ActorsRequest extends ActorsRequestBuilder {
$qb = $this->getActorsSelectSql(); $qb = $this->getActorsSelectSql();
$accounts = []; $accounts = [];
$cursor = $qb->execute(); $cursor = $qb->executeQuery();
while ($data = $cursor->fetch()) { while ($data = $cursor->fetch()) {
$accounts[] = $this->parseActorsSelectSql($data); $accounts[] = $this->parseActorsSelectSql($data);
} }
@ -200,8 +179,6 @@ class ActorsRequest extends ActorsRequestBuilder {
/** /**
* @param string $search
*
* @return Person[] * @return Person[]
* @throws SocialAppConfigException * @throws SocialAppConfigException
*/ */
@ -210,7 +187,7 @@ class ActorsRequest extends ActorsRequestBuilder {
$this->searchInPreferredUsername($qb, $search); $this->searchInPreferredUsername($qb, $search);
$accounts = []; $accounts = [];
$cursor = $qb->execute(); $cursor = $qb->executeQuery();
while ($data = $cursor->fetch()) { while ($data = $cursor->fetch()) {
$accounts[] = $this->parseActorsSelectSql($data); $accounts[] = $this->parseActorsSelectSql($data);
} }
@ -218,6 +195,4 @@ class ActorsRequest extends ActorsRequestBuilder {
return $accounts; return $accounts;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,15 +30,12 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Model\ActivityPub\Actor\Person; use OCA\Social\Model\ActivityPub\Actor\Person;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
class ActorsRequestBuilder extends CoreRequestBuilder { class ActorsRequestBuilder extends CoreRequestBuilder {
use TArrayTools; use TArrayTools;
@ -130,6 +128,4 @@ class ActorsRequestBuilder extends CoreRequestBuilder {
return $actor; return $actor;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,7 +30,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use DateTime; use DateTime;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Exception; use Exception;
@ -38,9 +38,7 @@ use OCA\Social\Model\ActivityPub\Actor\Person;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
class CacheActorsRequest extends CacheActorsRequestBuilder { class CacheActorsRequest extends CacheActorsRequestBuilder {
public const CACHE_TTL = 60 * 24; // 1d
const CACHE_TTL = 60 * 24; // 1d
/** /**
@ -111,7 +109,6 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
* @return int * @return int
*/ */
public function update(Person $actor): int { public function update(Person $actor): int {
$qb = $this->getCacheActorsUpdateSql(); $qb = $this->getCacheActorsUpdateSql();
$qb->set('following', $qb->createNamedParameter($actor->getFollowing())) $qb->set('following', $qb->createNamedParameter($actor->getFollowing()))
->set('followers', $qb->createNamedParameter($actor->getFollowers())) ->set('followers', $qb->createNamedParameter($actor->getFollowers()))
@ -252,6 +249,4 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
$qb->execute(); $qb->execute();
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,7 +30,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Exceptions\RowNotFoundException; use daita\MySmallPhpTools\Exceptions\RowNotFoundException;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OCA\Social\Exceptions\CacheActorDoesNotExistException; use OCA\Social\Exceptions\CacheActorDoesNotExistException;
@ -38,8 +38,6 @@ use OCA\Social\Model\ActivityPub\Actor\Person;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
class CacheActorsRequestBuilder extends CoreRequestBuilder { class CacheActorsRequestBuilder extends CoreRequestBuilder {
use TArrayTools; use TArrayTools;
@ -182,6 +180,4 @@ class CacheActorsRequestBuilder extends CoreRequestBuilder {
$actor->setViewerLink($link); $actor->setViewerLink($link);
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,7 +30,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use DateTime; use DateTime;
use Exception; use Exception;
use OCA\Social\Exceptions\CacheDocumentDoesNotExistException; use OCA\Social\Exceptions\CacheDocumentDoesNotExistException;
@ -37,9 +37,7 @@ use OCA\Social\Model\ActivityPub\Object\Document;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
class CacheDocumentsRequest extends CacheDocumentsRequestBuilder { class CacheDocumentsRequest extends CacheDocumentsRequestBuilder {
public const CACHING_TIMEOUT = 5; // 5 min
const CACHING_TIMEOUT = 5; // 5 min
/** /**
@ -245,7 +243,4 @@ class CacheDocumentsRequest extends CacheDocumentsRequestBuilder {
$qb->execute(); $qb->execute();
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,14 +30,11 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OCA\Social\Model\ActivityPub\Object\Document; use OCA\Social\Model\ActivityPub\Object\Document;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
class CacheDocumentsRequestBuilder extends CoreRequestBuilder { class CacheDocumentsRequestBuilder extends CoreRequestBuilder {
use TArrayTools; use TArrayTools;
@ -112,6 +110,4 @@ class CacheDocumentsRequestBuilder extends CoreRequestBuilder {
return $document; return $document;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use DateTime; use DateTime;
use Exception; use Exception;
@ -39,15 +39,12 @@ use OCA\Social\Model\Client\SocialClient;
use OCA\Social\Service\ClientService; use OCA\Social\Service\ClientService;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
/** /**
* Class ClientAppRequest * Class ClientAppRequest
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class ClientRequest extends ClientRequestBuilder { class ClientRequest extends ClientRequestBuilder {
use TArrayTools; use TArrayTools;
@ -166,6 +163,4 @@ class ClientRequest extends ClientRequestBuilder {
$qb->execute(); $qb->execute();
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,22 +31,18 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Exceptions\RowNotFoundException; use daita\MySmallPhpTools\Exceptions\RowNotFoundException;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use Exception; use Exception;
use OCA\Social\Exceptions\ClientNotFoundException; use OCA\Social\Exceptions\ClientNotFoundException;
use OCA\Social\Model\Client\SocialClient; use OCA\Social\Model\Client\SocialClient;
/** /**
* Class ClientRequestBuilder * Class ClientRequestBuilder
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class ClientRequestBuilder extends CoreRequestBuilder { class ClientRequestBuilder extends CoreRequestBuilder {
use TArrayTools; use TArrayTools;
@ -154,6 +151,4 @@ class ClientRequestBuilder extends CoreRequestBuilder {
return $item; return $item;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Exceptions\DateTimeException; use daita\MySmallPhpTools\Exceptions\DateTimeException;
use DateInterval; use DateInterval;
use DateTime; use DateTime;
@ -49,34 +49,32 @@ use OCP\IDBConnection;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
/** /**
* Class CoreRequestBuilder * Class CoreRequestBuilder
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class CoreRequestBuilder { class CoreRequestBuilder {
public const TABLE_REQUEST_QUEUE = 'social_3_req_queue';
public const TABLE_INSTANCE = 'social_3_instance';
const TABLE_REQUEST_QUEUE = 'social_3_req_queue'; public const TABLE_ACTORS = 'social_3_actor';
const TABLE_INSTANCE = 'social_3_instance'; public const TABLE_STREAM = 'social_3_stream';
public const TABLE_STREAM_DEST = 'social_3_stream_dest';
public const TABLE_STREAM_TAGS = 'social_3_stream_tag';
public const TABLE_STREAM_QUEUE = 'social_3_stream_queue';
public const TABLE_STREAM_ACTIONS = 'social_3_stream_act';
const TABLE_ACTORS = 'social_3_actor'; public const TABLE_HASHTAGS = 'social_3_hashtag';
const TABLE_STREAM = 'social_3_stream'; public const TABLE_FOLLOWS = 'social_3_follow';
const TABLE_STREAM_DEST = 'social_3_stream_dest'; public const TABLE_ACTIONS = 'social_3_action';
const TABLE_STREAM_TAGS = 'social_3_stream_tag';
const TABLE_STREAM_QUEUE = 'social_3_stream_queue';
const TABLE_STREAM_ACTIONS = 'social_3_stream_act';
const TABLE_HASHTAGS = 'social_3_hashtag'; public const TABLE_CACHE_ACTORS = 'social_3_cache_actor';
const TABLE_FOLLOWS = 'social_3_follow'; public const TABLE_CACHE_DOCUMENTS = 'social_3_cache_doc';
const TABLE_ACTIONS = 'social_3_action';
const TABLE_CACHE_ACTORS = 'social_3_cache_actor'; public const TABLE_CLIENT = 'social_3_client';
const TABLE_CACHE_DOCUMENTS = 'social_3_cache_doc'; public const TABLE_CLIENT_AUTH = 'social_3_client_auth';
public const TABLE_CLIENT_TOKEN = 'social_3_client_token';
const TABLE_CLIENT = 'social_3_client';
const TABLE_CLIENT_AUTH = 'social_3_client_auth';
const TABLE_CLIENT_TOKEN = 'social_3_client_token';
private array $tables = [ private array $tables = [
@ -728,7 +726,6 @@ class CoreRequestBuilder {
$orX->add($expr->gte($field, $qb->createNamedParameter($dTime, IQueryBuilder::PARAM_DATE))); $orX->add($expr->gte($field, $qb->createNamedParameter($dTime, IQueryBuilder::PARAM_DATE)));
$qb->andWhere($orX); $qb->andWhere($orX);
} }
@ -1224,6 +1221,4 @@ class CoreRequestBuilder {
$qb->where($this->exprLimitToDBField($qb, 'class', 'OCA\Social\Cron\Queue', true, true)); $qb->where($this->exprLimitToDBField($qb, 'class', 'OCA\Social\Cron\Queue', true, true));
$qb->execute(); $qb->execute();
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use DateTime; use DateTime;
use Exception; use Exception;
@ -39,15 +39,12 @@ use OCA\Social\Model\ActivityPub\Actor\Person;
use OCA\Social\Model\ActivityPub\Object\Follow; use OCA\Social\Model\ActivityPub\Object\Follow;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
/** /**
* Class FollowsRequest * Class FollowsRequest
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class FollowsRequest extends FollowsRequestBuilder { class FollowsRequest extends FollowsRequestBuilder {
use TArrayTools; use TArrayTools;
@ -259,7 +256,6 @@ class FollowsRequest extends FollowsRequestBuilder {
$this->leftJoinAccounts($qb, 'actor_id'); $this->leftJoinAccounts($qb, 'actor_id');
return $this->getFollowsFromRequest($qb); return $this->getFollowsFromRequest($qb);
} }
@ -308,6 +304,4 @@ class FollowsRequest extends FollowsRequestBuilder {
$qb->execute(); $qb->execute();
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Exceptions\RowNotFoundException; use daita\MySmallPhpTools\Exceptions\RowNotFoundException;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OCA\Social\Exceptions\FollowNotFoundException; use OCA\Social\Exceptions\FollowNotFoundException;
@ -38,15 +38,12 @@ use OCA\Social\Exceptions\InvalidResourceException;
use OCA\Social\Model\ActivityPub\Object\Follow; use OCA\Social\Model\ActivityPub\Object\Follow;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
/** /**
* Class FollowsRequestBuilder * Class FollowsRequestBuilder
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class FollowsRequestBuilder extends CoreRequestBuilder { class FollowsRequestBuilder extends CoreRequestBuilder {
use TArrayTools; use TArrayTools;
@ -187,6 +184,4 @@ class FollowsRequestBuilder extends CoreRequestBuilder {
return $follow; return $follow;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,19 +31,15 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OCA\Social\Exceptions\HashtagDoesNotExistException; use OCA\Social\Exceptions\HashtagDoesNotExistException;
/** /**
* Class HashtagsRequest * Class HashtagsRequest
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class HashtagsRequest extends HashtagsRequestBuilder { class HashtagsRequest extends HashtagsRequestBuilder {
use TArrayTools; use TArrayTools;
@ -136,7 +133,4 @@ class HashtagsRequest extends HashtagsRequestBuilder {
return $hashtags; return $hashtags;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,19 +31,15 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
/** /**
* Class HashtagsRequestBuilder * Class HashtagsRequestBuilder
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class HashtagsRequestBuilder extends CoreRequestBuilder { class HashtagsRequestBuilder extends CoreRequestBuilder {
use TArrayTools; use TArrayTools;
@ -112,9 +109,7 @@ class HashtagsRequestBuilder extends CoreRequestBuilder {
public function parseHashtagsSelectSql(array $data): array { public function parseHashtagsSelectSql(array $data): array {
return [ return [
'hashtag' => $this->get('hashtag', $data, ''), 'hashtag' => $this->get('hashtag', $data, ''),
'trend' => $this->getArray('trend', $data, []) 'trend' => $this->getArray('trend', $data, [])
]; ];
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,21 +31,17 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OCA\Social\Exceptions\InstanceDoesNotExistException; use OCA\Social\Exceptions\InstanceDoesNotExistException;
use OCA\Social\Model\ActivityPub\ACore; use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\Instance; use OCA\Social\Model\Instance;
/** /**
* Class InstancesRequest * Class InstancesRequest
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class InstancesRequest extends InstancesRequestBuilder { class InstancesRequest extends InstancesRequestBuilder {
use TArrayTools; use TArrayTools;
@ -77,6 +74,4 @@ class InstancesRequest extends InstancesRequestBuilder {
return $this->getInstanceFromRequest($qb); return $this->getInstanceFromRequest($qb);
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,7 +30,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Exceptions\RowNotFoundException; use daita\MySmallPhpTools\Exceptions\RowNotFoundException;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OCA\Social\Exceptions\InstanceDoesNotExistException; use OCA\Social\Exceptions\InstanceDoesNotExistException;
@ -39,8 +39,6 @@ use OCA\Social\Model\Instance;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
class InstancesRequestBuilder extends CoreRequestBuilder { class InstancesRequestBuilder extends CoreRequestBuilder {
use TArrayTools; use TArrayTools;
@ -166,6 +164,4 @@ class InstancesRequestBuilder extends CoreRequestBuilder {
return $instance; return $instance;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,13 +31,11 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use DateTime; use DateTime;
use OCA\Social\Exceptions\QueueStatusException; use OCA\Social\Exceptions\QueueStatusException;
use OCA\Social\Model\RequestQueue; use OCA\Social\Model\RequestQueue;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
/** /**
* Class RequestQueueRequest * Class RequestQueueRequest
* *
@ -206,6 +205,4 @@ class RequestQueueRequest extends RequestQueueRequestBuilder {
$qb->execute(); $qb->execute();
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,14 +30,11 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OCA\Social\Model\RequestQueue; use OCA\Social\Model\RequestQueue;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
class RequestQueueRequestBuilder extends CoreRequestBuilder { class RequestQueueRequestBuilder extends CoreRequestBuilder {
use TArrayTools; use TArrayTools;
@ -112,6 +110,4 @@ class RequestQueueRequestBuilder extends CoreRequestBuilder {
return $queue; return $queue;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Db\ExtendedQueryBuilder; use daita\MySmallPhpTools\Db\ExtendedQueryBuilder;
use OC\SystemConfig; use OC\SystemConfig;
use OCA\Social\Model\ActivityPub\Actor\Person; use OCA\Social\Model\ActivityPub\Actor\Person;
@ -39,7 +39,6 @@ use OCP\IDBConnection;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
/** /**
* Class SocialCoreQueryBuilder * Class SocialCoreQueryBuilder
* *
@ -105,4 +104,3 @@ class SocialCoreQueryBuilder extends ExtendedQueryBuilder {
return hash('sha512', $id); return hash('sha512', $id);
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use Doctrine\DBAL\Query\QueryBuilder; use Doctrine\DBAL\Query\QueryBuilder;
use OCA\Social\AP; use OCA\Social\AP;
use OCA\Social\Exceptions\InvalidResourceException; use OCA\Social\Exceptions\InvalidResourceException;
@ -39,7 +39,6 @@ use OCA\Social\Model\ActivityPub\Object\Document;
use OCA\Social\Model\ActivityPub\Object\Image; use OCA\Social\Model\ActivityPub\Object\Image;
use OCP\DB\QueryBuilder\ICompositeExpression; use OCP\DB\QueryBuilder\ICompositeExpression;
/** /**
* Class SocialCrossQueryBuilder * Class SocialCrossQueryBuilder
* *
@ -368,6 +367,4 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
return $andX; return $andX;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,10 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use OCP\DB\QueryBuilder\IQueryBuilder;
/** /**
* Class SocialFiltersQueryBuilder * Class SocialFiltersQueryBuilder
* *
@ -64,6 +61,4 @@ class SocialFiltersQueryBuilder extends SocialLimitsQueryBuilder {
$this->andWhere($filter); $this->andWhere($filter);
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Exceptions\DateTimeException; use daita\MySmallPhpTools\Exceptions\DateTimeException;
use DateInterval; use DateInterval;
use DateTime; use DateTime;
@ -39,7 +39,6 @@ use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\Client\Options\TimelineOptions; use OCA\Social\Model\Client\Options\TimelineOptions;
use OCP\DB\QueryBuilder\ICompositeExpression; use OCP\DB\QueryBuilder\ICompositeExpression;
/** /**
* Class SocialLimitsQueryBuilder * Class SocialLimitsQueryBuilder
* *
@ -466,6 +465,4 @@ class SocialLimitsQueryBuilder extends SocialCrossQueryBuilder {
$this->andWhere($orX); $this->andWhere($orX);
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,15 +31,12 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
/** /**
* Class SocialQueryBuilder * Class SocialQueryBuilder
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class SocialQueryBuilder extends SocialFiltersQueryBuilder { class SocialQueryBuilder extends SocialFiltersQueryBuilder {
private int $format = 1; private int $format = 1;
@ -101,7 +99,4 @@ class SocialQueryBuilder extends SocialFiltersQueryBuilder {
$dbConn = $this->getConnection(); $dbConn = $this->getConnection();
$this->searchInDBField('account', $dbConn->escapeLikeParameter($account) . '%'); $this->searchInDBField('account', $dbConn->escapeLikeParameter($account) . '%');
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,11 +31,9 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use OCA\Social\Exceptions\StreamActionDoesNotExistException; use OCA\Social\Exceptions\StreamActionDoesNotExistException;
use OCA\Social\Model\StreamAction; use OCA\Social\Model\StreamAction;
/** /**
* Class StreamActionsRequest * Class StreamActionsRequest
* *
@ -133,6 +132,4 @@ class StreamActionsRequest extends StreamActionsRequestBuilder {
$qb->execute(); $qb->execute();
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,20 +30,16 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OCA\Social\Model\StreamAction; use OCA\Social\Model\StreamAction;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
/** /**
* Class StreamActionsRequestBuilder * Class StreamActionsRequestBuilder
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class StreamActionsRequestBuilder extends CoreRequestBuilder { class StreamActionsRequestBuilder extends CoreRequestBuilder {
use TArrayTools; use TArrayTools;
@ -115,6 +112,4 @@ class StreamActionsRequestBuilder extends CoreRequestBuilder {
return $action; return $action;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TStringTools; use daita\MySmallPhpTools\Traits\TStringTools;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Exception; use Exception;
@ -43,7 +43,6 @@ use OCP\IDBConnection;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
/** /**
* Class StreamDestRequest * Class StreamDestRequest
* *
@ -185,6 +184,4 @@ class StreamDestRequest extends StreamDestRequestBuilder {
$qb->execute(); $qb->execute();
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,19 +30,15 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
/** /**
* Class StreamDestRequestBuilder * Class StreamDestRequestBuilder
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class StreamDestRequestBuilder extends CoreRequestBuilder { class StreamDestRequestBuilder extends CoreRequestBuilder {
use TArrayTools; use TArrayTools;
@ -118,7 +115,4 @@ class StreamDestRequestBuilder extends CoreRequestBuilder {
return $qb; return $qb;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,13 +31,11 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use DateTime; use DateTime;
use OCA\Social\Exceptions\QueueStatusException; use OCA\Social\Exceptions\QueueStatusException;
use OCA\Social\Model\StreamQueue; use OCA\Social\Model\StreamQueue;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
/** /**
* Class StreamQueueRequest * Class StreamQueueRequest
* *
@ -184,6 +183,4 @@ class StreamQueueRequest extends StreamQueueRequestBuilder {
$qb->execute(); $qb->execute();
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,14 +30,11 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OCA\Social\Model\StreamQueue; use OCA\Social\Model\StreamQueue;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
class StreamQueueRequestBuilder extends CoreRequestBuilder { class StreamQueueRequestBuilder extends CoreRequestBuilder {
use TArrayTools; use TArrayTools;
@ -111,6 +109,4 @@ class StreamQueueRequestBuilder extends CoreRequestBuilder {
return $queue; return $queue;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,7 +30,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Exceptions\DateTimeException; use daita\MySmallPhpTools\Exceptions\DateTimeException;
use daita\MySmallPhpTools\Model\Cache; use daita\MySmallPhpTools\Model\Cache;
use DateTime; use DateTime;
@ -50,7 +50,6 @@ use OCP\IDBConnection;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
/** /**
* Class StreamRequest * Class StreamRequest
* *
@ -684,7 +683,6 @@ class StreamRequest extends StreamRequestBuilder {
* @return IQueryBuilder * @return IQueryBuilder
*/ */
public function saveStream(Stream $stream): IQueryBuilder { public function saveStream(Stream $stream): IQueryBuilder {
try { try {
$dTime = new DateTime(); $dTime = new DateTime();
$dTime->setTimestamp($stream->getPublishedTime()); $dTime->setTimestamp($stream->getPublishedTime());
@ -763,6 +761,4 @@ class StreamRequest extends StreamRequestBuilder {
return $qb; return $qb;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Exceptions\CacheItemNotFoundException; use daita\MySmallPhpTools\Exceptions\CacheItemNotFoundException;
use daita\MySmallPhpTools\Exceptions\RowNotFoundException; use daita\MySmallPhpTools\Exceptions\RowNotFoundException;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
@ -43,15 +43,12 @@ use OCA\Social\Model\ActivityPub\Object\Announce;
use OCA\Social\Model\ActivityPub\Stream; use OCA\Social\Model\ActivityPub\Stream;
use OCA\Social\Model\InstancePath; use OCA\Social\Model\InstancePath;
/** /**
* Class StreamRequestBuilder * Class StreamRequestBuilder
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class StreamRequestBuilder extends CoreRequestBuilder { class StreamRequestBuilder extends CoreRequestBuilder {
use TArrayTools; use TArrayTools;
@ -247,6 +244,4 @@ class StreamRequestBuilder extends CoreRequestBuilder {
return $item; return $item;
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -30,21 +31,17 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TStringTools; use daita\MySmallPhpTools\Traits\TStringTools;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use OCA\Social\Model\ActivityPub\Object\Note; use OCA\Social\Model\ActivityPub\Object\Note;
use OCA\Social\Model\ActivityPub\Stream; use OCA\Social\Model\ActivityPub\Stream;
/** /**
* Class StreamTagsRequest * Class StreamTagsRequest
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class StreamTagsRequest extends StreamTagsRequestBuilder { class StreamTagsRequest extends StreamTagsRequestBuilder {
use TStringTools; use TStringTools;
@ -58,7 +55,6 @@ class StreamTagsRequest extends StreamTagsRequestBuilder {
/** @var Note $stream */ /** @var Note $stream */
foreach ($stream->getHashTags() as $hashtag) { foreach ($stream->getHashTags() as $hashtag) {
$qb = $this->getStreamTagsInsertSql(); $qb = $this->getStreamTagsInsertSql();
$streamId = $qb->prim($stream->getId()); $streamId = $qb->prim($stream->getId());
$qb->setValue('stream_id', $qb->createNamedParameter($streamId)); $qb->setValue('stream_id', $qb->createNamedParameter($streamId));
@ -82,6 +78,4 @@ class StreamTagsRequest extends StreamTagsRequestBuilder {
$qb->execute(); $qb->execute();
} }
} }

Wyświetl plik

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@ -29,19 +30,15 @@ declare(strict_types=1);
namespace OCA\Social\Db; namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TArrayTools;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
/** /**
* Class StreamDestRequestBuilder * Class StreamDestRequestBuilder
* *
* @package OCA\Social\Db * @package OCA\Social\Db
*/ */
class StreamTagsRequestBuilder extends CoreRequestBuilder { class StreamTagsRequestBuilder extends CoreRequestBuilder {
use TArrayTools; use TArrayTools;
@ -101,6 +98,4 @@ class StreamTagsRequestBuilder extends CoreRequestBuilder {
return $qb; return $qb;
} }
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class AccountAlreadyExistsException extends Exception { class AccountAlreadyExistsException extends Exception {
} }

Wyświetl plik

@ -29,10 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class AccountDoesNotExistException extends Exception { class AccountDoesNotExistException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class ActionDoesNotExistException extends Exception { class ActionDoesNotExistException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class ActivityCantBeVerifiedException extends Exception { class ActivityCantBeVerifiedException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class ActivityPubFormatException extends Exception { class ActivityPubFormatException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class ActorDoesNotExistException extends Exception { class ActorDoesNotExistException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class CacheActorDoesNotExistException extends Exception { class CacheActorDoesNotExistException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class CacheContentException extends Exception { class CacheContentException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class CacheContentMimeTypeException extends Exception { class CacheContentMimeTypeException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class CacheDocumentDoesNotExistException extends Exception { class CacheDocumentDoesNotExistException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class ClientException extends Exception { class ClientException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class ClientNotFoundException extends Exception { class ClientNotFoundException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class EmptyQueueException extends Exception { class EmptyQueueException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class FollowNotFoundException extends Exception { class FollowNotFoundException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class FollowSameAccountException extends Exception { class FollowSameAccountException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class HashtagDoesNotExistException extends Exception { class HashtagDoesNotExistException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class HostMetaException extends Exception { class HostMetaException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class InstanceDoesNotExistException extends Exception { class InstanceDoesNotExistException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class InvalidOriginException extends Exception { class InvalidOriginException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class InvalidResourceEntryException extends Exception { class InvalidResourceEntryException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class InvalidResourceException extends Exception { class InvalidResourceException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class ItemAlreadyExistsException extends Exception { class ItemAlreadyExistsException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class ItemNotFoundException extends Exception { class ItemNotFoundException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class ItemUnknownException extends Exception { class ItemUnknownException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class LinkedDataSignatureMissingException extends Exception { class LinkedDataSignatureMissingException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class NoHighPriorityRequestException extends Exception { class NoHighPriorityRequestException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class QueueStatusException extends Exception { class QueueStatusException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class RealTokenException extends Exception { class RealTokenException extends Exception {
} }

Wyświetl plik

@ -29,11 +29,7 @@
namespace OCA\Social\Exceptions; namespace OCA\Social\Exceptions;
use Exception; use Exception;
class RedundancyLimitException extends Exception { class RedundancyLimitException extends Exception {
} }

Some files were not shown because too many files have changed in this diff Show More