kopia lustrzana https://github.com/nextcloud/social
Embeed tools lib
And fix method signature for 25 Signed-off-by: Carl Schwan <carl@carlschwan.eu>pull/1430/head
rodzic
9d8b2b322f
commit
9061a6812e
|
@ -23,7 +23,6 @@
|
|||
}
|
||||
},
|
||||
"require": {
|
||||
"daita/my-small-php-tools": "dev-master",
|
||||
"gumlet/php-image-resize": "2.0.*",
|
||||
"friendica/json-ld": "^1.0"
|
||||
},
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Exceptions\ItemUnknownException;
|
||||
use OCA\Social\Exceptions\RedundancyLimitException;
|
||||
use OCA\Social\Exceptions\SocialAppConfigException;
|
||||
|
@ -174,7 +174,7 @@ class AP {
|
|||
AP::$activityPub = Server::get(AP::class);
|
||||
} catch (QueryException $e) {
|
||||
Server::get(LoggerInterface::class)
|
||||
->errir($e->getMessage(), ['exception' => $e]);
|
||||
->error($e->getMessage(), ['exception' => $e]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Command;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use Exception;
|
||||
use OC\Core\Command\Base;
|
||||
use OCA\Social\Db\StreamDestRequest;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Command;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\CacheItemNotFoundException;
|
||||
use OCA\Social\Tools\Exceptions\CacheItemNotFoundException;
|
||||
use OC\Core\Command\Base;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Exceptions\ItemUnknownException;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Command;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use Exception;
|
||||
use OC\Core\Command\Base;
|
||||
use OCA\Social\Db\CoreRequestBuilder;
|
||||
|
|
|
@ -30,10 +30,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Controller;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\Nextcloud\nc20\TNC20Logger;
|
||||
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
|
||||
use daita\MySmallPhpTools\Traits\TAsync;
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use OCA\Social\Tools\Traits\TNCLogger;
|
||||
use OCA\Social\Tools\Traits\TNCDataResponse;
|
||||
use OCA\Social\Tools\Traits\TAsync;
|
||||
use OCA\Social\Tools\Traits\TStringTools;
|
||||
use Exception;
|
||||
use OCP\AppFramework\Http;
|
||||
use OCA\Social\AppInfo\Application;
|
||||
|
@ -63,7 +63,7 @@ class ActivityPubController extends Controller {
|
|||
use TNCDataResponse;
|
||||
use TStringTools;
|
||||
use TAsync;
|
||||
use TNC20Logger;
|
||||
use TNCLogger;
|
||||
|
||||
private SocialPubController $socialPubController;
|
||||
private FediverseService $fediverseService;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Controller;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
|
||||
use OCA\Social\Tools\Traits\TNCDataResponse;
|
||||
use Exception;
|
||||
use OCA\Social\AppInfo\Application;
|
||||
use OCA\Social\Exceptions\AccountDoesNotExistException;
|
||||
|
|
|
@ -26,8 +26,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Controller;
|
||||
|
||||
use daita\MySmallPhpTools\Model\SimpleDataStore;
|
||||
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
|
||||
use OCA\Social\Tools\Model\SimpleDataStore;
|
||||
use OCA\Social\Tools\Traits\TNCDataResponse;
|
||||
use Exception;
|
||||
use OCA\Social\Exceptions\SocialAppConfigException;
|
||||
use OCA\Social\Service\ConfigService;
|
||||
|
|
|
@ -31,8 +31,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Controller;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TNCDataResponse;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use Exception;
|
||||
use OCA\Social\AppInfo\Application;
|
||||
use OCA\Social\Exceptions\AccountDoesNotExistException;
|
||||
|
|
|
@ -31,8 +31,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Controller;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TNCDataResponse;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use Exception;
|
||||
use OCP\AppFramework\Http;
|
||||
use OC\User\NoUserException;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Controller;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
|
||||
use OCA\Social\Tools\Traits\TNCDataResponse;
|
||||
use Exception;
|
||||
use OCA\Social\AppInfo\Application;
|
||||
use OCA\Social\Exceptions\ClientException;
|
||||
|
|
|
@ -31,9 +31,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Controller;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\ArrayNotFoundException;
|
||||
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Exceptions\ArrayNotFoundException;
|
||||
use OCA\Social\Tools\Traits\TNCDataResponse;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use Exception;
|
||||
use OCA\Social\AppInfo\Application;
|
||||
use OCA\Social\Exceptions\InvalidResourceException;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Controller;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TAsync;
|
||||
use OCA\Social\Tools\Traits\TAsync;
|
||||
use OCA\Social\AppInfo\Application;
|
||||
use OCA\Social\Exceptions\SocialAppConfigException;
|
||||
use OCA\Social\Model\RequestQueue;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Controller;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
|
||||
use OCA\Social\Tools\Traits\TNCDataResponse;
|
||||
use Exception;
|
||||
use OCA\Social\AppInfo\Application;
|
||||
use OCA\Social\Exceptions\AccountDoesNotExistException;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use OCA\Social\Exceptions\ActionDoesNotExistException;
|
||||
|
|
|
@ -31,8 +31,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\RowNotFoundException;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Exceptions\RowNotFoundException;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Exceptions\ActionDoesNotExistException;
|
||||
use OCA\Social\Exceptions\InvalidResourceException;
|
||||
use OCA\Social\Model\ActivityPub\ACore;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Exceptions\SocialAppConfigException;
|
||||
use OCA\Social\Model\ActivityPub\Actor\Person;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
|
|
|
@ -30,8 +30,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\RowNotFoundException;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Exceptions\RowNotFoundException;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Exceptions\CacheActorDoesNotExistException;
|
||||
use OCA\Social\Exceptions\InvalidResourceException;
|
||||
use OCA\Social\Model\ActivityPub\Actor\Person;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Model\ActivityPub\Object\Document;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use OCA\Social\Exceptions\ClientNotFoundException;
|
||||
|
|
|
@ -31,8 +31,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\RowNotFoundException;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Exceptions\RowNotFoundException;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use Exception;
|
||||
use OCA\Social\Exceptions\ClientNotFoundException;
|
||||
use OCA\Social\Model\Client\SocialClient;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\DateTimeException;
|
||||
use OCA\Social\Tools\Exceptions\DateTimeException;
|
||||
use DateInterval;
|
||||
use DateTime;
|
||||
use Doctrine\DBAL\Query\QueryBuilder;
|
||||
|
@ -46,6 +46,7 @@ use OCA\Social\Model\StreamAction;
|
|||
use OCA\Social\Service\ConfigService;
|
||||
use OCA\Social\Service\MiscService;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\DB\QueryBuilder\IQueryFunction;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IURLGenerator;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
@ -573,14 +574,6 @@ class CoreRequestBuilder {
|
|||
$qb->andWhere($expr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param string $value
|
||||
* @param bool $cs - case sensitive
|
||||
* @param string $alias
|
||||
*/
|
||||
protected function filterDBField(
|
||||
IQueryBuilder &$qb, string $field, string $value, bool $cs = true, string $alias = ''
|
||||
) {
|
||||
|
@ -588,21 +581,10 @@ class CoreRequestBuilder {
|
|||
$qb->andWhere($expr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param string $value
|
||||
* @param bool $eq - true = limit, false = filter
|
||||
* @param bool $cs
|
||||
* @param string $alias
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function exprLimitToDBField(
|
||||
IQueryBuilder &$qb, string $field, string $value, bool $eq = true, bool $cs = true,
|
||||
string $alias = ''
|
||||
): string {
|
||||
): IQueryFunction {
|
||||
$expr = $qb->expr();
|
||||
|
||||
$pf = '';
|
||||
|
@ -627,32 +609,16 @@ class CoreRequestBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param int $value
|
||||
* @param string $alias
|
||||
*/
|
||||
protected function limitToDBFieldInt(
|
||||
IQueryBuilder &$qb, string $field, int $value, string $alias = ''
|
||||
) {
|
||||
): void {
|
||||
$expr = $this->exprLimitToDBFieldInt($qb, $field, $value, $alias);
|
||||
$qb->andWhere($expr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param int $value
|
||||
* @param string $alias
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function exprLimitToDBFieldInt(
|
||||
IQueryBuilder &$qb, string $field, int $value, string $alias = ''
|
||||
): string {
|
||||
): IQueryFunction {
|
||||
$expr = $qb->expr();
|
||||
|
||||
$pf = '';
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use OCA\Social\Exceptions\FollowNotFoundException;
|
||||
|
|
|
@ -31,8 +31,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\RowNotFoundException;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Exceptions\RowNotFoundException;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Exceptions\FollowNotFoundException;
|
||||
use OCA\Social\Exceptions\InvalidResourceException;
|
||||
use OCA\Social\Model\ActivityPub\Object\Follow;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Exceptions\HashtagDoesNotExistException;
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Exceptions\InstanceDoesNotExistException;
|
||||
use OCA\Social\Model\ActivityPub\ACore;
|
||||
use OCA\Social\Model\Instance;
|
||||
|
|
|
@ -30,8 +30,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\RowNotFoundException;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Exceptions\RowNotFoundException;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Exceptions\InstanceDoesNotExistException;
|
||||
use OCA\Social\Exceptions\InvalidResourceException;
|
||||
use OCA\Social\Model\ActivityPub\ACore;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Model\RequestQueue;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Db\ExtendedQueryBuilder;
|
||||
use OCA\Social\Tools\Db\ExtendedQueryBuilder;
|
||||
use OC\SystemConfig;
|
||||
use OCA\Social\Model\ActivityPub\Actor\Person;
|
||||
use OCP\DB\QueryBuilder\ICompositeExpression;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\DateTimeException;
|
||||
use OCA\Social\Tools\Exceptions\DateTimeException;
|
||||
use DateInterval;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Model\StreamAction;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use OCA\Social\Tools\Traits\TStringTools;
|
||||
use Exception;
|
||||
use OCP\DB\Exception as DBException;
|
||||
use OCA\Social\Model\ActivityPub\Internal\SocialAppNotification;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Model\StreamQueue;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\DateTimeException;
|
||||
use daita\MySmallPhpTools\Model\Cache;
|
||||
use OCA\Social\Tools\Exceptions\DateTimeException;
|
||||
use OCA\Social\Tools\Model\Cache;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use OCP\DB\Exception as DBException;
|
||||
|
|
|
@ -31,9 +31,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\CacheItemNotFoundException;
|
||||
use daita\MySmallPhpTools\Exceptions\RowNotFoundException;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Exceptions\CacheItemNotFoundException;
|
||||
use OCA\Social\Tools\Exceptions\RowNotFoundException;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Exceptions\InvalidResourceException;
|
||||
use OCA\Social\Exceptions\ItemUnknownException;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use OCA\Social\Tools\Traits\TStringTools;
|
||||
use OCA\Social\Model\ActivityPub\Object\Note;
|
||||
use OCA\Social\Model\ActivityPub\Stream;
|
||||
use OCP\Server;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Db;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Interfaces\Actor;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Db\CacheActorsRequest;
|
||||
use OCA\Social\Db\FollowsRequest;
|
||||
use OCA\Social\Db\StreamRequest;
|
||||
|
|
|
@ -31,9 +31,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Interfaces\Object;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\CacheItemNotFoundException;
|
||||
use daita\MySmallPhpTools\Exceptions\MalformedArrayException;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Exceptions\CacheItemNotFoundException;
|
||||
use OCA\Social\Tools\Exceptions\MalformedArrayException;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use Exception;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Db\ActionsRequest;
|
||||
|
@ -44,11 +44,11 @@ use OCA\Social\Exceptions\InvalidResourceException;
|
|||
use OCA\Social\Exceptions\ItemNotFoundException;
|
||||
use OCA\Social\Exceptions\ItemUnknownException;
|
||||
use OCA\Social\Exceptions\RedundancyLimitException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestContentException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestNetworkException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultNotJsonException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultSizeException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Tools\Exceptions\RequestContentException;
|
||||
use OCA\Social\Tools\Exceptions\RequestNetworkException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultNotJsonException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultSizeException;
|
||||
use OCA\Social\Tools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Exceptions\SocialAppConfigException;
|
||||
use OCA\Social\Exceptions\StreamNotFoundException;
|
||||
use OCA\Social\Exceptions\UnauthorizedFediverseException;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Interfaces\Object;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\MalformedArrayException;
|
||||
use OCA\Social\Tools\Exceptions\MalformedArrayException;
|
||||
use Exception;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Db\FollowsRequest;
|
||||
|
@ -41,11 +41,11 @@ use OCA\Social\Exceptions\InvalidResourceException;
|
|||
use OCA\Social\Exceptions\ItemAlreadyExistsException;
|
||||
use OCA\Social\Exceptions\ItemUnknownException;
|
||||
use OCA\Social\Exceptions\RedundancyLimitException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestContentException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestNetworkException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultNotJsonException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultSizeException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Tools\Exceptions\RequestContentException;
|
||||
use OCA\Social\Tools\Exceptions\RequestNetworkException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultNotJsonException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultSizeException;
|
||||
use OCA\Social\Tools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Exceptions\SocialAppConfigException;
|
||||
use OCA\Social\Interfaces\Activity\AbstractActivityPubInterface;
|
||||
use OCA\Social\Interfaces\IActivityPubInterface;
|
||||
|
|
|
@ -30,9 +30,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model\ActivityPub;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use daita\MySmallPhpTools\Traits\TPathTools;
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TPathTools;
|
||||
use OCA\Social\Tools\Traits\TStringTools;
|
||||
use JsonSerializable;
|
||||
use OCA\Social\Exceptions\ActivityCantBeVerifiedException;
|
||||
use OCA\Social\Exceptions\InvalidOriginException;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model\ActivityPub\Actor;
|
||||
|
||||
use daita\MySmallPhpTools\IQueryRow;
|
||||
use OCA\Social\Tools\IQueryRow;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use JsonSerializable;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model\ActivityPub;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Model\ActivityPub\Actor\Person;
|
||||
use OCA\Social\Model\InstancePath;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model\ActivityPub\Object;
|
||||
|
||||
use daita\MySmallPhpTools\IQueryRow;
|
||||
use OCA\Social\Tools\IQueryRow;
|
||||
use JsonSerializable;
|
||||
use OCA\Social\Model\ActivityPub\ACore;
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model\ActivityPub;
|
||||
|
||||
use daita\MySmallPhpTools\IQueryRow;
|
||||
use daita\MySmallPhpTools\Model\Cache;
|
||||
use daita\MySmallPhpTools\Model\CacheItem;
|
||||
use OCA\Social\Tools\IQueryRow;
|
||||
use OCA\Social\Tools\Model\Cache;
|
||||
use OCA\Social\Tools\Model\CacheItem;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use JsonSerializable;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model\Client\Options;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use JsonSerializable;
|
||||
use OCP\IRequest;
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model\Client;
|
||||
|
||||
use daita\MySmallPhpTools\IQueryRow;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\IQueryRow;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use JsonSerializable;
|
||||
|
|
|
@ -30,8 +30,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model;
|
||||
|
||||
use daita\MySmallPhpTools\IQueryRow;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\IQueryRow;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use JsonSerializable;
|
||||
use OCA\Social\Model\ActivityPub\Actor\Person;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use JsonSerializable;
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use JsonSerializable;
|
||||
use OCA\Social\Exceptions\LinkedDataSignatureMissingException;
|
||||
use OCA\Social\Service\SignatureService;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use JsonSerializable;
|
||||
use OCA\Social\Model\ActivityPub\Actor\Person;
|
||||
use OCA\Social\Model\ActivityPub\Object\Document;
|
||||
|
|
|
@ -31,8 +31,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TStringTools;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use JsonSerializable;
|
||||
|
|
|
@ -31,8 +31,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TStringTools;
|
||||
use JsonSerializable;
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use JsonSerializable;
|
||||
use OCA\Social\Model\ActivityPub\Actor\Person;
|
||||
use OCA\Social\Model\ActivityPub\Stream;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use JsonSerializable;
|
||||
|
|
|
@ -30,8 +30,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Model;
|
||||
|
||||
use daita\MySmallPhpTools\Model\SimpleDataStore;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Model\SimpleDataStore;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use JsonSerializable;
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,8 +30,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Search;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\Nextcloud\nc20\TNC20Logger;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TNCLogger;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use Exception;
|
||||
use OCA\Social\Exceptions\AccountDoesNotExistException;
|
||||
use OCA\Social\Model\ActivityPub\Actor\Person;
|
||||
|
@ -60,7 +60,7 @@ class UnifiedSearchProvider implements IProvider {
|
|||
|
||||
|
||||
use TArrayTools;
|
||||
use TNC20Logger;
|
||||
use TNCLogger;
|
||||
|
||||
|
||||
private IL10N $l10n;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use Exception;
|
||||
use OC\User\NoUserException;
|
||||
use OCA\Social\Db\ActorsRequest;
|
||||
|
|
|
@ -30,14 +30,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\RequestContentException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestNetworkException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultNotJsonException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultSizeException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestServerException;
|
||||
use daita\MySmallPhpTools\Model\Nextcloud\nc20\NC20Request;
|
||||
use daita\MySmallPhpTools\Model\Request;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Exceptions\RequestContentException;
|
||||
use OCA\Social\Tools\Exceptions\RequestNetworkException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultNotJsonException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultSizeException;
|
||||
use OCA\Social\Tools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Tools\Model\NCRequest;
|
||||
use OCA\Social\Tools\Model\Request;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use Exception;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Db\FollowsRequest;
|
||||
|
@ -349,13 +349,7 @@ class ActivityService {
|
|||
return $instancePaths;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param RequestQueue $queue
|
||||
*
|
||||
* @return NC20Request
|
||||
*/
|
||||
private function generateRequestFromQueue(RequestQueue $queue): NC20Request {
|
||||
private function generateRequestFromQueue(RequestQueue $queue): NCRequest {
|
||||
$path = $queue->getInstance();
|
||||
|
||||
$requestType = Request::TYPE_GET;
|
||||
|
@ -365,7 +359,7 @@ class ActivityService {
|
|||
$requestType = Request::TYPE_POST;
|
||||
}
|
||||
|
||||
$request = new NC20Request($path->getPath(), $requestType);
|
||||
$request = new NCRequest($path->getPath(), $requestType);
|
||||
$request->setTimeout($queue->getTimeout());
|
||||
$request->setDataJson($queue->getActivity());
|
||||
$request->setHost($path->getAddress());
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Db\CacheActorsRequest;
|
||||
use OCA\Social\Db\CacheDocumentsRequest;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use OCA\Social\Tools\Traits\TStringTools;
|
||||
use Exception;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Db\StreamRequest;
|
||||
|
|
|
@ -30,14 +30,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\MalformedArrayException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestContentException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestNetworkException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultNotJsonException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultSizeException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestServerException;
|
||||
use daita\MySmallPhpTools\Traits\Nextcloud\nc20\TNC20Logger;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Exceptions\MalformedArrayException;
|
||||
use OCA\Social\Tools\Exceptions\RequestContentException;
|
||||
use OCA\Social\Tools\Exceptions\RequestNetworkException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultNotJsonException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultSizeException;
|
||||
use OCA\Social\Tools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Tools\Traits\TNCLogger;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use Exception;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Db\CacheActorsRequest;
|
||||
|
@ -60,31 +60,17 @@ use OCP\IURLGenerator;
|
|||
*/
|
||||
class CacheActorService {
|
||||
use TArrayTools;
|
||||
use TNC20Logger;
|
||||
|
||||
use TNCLogger;
|
||||
|
||||
private \OCP\IURLGenerator $urlGenerator;
|
||||
|
||||
private CacheActorsRequest $cacheActorsRequest;
|
||||
|
||||
private CurlService $curlService;
|
||||
|
||||
private FediverseService $fediverseService;
|
||||
|
||||
private ConfigService $configService;
|
||||
|
||||
private MiscService $miscService;
|
||||
|
||||
|
||||
/**
|
||||
* CacheService constructor.
|
||||
*
|
||||
* @param IUrlGenerator $urlGenerator
|
||||
* @param CacheActorsRequest $cacheActorsRequest
|
||||
* @param CurlService $curlService
|
||||
* @param FediverseService $fediverseService
|
||||
* @param ConfigService $configService
|
||||
* @param MiscService $miscService
|
||||
*/
|
||||
public function __construct(
|
||||
IUrlGenerator $urlGenerator, CacheActorsRequest $cacheActorsRequest, CurlService $curlService,
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
/**
|
||||
* Nextcloud - Social Support
|
||||
*
|
||||
|
@ -30,15 +29,15 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\MalformedArrayException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestContentException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestNetworkException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultSizeException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestServerException;
|
||||
use daita\MySmallPhpTools\Model\Nextcloud\nc20\NC20Request;
|
||||
use daita\MySmallPhpTools\Model\Request;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use OCA\Social\Tools\Exceptions\MalformedArrayException;
|
||||
use OCA\Social\Tools\Exceptions\RequestContentException;
|
||||
use OCA\Social\Tools\Exceptions\RequestNetworkException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultSizeException;
|
||||
use OCA\Social\Tools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Tools\Model\NCRequest;
|
||||
use OCA\Social\Tools\Model\Request;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TStringTools;
|
||||
use Exception;
|
||||
use Gumlet\ImageResize;
|
||||
use Gumlet\ImageResizeException;
|
||||
|
@ -57,27 +56,14 @@ class CacheDocumentService {
|
|||
use TArrayTools;
|
||||
use TStringTools;
|
||||
|
||||
|
||||
public const RESIZED_WIDTH = 280;
|
||||
public const RESIZED_HEIGHT = 180;
|
||||
|
||||
private IAppData $appData;
|
||||
|
||||
private CurlService $curlService;
|
||||
|
||||
private ConfigService $configService;
|
||||
|
||||
private MiscService $miscService;
|
||||
|
||||
|
||||
/**
|
||||
* CacheService constructor.
|
||||
*
|
||||
* @param IAppData $appData
|
||||
* @param CurlService $curlService
|
||||
* @param ConfigService $configService
|
||||
* @param MiscService $miscService
|
||||
*/
|
||||
public function __construct(
|
||||
IAppData $appData, CurlService $curlService, ConfigService $configService,
|
||||
MiscService $miscService
|
||||
|
@ -90,9 +76,7 @@ class CacheDocumentService {
|
|||
|
||||
|
||||
/**
|
||||
* @param Document $document
|
||||
* @param string $uploaded
|
||||
* @param string $mime
|
||||
* @brief Save the local upload to the cache
|
||||
*
|
||||
* @throws CacheContentMimeTypeException
|
||||
* @throws NotFoundException
|
||||
|
@ -265,7 +249,7 @@ class CacheDocumentService {
|
|||
public function retrieveContent(string $url): string {
|
||||
$url = parse_url($url);
|
||||
$this->mustContains(['path', 'host', 'scheme'], $url);
|
||||
$request = new NC20Request($url['path'], Request::TYPE_GET, true);
|
||||
$request = new NCRequest($url['path'], Request::TYPE_GET, true);
|
||||
$request->setHost($url['host']);
|
||||
$request->setProtocol($url['scheme']);
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TStringTools;
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use OC\User\NoUserException;
|
||||
|
|
|
@ -30,7 +30,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use OCA\Social\Tools\Traits\TStringTools;
|
||||
use Exception;
|
||||
use OCA\Social\Db\ClientRequest;
|
||||
use OCA\Social\Exceptions\ClientException;
|
||||
|
|
|
@ -31,10 +31,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Model\Nextcloud\nc20\NC20Request;
|
||||
use daita\MySmallPhpTools\Model\Request;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use daita\MySmallPhpTools\Traits\TPathTools;
|
||||
use OCA\Social\Tools\Model\NCRequest;
|
||||
use OCA\Social\Tools\Model\Request;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TPathTools;
|
||||
use OCA\Social\AppInfo\Application;
|
||||
use OCA\Social\Exceptions\SocialAppConfigException;
|
||||
use OCP\IConfig;
|
||||
|
@ -412,10 +412,7 @@ class ConfigService {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param NC20Request $request
|
||||
*/
|
||||
public function configureRequest(NC20Request $request) {
|
||||
public function configureRequest(NCRequest $request): void {
|
||||
$request->setVerifyPeer($this->getAppValue(ConfigService::SOCIAL_SELF_SIGNED) !== '1');
|
||||
|
||||
if ($request->getType() === Request::TYPE_GET) {
|
||||
|
|
|
@ -30,18 +30,20 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\ArrayNotFoundException;
|
||||
use daita\MySmallPhpTools\Exceptions\MalformedArrayException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestContentException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestNetworkException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultNotJsonException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultSizeException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestServerException;
|
||||
use daita\MySmallPhpTools\Model\Nextcloud\nc20\NC20Request;
|
||||
use daita\MySmallPhpTools\Model\Request;
|
||||
use daita\MySmallPhpTools\Traits\Nextcloud\nc20\TNC20Request;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use daita\MySmallPhpTools\Traits\TPathTools;
|
||||
use OCA\Social\Tools\Exceptions\ArrayNotFoundException;
|
||||
use OCA\Social\Tools\Exceptions\MalformedArrayException;
|
||||
use OCA\Social\Tools\Exceptions\RequestContentException;
|
||||
use OCA\Social\Tools\Exceptions\RequestNetworkException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultNotJsonException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultSizeException;
|
||||
use OCA\Social\Tools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Tools\Model\NCRequest;
|
||||
use OCA\Social\Tools\Model\Request;
|
||||
use OCA\Social\Tools\Traits\TNCRequest;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TPathTools;
|
||||
use OCA\Social\Tools\Traits\TNCSetup;
|
||||
use OCA\Social\Tools\Traits\TNCLogger;
|
||||
use Exception;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Exceptions\HostMetaException;
|
||||
|
@ -56,8 +58,10 @@ use OCA\Social\Model\ActivityPub\Actor\Person;
|
|||
|
||||
class CurlService {
|
||||
use TArrayTools;
|
||||
use TNCSetup;
|
||||
use TNCLogger;
|
||||
use TPathTools;
|
||||
use TNC20Request {
|
||||
use TNCRequest {
|
||||
retrieveJson as retrieveJsonOrig;
|
||||
doRequest as doRequestOrig;
|
||||
}
|
||||
|
@ -126,7 +130,7 @@ class CurlService {
|
|||
$path = '/.well-known/webfinger';
|
||||
}
|
||||
|
||||
$request = new NC20Request($path);
|
||||
$request = new NCRequest($path);
|
||||
$request->addParam('resource', 'acct:' . $account);
|
||||
$request->setHost($host);
|
||||
$request->setProtocols($protocols);
|
||||
|
@ -152,7 +156,7 @@ class CurlService {
|
|||
* @throws HostMetaException
|
||||
*/
|
||||
public function hostMeta(string &$host, array &$protocols): string {
|
||||
$request = new NC20Request('/.well-known/host-meta');
|
||||
$request = new NCRequest('/.well-known/host-meta');
|
||||
$request->setHost($host);
|
||||
$request->setProtocols($protocols);
|
||||
|
||||
|
@ -243,7 +247,7 @@ class CurlService {
|
|||
$this->debug('retrieveObject', ['id' => $id]);
|
||||
$url = parse_url($id);
|
||||
$this->mustContains(['path', 'host', 'scheme'], $url);
|
||||
$request = new NC20Request($url['path'], Request::TYPE_GET);
|
||||
$request = new NCRequest($url['path'], Request::TYPE_GET);
|
||||
$request->setHost($url['host']);
|
||||
$request->setProtocol($url['scheme']);
|
||||
|
||||
|
@ -261,13 +265,13 @@ class CurlService {
|
|||
|
||||
|
||||
/**
|
||||
* @param NC20Request $request
|
||||
* @param NCRequest $request
|
||||
*
|
||||
* @return array
|
||||
* @throws RequestContentException
|
||||
* @throws RequestNetworkException
|
||||
*/
|
||||
public function retrieveJson(NC20Request $request): array {
|
||||
public function retrieveJson(NCRequest $request): array {
|
||||
try {
|
||||
return $this->retrieveJsonOrig($request);
|
||||
} catch (RequestNetworkException | RequestContentException $e) {
|
||||
|
@ -278,9 +282,8 @@ class CurlService {
|
|||
|
||||
|
||||
/**
|
||||
* @param NC20Request $request
|
||||
* @param NCRequest $request
|
||||
*
|
||||
* @return mixed
|
||||
* @throws SocialAppConfigException
|
||||
* @throws UnauthorizedFediverseException
|
||||
* @throws RequestContentException
|
||||
|
@ -289,7 +292,7 @@ class CurlService {
|
|||
* @throws RequestServerException
|
||||
*/
|
||||
// migration ?
|
||||
public function doRequest(NC20Request $request) {
|
||||
public function doRequest(NCRequest $request): string {
|
||||
$this->fediverseService->authorized($request->getAddress());
|
||||
$this->configService->configureRequest($request);
|
||||
$this->assignUserAgent($request);
|
||||
|
@ -299,9 +302,9 @@ class CurlService {
|
|||
|
||||
|
||||
/**
|
||||
* @param NC20Request $request
|
||||
* @param NCRequest $request
|
||||
*/
|
||||
public function assignUserAgent(NC20Request $request) {
|
||||
public function assignUserAgent(NCRequest $request): void {
|
||||
$request->setUserAgent(
|
||||
self::USER_AGENT . ' ' . $this->configService->getAppValue('installed_version')
|
||||
);
|
||||
|
@ -320,7 +323,7 @@ class CurlService {
|
|||
$path .= $this->withoutBeginSlash(self::ASYNC_REQUEST_TOKEN);
|
||||
$path = str_replace('{token}', $token, $path);
|
||||
|
||||
$request = new NC20Request($path, Request::TYPE_POST);
|
||||
$request = new NCRequest($path, Request::TYPE_POST);
|
||||
$request->setHost($this->configService->getCloudHost());
|
||||
$request->setProtocol(parse_url($address, PHP_URL_SCHEME));
|
||||
|
||||
|
|
|
@ -31,12 +31,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\MalformedArrayException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestContentException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestNetworkException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultNotJsonException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultSizeException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Tools\Exceptions\MalformedArrayException;
|
||||
use OCA\Social\Tools\Exceptions\RequestContentException;
|
||||
use OCA\Social\Tools\Exceptions\RequestNetworkException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultNotJsonException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultSizeException;
|
||||
use OCA\Social\Tools\Exceptions\RequestServerException;
|
||||
use Exception;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Db\ActorsRequest;
|
||||
|
|
|
@ -30,8 +30,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\MalformedArrayException;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Exceptions\MalformedArrayException;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Db\FollowsRequest;
|
||||
use OCA\Social\Exceptions\CacheActorDoesNotExistException;
|
||||
|
@ -41,11 +41,11 @@ use OCA\Social\Exceptions\InvalidOriginException;
|
|||
use OCA\Social\Exceptions\InvalidResourceException;
|
||||
use OCA\Social\Exceptions\ItemUnknownException;
|
||||
use OCA\Social\Exceptions\RedundancyLimitException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestContentException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestNetworkException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultNotJsonException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultSizeException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Tools\Exceptions\RequestContentException;
|
||||
use OCA\Social\Tools\Exceptions\RequestNetworkException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultNotJsonException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultSizeException;
|
||||
use OCA\Social\Tools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Exceptions\RetrieveAccountFormatException;
|
||||
use OCA\Social\Exceptions\SocialAppConfigException;
|
||||
use OCA\Social\Exceptions\UnauthorizedFediverseException;
|
||||
|
|
|
@ -31,8 +31,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\DateTimeException;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Exceptions\DateTimeException;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Db\HashtagsRequest;
|
||||
use OCA\Social\Db\StreamRequest;
|
||||
use OCA\Social\Exceptions\HashtagDoesNotExistException;
|
||||
|
|
|
@ -31,8 +31,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TStringTools;
|
||||
use Exception;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Exceptions\ActivityPubFormatException;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\AppInfo\Application;
|
||||
use OCA\Social\Db\InstancesRequest;
|
||||
use OCA\Social\Exceptions\InstanceDoesNotExistException;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use OCA\Social\Tools\Traits\TStringTools;
|
||||
use Exception;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Db\StreamRequest;
|
||||
|
|
|
@ -30,12 +30,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\MalformedArrayException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestContentException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestNetworkException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultNotJsonException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultSizeException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Tools\Exceptions\MalformedArrayException;
|
||||
use OCA\Social\Tools\Exceptions\RequestContentException;
|
||||
use OCA\Social\Tools\Exceptions\RequestNetworkException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultNotJsonException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultSizeException;
|
||||
use OCA\Social\Tools\Exceptions\RequestServerException;
|
||||
use Exception;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Exceptions\CacheContentMimeTypeException;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TAsync;
|
||||
use OCA\Social\Tools\Traits\TAsync;
|
||||
use OC;
|
||||
//use OC\Push\Model\Helper\PushCallback;
|
||||
use OCA\Social\Exceptions\SocialAppConfigException;
|
||||
|
|
|
@ -31,7 +31,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Db\RequestQueueRequest;
|
||||
use OCA\Social\Exceptions\EmptyQueueException;
|
||||
use OCA\Social\Exceptions\NoHighPriorityRequestException;
|
||||
|
|
|
@ -31,8 +31,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Traits\Nextcloud\nc20\TNC20Logger;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TNCLogger;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use Exception;
|
||||
use OCA\Social\Model\ActivityPub\Actor\Person;
|
||||
|
||||
|
@ -43,7 +43,7 @@ use OCA\Social\Model\ActivityPub\Actor\Person;
|
|||
*/
|
||||
class SearchService {
|
||||
use TArrayTools;
|
||||
use TNC20Logger;
|
||||
use TNCLogger;
|
||||
|
||||
|
||||
public const SEARCH_ACCOUNTS = 1;
|
||||
|
|
|
@ -30,15 +30,15 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\DateTimeException;
|
||||
use daita\MySmallPhpTools\Exceptions\MalformedArrayException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestContentException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestNetworkException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultNotJsonException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultSizeException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestServerException;
|
||||
use daita\MySmallPhpTools\Model\Nextcloud\nc20\NC20Request;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Exceptions\DateTimeException;
|
||||
use OCA\Social\Tools\Exceptions\MalformedArrayException;
|
||||
use OCA\Social\Tools\Exceptions\RequestContentException;
|
||||
use OCA\Social\Tools\Exceptions\RequestNetworkException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultNotJsonException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultSizeException;
|
||||
use OCA\Social\Tools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Tools\Model\NCRequest;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use JsonLdException;
|
||||
|
@ -119,13 +119,13 @@ class SignatureService {
|
|||
|
||||
|
||||
/**
|
||||
* @param NC20Request $request
|
||||
* @param NCRequest $request
|
||||
* @param RequestQueue $queue
|
||||
*
|
||||
* @throws ActorDoesNotExistException
|
||||
* @throws SocialAppConfigException // TODO: implement in TNC20Request ?
|
||||
* @throws SocialAppConfigException // TODO: implement in TNCRequest ?
|
||||
*/
|
||||
public function signRequest(NC20Request $request, RequestQueue $queue) {
|
||||
public function signRequest(NCRequest $request, RequestQueue $queue): void {
|
||||
$date = gmdate(self::DATE_HEADER);
|
||||
$path = $queue->getInstance();
|
||||
|
||||
|
@ -153,11 +153,11 @@ class SignatureService {
|
|||
/**
|
||||
* @param array $elements
|
||||
* @param array $data
|
||||
* @param NC20Request $request
|
||||
* @param NCRequest $request
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function generateHeaders(array $elements, array $data, NC20Request $request): string {
|
||||
private function generateHeaders(array $elements, array $data, NCRequest $request): string {
|
||||
$signingElements = [];
|
||||
foreach ($elements as $element) {
|
||||
$signingElements[] = $element . ': ' . $data[$element];
|
||||
|
|
|
@ -30,9 +30,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\MalformedArrayException;
|
||||
use daita\MySmallPhpTools\Model\Cache;
|
||||
use daita\MySmallPhpTools\Model\CacheItem;
|
||||
use OCA\Social\Tools\Exceptions\MalformedArrayException;
|
||||
use OCA\Social\Tools\Model\Cache;
|
||||
use OCA\Social\Tools\Model\CacheItem;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Db\StreamRequest;
|
||||
use OCA\Social\Db\StreamQueueRequest;
|
||||
|
@ -42,11 +42,11 @@ use OCA\Social\Exceptions\ItemUnknownException;
|
|||
use OCA\Social\Exceptions\StreamNotFoundException;
|
||||
use OCA\Social\Exceptions\QueueStatusException;
|
||||
use OCA\Social\Exceptions\RedundancyLimitException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestContentException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestNetworkException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultNotJsonException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultSizeException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Tools\Exceptions\RequestContentException;
|
||||
use OCA\Social\Tools\Exceptions\RequestNetworkException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultNotJsonException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultSizeException;
|
||||
use OCA\Social\Tools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Exceptions\SocialAppConfigException;
|
||||
use OCA\Social\Exceptions\UnauthorizedFediverseException;
|
||||
use OCA\Social\Model\ActivityPub\Object\Note;
|
||||
|
|
|
@ -30,13 +30,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\DateTimeException;
|
||||
use daita\MySmallPhpTools\Exceptions\MalformedArrayException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestContentException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestNetworkException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultNotJsonException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestResultSizeException;
|
||||
use daita\MySmallPhpTools\Exceptions\RequestServerException;
|
||||
use OCA\Social\Tools\Exceptions\DateTimeException;
|
||||
use OCA\Social\Tools\Exceptions\MalformedArrayException;
|
||||
use OCA\Social\Tools\Exceptions\RequestContentException;
|
||||
use OCA\Social\Tools\Exceptions\RequestNetworkException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultNotJsonException;
|
||||
use OCA\Social\Tools\Exceptions\RequestResultSizeException;
|
||||
use OCA\Social\Tools\Exceptions\RequestServerException;
|
||||
use Exception;
|
||||
use OCA\Social\Db\StreamRequest;
|
||||
use OCA\Social\Exceptions\InvalidOriginException;
|
||||
|
|
|
@ -30,10 +30,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use daita\MySmallPhpTools\Exceptions\ArrayNotFoundException;
|
||||
use daita\MySmallPhpTools\Model\Nextcloud\nc20\NC20Request;
|
||||
use daita\MySmallPhpTools\Model\SimpleDataStore;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Exceptions\ArrayNotFoundException;
|
||||
use OCA\Social\Tools\Model\NCRequest;
|
||||
use OCA\Social\Tools\Model\SimpleDataStore;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use Exception;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Exceptions\HostMetaException;
|
||||
|
@ -102,7 +102,7 @@ class TestService {
|
|||
$tests->aObj('tests', $testHostMeta);
|
||||
|
||||
|
||||
$request = new NC20Request($path);
|
||||
$request = new NCRequest($path);
|
||||
$request->addParam('resource', 'acct:' . $account);
|
||||
$request->setHost($host);
|
||||
$request->setProtocols($protocols);
|
||||
|
|
|
@ -0,0 +1,527 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Db;
|
||||
|
||||
use OCA\Social\Tools\Exceptions\DateTimeException;
|
||||
use OCA\Social\Tools\Exceptions\RowNotFoundException;
|
||||
use OCA\Social\Tools\IExtendedQueryBuilder;
|
||||
use OCA\Social\Tools\IQueryRow;
|
||||
use DateInterval;
|
||||
use DateTime;
|
||||
use Doctrine\DBAL\Query\QueryBuilder as DBALQueryBuilder;
|
||||
use Exception;
|
||||
use OC\DB\QueryBuilder\QueryBuilder;
|
||||
use OCP\DB\QueryBuilder\ICompositeExpression;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\DB\QueryBuilder\IQueryFunction;
|
||||
|
||||
/**
|
||||
* Class ExtendedQueryBuilder
|
||||
*
|
||||
* @package OCA\Social\Tools\Db
|
||||
*/
|
||||
class ExtendedQueryBuilder extends QueryBuilder implements IExtendedQueryBuilder {
|
||||
|
||||
|
||||
/** @var string */
|
||||
private $defaultSelectAlias = '';
|
||||
|
||||
|
||||
/**
|
||||
* @param string $alias
|
||||
*
|
||||
* @return IExtendedQueryBuilder
|
||||
*/
|
||||
public function setDefaultSelectAlias(string $alias): IExtendedQueryBuilder {
|
||||
$this->defaultSelectAlias = $alias;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultSelectAlias(): string {
|
||||
return $this->defaultSelectAlias;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Limit the request to the Id
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return ExtendedQueryBuilder
|
||||
*/
|
||||
public function limitToId(int $id): IExtendedQueryBuilder {
|
||||
$this->limitToDBFieldInt('id', $id);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $ids
|
||||
*
|
||||
* @return IExtendedQueryBuilder
|
||||
*/
|
||||
public function limitToIds(array $ids): IExtendedQueryBuilder {
|
||||
$this->limitToDBFieldArray('id', $ids);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Limit the request to the Id (string)
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return ExtendedQueryBuilder
|
||||
*/
|
||||
public function limitToIdString(string $id): IExtendedQueryBuilder {
|
||||
$this->limitToDBField('id', $id, false);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Limit the request to the UserId
|
||||
*
|
||||
* @param string $userId
|
||||
*
|
||||
* @return ExtendedQueryBuilder
|
||||
*/
|
||||
public function limitToUserId(string $userId): IExtendedQueryBuilder {
|
||||
$this->limitToDBField('user_id', $userId, false);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Limit the request to the creation
|
||||
*
|
||||
* @param int $delay
|
||||
*
|
||||
* @return ExtendedQueryBuilder
|
||||
* @throws Exception
|
||||
*/
|
||||
public function limitToCreation(int $delay = 0): IExtendedQueryBuilder {
|
||||
$date = new DateTime('now');
|
||||
$date->sub(new DateInterval('PT' . $delay . 'M'));
|
||||
|
||||
$this->limitToDBFieldDateTime('creation', $date, true);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param string $value
|
||||
* @param bool $cs - case sensitive
|
||||
* @param string $alias
|
||||
*/
|
||||
public function limitToDBField(string $field, string $value, bool $cs = true, string $alias = '') {
|
||||
$expr = $this->exprLimitToDBField($field, $value, true, $cs, $alias);
|
||||
|
||||
$this->andWhere($expr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param string $value
|
||||
* @param bool $cs - case sensitive
|
||||
* @param string $alias
|
||||
*/
|
||||
public function filterDBField(string $field, string $value, bool $cs = true, string $alias = ''
|
||||
) {
|
||||
$expr = $this->exprLimitToDBField($field, $value, false, $cs, $alias);
|
||||
$this->andWhere($expr);
|
||||
}
|
||||
|
||||
public function exprLimitToDBField(
|
||||
string $field, string $value, bool $eq = true, bool $cs = true, string $alias = ''
|
||||
): IQueryFunction {
|
||||
$expr = $this->expr();
|
||||
|
||||
$pf = '';
|
||||
if ($this->getType() === DBALQueryBuilder::SELECT) {
|
||||
$pf = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.';
|
||||
}
|
||||
$field = $pf . $field;
|
||||
|
||||
$comp = 'eq';
|
||||
if ($eq === false) {
|
||||
$comp = 'neq';
|
||||
}
|
||||
|
||||
if ($cs) {
|
||||
return $expr->$comp($field, $this->createNamedParameter($value));
|
||||
} else {
|
||||
$func = $this->func();
|
||||
|
||||
return $expr->$comp(
|
||||
$func->lower($field), $func->lower($this->createNamedParameter($value))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param array $values
|
||||
* @param bool $cs - case sensitive
|
||||
* @param string $alias
|
||||
*/
|
||||
public function limitToDBFieldArray(
|
||||
string $field, array $values, bool $cs = true, string $alias = ''
|
||||
) {
|
||||
$expr = $this->exprLimitToDBFieldArray($field, $values, true, $cs, $alias);
|
||||
$this->andWhere($expr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param string $value
|
||||
* @param bool $cs - case sensitive
|
||||
* @param string $alias
|
||||
*/
|
||||
public function filterDBFieldArray(
|
||||
string $field, string $value, bool $cs = true, string $alias = ''
|
||||
) {
|
||||
$expr = $this->exprLimitToDBField($field, $value, false, $cs, $alias);
|
||||
$this->andWhere($expr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param array $values
|
||||
* @param bool $eq
|
||||
* @param bool $cs
|
||||
* @param string $alias
|
||||
*
|
||||
* @return ICompositeExpression
|
||||
*/
|
||||
public function exprLimitToDBFieldArray(
|
||||
string $field, array $values, bool $eq = true, bool $cs = true, string $alias = ''
|
||||
): ICompositeExpression {
|
||||
$expr = $this->expr();
|
||||
|
||||
$pf = '';
|
||||
if ($this->getType() === DBALQueryBuilder::SELECT) {
|
||||
$pf = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.';
|
||||
}
|
||||
$field = $pf . $field;
|
||||
|
||||
$func = $this->func();
|
||||
if ($eq === false) {
|
||||
$comp = 'neq';
|
||||
$junc = $expr->andX();
|
||||
} else {
|
||||
$comp = 'eq';
|
||||
$junc = $expr->orX();
|
||||
}
|
||||
|
||||
foreach ($values as $value) {
|
||||
if ($cs) {
|
||||
$junc->add($expr->$comp($field, $this->createNamedParameter($value)));
|
||||
} else {
|
||||
$junc->add(
|
||||
$expr->$comp(
|
||||
$func->lower($field), $func->lower($this->createNamedParameter($value))
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $junc;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param int $value
|
||||
* @param string $alias
|
||||
*/
|
||||
public function limitToDBFieldInt(string $field, int $value, string $alias = '') {
|
||||
$expr = $this->exprLimitToDBFieldInt($field, $value, $alias, true);
|
||||
$this->andWhere($expr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param int $value
|
||||
* @param string $alias
|
||||
*/
|
||||
public function filterDBFieldInt(string $field, int $value, string $alias = '') {
|
||||
$expr = $this->exprLimitToDBFieldInt($field, $value, $alias, false);
|
||||
$this->andWhere($expr);
|
||||
}
|
||||
|
||||
public function exprLimitToDBFieldInt(string $field, int $value, string $alias = '', bool $eq = true
|
||||
): IQueryFunction {
|
||||
$expr = $this->expr();
|
||||
|
||||
$pf = '';
|
||||
if ($this->getType() === DBALQueryBuilder::SELECT) {
|
||||
$pf = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.';
|
||||
}
|
||||
$field = $pf . $field;
|
||||
|
||||
$comp = 'eq';
|
||||
if ($eq === false) {
|
||||
$comp = 'neq';
|
||||
}
|
||||
|
||||
return $expr->$comp($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
*/
|
||||
public function limitToDBFieldEmpty(string $field) {
|
||||
$expr = $this->expr();
|
||||
$pf =
|
||||
($this->getType() === DBALQueryBuilder::SELECT) ? $this->getDefaultSelectAlias()
|
||||
. '.' : '';
|
||||
$field = $pf . $field;
|
||||
|
||||
$this->andWhere($expr->eq($field, $this->createNamedParameter('')));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
*/
|
||||
public function filterDBFieldEmpty(string $field) {
|
||||
$expr = $this->expr();
|
||||
$pf =
|
||||
($this->getType() === DBALQueryBuilder::SELECT) ? $this->getDefaultSelectAlias()
|
||||
. '.' : '';
|
||||
$field = $pf . $field;
|
||||
|
||||
$this->andWhere($expr->neq($field, $this->createNamedParameter('')));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param DateTime $date
|
||||
* @param bool $orNull
|
||||
*/
|
||||
public function limitToDBFieldDateTime(string $field, DateTime $date, bool $orNull = false) {
|
||||
$expr = $this->expr();
|
||||
$pf =
|
||||
($this->getType() === DBALQueryBuilder::SELECT) ? $this->getDefaultSelectAlias()
|
||||
. '.' : '';
|
||||
$field = $pf . $field;
|
||||
|
||||
$orX = $expr->orX();
|
||||
$orX->add(
|
||||
$expr->lte($field, $this->createNamedParameter($date, IQueryBuilder::PARAM_DATE))
|
||||
);
|
||||
|
||||
if ($orNull === true) {
|
||||
$orX->add($expr->isNull($field));
|
||||
}
|
||||
|
||||
$this->andWhere($orX);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param int $timestamp
|
||||
* @param string $field
|
||||
*
|
||||
* @throws DateTimeException
|
||||
*/
|
||||
public function limitToSince(int $timestamp, string $field) {
|
||||
try {
|
||||
$dTime = new DateTime();
|
||||
$dTime->setTimestamp($timestamp);
|
||||
} catch (Exception $e) {
|
||||
throw new DateTimeException($e->getMessage());
|
||||
}
|
||||
|
||||
$expr = $this->expr();
|
||||
$pf = ($this->getType() === DBALQueryBuilder::SELECT) ? $this->getDefaultSelectAlias() . '.' : '';
|
||||
$field = $pf . $field;
|
||||
|
||||
$orX = $expr->orX();
|
||||
$orX->add(
|
||||
$expr->gte($field, $this->createNamedParameter($dTime, IQueryBuilder::PARAM_DATE))
|
||||
);
|
||||
|
||||
$this->andWhere($orX);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param string $value
|
||||
*/
|
||||
public function searchInDBField(string $field, string $value) {
|
||||
$expr = $this->expr();
|
||||
|
||||
$pf = ($this->getType() === DBALQueryBuilder::SELECT) ? $this->getDefaultSelectAlias()
|
||||
. '.' : '';
|
||||
$field = $pf . $field;
|
||||
|
||||
$this->andWhere($expr->iLike($field, $this->createNamedParameter($value)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param string $fieldRight
|
||||
* @param string $alias
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function exprFieldWithinJsonFormat(
|
||||
IQueryBuilder $qb, string $field, string $fieldRight, string $alias = ''
|
||||
) {
|
||||
$func = $qb->func();
|
||||
$expr = $qb->expr();
|
||||
|
||||
if ($alias === '') {
|
||||
$alias = $this->defaultSelectAlias;
|
||||
}
|
||||
|
||||
$concat = $func->concat(
|
||||
$qb->createNamedParameter('%"'),
|
||||
$func->concat($fieldRight, $qb->createNamedParameter('"%'))
|
||||
);
|
||||
|
||||
return $expr->iLike($alias . '.' . $field, $concat);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param string $value
|
||||
* @param bool $eq (eq, not eq)
|
||||
* @param bool $cs (case sensitive, or not)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function exprValueWithinJsonFormat(
|
||||
IQueryBuilder $qb, string $field, string $value, bool $eq = true, bool $cs = true
|
||||
): string {
|
||||
$dbConn = $this->getConnection();
|
||||
$expr = $qb->expr();
|
||||
$func = $qb->func();
|
||||
|
||||
$value = $dbConn->escapeLikeParameter($value);
|
||||
if ($cs) {
|
||||
$field = $func->lower($field);
|
||||
$value = $func->lower($value);
|
||||
}
|
||||
|
||||
$comp = 'iLike';
|
||||
if ($eq) {
|
||||
$comp = 'notLike';
|
||||
}
|
||||
|
||||
return $expr->$comp($field, $qb->createNamedParameter('%"' . $value . '"%'));
|
||||
}
|
||||
|
||||
//
|
||||
// /**
|
||||
// * @param IQueryBuilder $qb
|
||||
// * @param string $field
|
||||
// * @param string $value
|
||||
// *
|
||||
// * @return string
|
||||
// */
|
||||
// public function exprValueNotWithinJsonFormat(IQueryBuilder $qb, string $field, string $value): string {
|
||||
// $dbConn = $this->getConnection();
|
||||
// $expr = $qb->expr();
|
||||
// $func = $qb->func();
|
||||
//
|
||||
//
|
||||
// return $expr->notLike(
|
||||
// $func->lower($field),
|
||||
// $qb->createNamedParameter(
|
||||
// '%"' . $func->lower($dbConn->escapeLikeParameter($value)) . '"%'
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* @param callable $method
|
||||
*
|
||||
* @return IQueryRow
|
||||
* @throws RowNotFoundException
|
||||
*/
|
||||
public function getRow(callable $method): IQueryRow {
|
||||
$cursor = $this->execute();
|
||||
$data = $cursor->fetch();
|
||||
$cursor->closeCursor();
|
||||
|
||||
if ($data === false) {
|
||||
throw new RowNotFoundException();
|
||||
}
|
||||
|
||||
return $method($data, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable $method
|
||||
*
|
||||
* @return IQueryRow[]
|
||||
*/
|
||||
public function getRows(callable $method): array {
|
||||
$rows = [];
|
||||
$cursor = $this->execute();
|
||||
while ($data = $cursor->fetch()) {
|
||||
try {
|
||||
$rows[] = $method($data, $this);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
}
|
||||
$cursor->closeCursor();
|
||||
|
||||
return $rows;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,331 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Db;
|
||||
|
||||
use DateInterval;
|
||||
use DateTime;
|
||||
use Doctrine\DBAL\Query\QueryBuilder;
|
||||
use Exception;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
|
||||
/**
|
||||
* Class RequestBuilder
|
||||
* @deprecated - 19
|
||||
* @package OCA\Social\Tools\Db
|
||||
*/
|
||||
class RequestBuilder {
|
||||
|
||||
|
||||
/** @var string */
|
||||
protected $defaultSelectAlias;
|
||||
|
||||
|
||||
/**
|
||||
* Limit the request to the Id
|
||||
*
|
||||
* @param IQueryBuilder $qb
|
||||
* @param int $id
|
||||
*/
|
||||
protected function limitToId(IQueryBuilder $qb, int $id) {
|
||||
$this->limitToDBFieldInt($qb, 'id', $id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Limit the request to the Id (string)
|
||||
*
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $id
|
||||
*/
|
||||
protected function limitToIdString(IQueryBuilder $qb, string $id) {
|
||||
$this->limitToDBField($qb, 'id', $id, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Limit the request to the UserId
|
||||
*
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $userId
|
||||
*/
|
||||
protected function limitToUserId(IQueryBuilder $qb, string $userId) {
|
||||
$this->limitToDBField($qb, 'user_id', $userId, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Limit the request to the creation
|
||||
*
|
||||
* @param IQueryBuilder $qb
|
||||
* @param int $delay
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function limitToCreation(IQueryBuilder $qb, int $delay = 0) {
|
||||
$date = new DateTime('now');
|
||||
$date->sub(new DateInterval('PT' . $delay . 'M'));
|
||||
|
||||
$this->limitToDBFieldDateTime($qb, 'creation', $date, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param string $value
|
||||
* @param bool $cs - case sensitive
|
||||
* @param string $alias
|
||||
*/
|
||||
protected function limitToDBField(
|
||||
IQueryBuilder $qb, string $field, string $value, bool $cs = true, string $alias = ''
|
||||
) {
|
||||
$expr = $this->exprLimitToDBField($qb, $field, $value, true, $cs, $alias);
|
||||
$qb->andWhere($expr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param string $value
|
||||
* @param bool $cs - case sensitive
|
||||
* @param string $alias
|
||||
*/
|
||||
protected function filterDBField(
|
||||
IQueryBuilder $qb, string $field, string $value, bool $cs = true, string $alias = ''
|
||||
) {
|
||||
$expr = $this->exprLimitToDBField($qb, $field, $value, false, $cs, $alias);
|
||||
$qb->andWhere($expr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param string $value
|
||||
* @param bool $eq
|
||||
* @param bool $cs
|
||||
* @param string $alias
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function exprLimitToDBField(
|
||||
IQueryBuilder $qb, string $field, string $value, bool $eq = true, bool $cs = true, string $alias = ''
|
||||
): string {
|
||||
$expr = $qb->expr();
|
||||
|
||||
$pf = '';
|
||||
if ($qb->getType() === QueryBuilder::SELECT) {
|
||||
$pf = (($alias === '') ? $this->defaultSelectAlias : $alias) . '.';
|
||||
}
|
||||
$field = $pf . $field;
|
||||
|
||||
$comp = 'eq';
|
||||
if ($eq === false) {
|
||||
$comp = 'neq';
|
||||
}
|
||||
|
||||
if ($cs) {
|
||||
return $expr->$comp($field, $qb->createNamedParameter($value));
|
||||
} else {
|
||||
$func = $qb->func();
|
||||
|
||||
return $expr->$comp(
|
||||
$func->lower($field), $func->lower($qb->createNamedParameter($value))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param int $value
|
||||
* @param string $alias
|
||||
*/
|
||||
protected function limitToDBFieldInt(
|
||||
IQueryBuilder $qb, string $field, int $value, string $alias = ''
|
||||
) {
|
||||
$expr = $this->exprLimitToDBFieldInt($qb, $field, $value, $alias, true);
|
||||
$qb->andWhere($expr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param int $value
|
||||
* @param string $alias
|
||||
*/
|
||||
protected function filterDBFieldInt(
|
||||
IQueryBuilder $qb, string $field, int $value, string $alias = ''
|
||||
) {
|
||||
$expr = $this->exprLimitToDBFieldInt($qb, $field, $value, $alias, false);
|
||||
$qb->andWhere($expr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param int $value
|
||||
* @param string $alias
|
||||
*
|
||||
* @param bool $eq
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function exprLimitToDBFieldInt(
|
||||
IQueryBuilder $qb, string $field, int $value, string $alias = '', bool $eq = true
|
||||
): string {
|
||||
$expr = $qb->expr();
|
||||
|
||||
$pf = '';
|
||||
if ($qb->getType() === QueryBuilder::SELECT) {
|
||||
$pf = (($alias === '') ? $this->defaultSelectAlias : $alias) . '.';
|
||||
}
|
||||
$field = $pf . $field;
|
||||
|
||||
$comp = 'eq';
|
||||
if ($eq === false) {
|
||||
$comp = 'neq';
|
||||
}
|
||||
|
||||
return $expr->$comp($field, $qb->createNamedParameter($value));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
*/
|
||||
protected function limitToDBFieldEmpty(IQueryBuilder $qb, string $field) {
|
||||
$expr = $qb->expr();
|
||||
$pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->defaultSelectAlias . '.' : '';
|
||||
$field = $pf . $field;
|
||||
|
||||
$qb->andWhere($expr->eq($field, $qb->createNamedParameter('')));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
*/
|
||||
protected function filterDBFieldEmpty(IQueryBuilder $qb, string $field) {
|
||||
$expr = $qb->expr();
|
||||
$pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->defaultSelectAlias . '.' : '';
|
||||
$field = $pf . $field;
|
||||
|
||||
$qb->andWhere($expr->neq($field, $qb->createNamedParameter('')));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param DateTime $date
|
||||
* @param bool $orNull
|
||||
*/
|
||||
protected function limitToDBFieldDateTime(
|
||||
IQueryBuilder $qb, string $field, DateTime $date, bool $orNull = false
|
||||
) {
|
||||
$expr = $qb->expr();
|
||||
$pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->defaultSelectAlias . '.' : '';
|
||||
$field = $pf . $field;
|
||||
|
||||
$orX = $expr->orX();
|
||||
$orX->add($expr->lte($field, $qb->createNamedParameter($date, IQueryBuilder::PARAM_DATE)));
|
||||
|
||||
if ($orNull === true) {
|
||||
$orX->add($expr->isNull($field));
|
||||
}
|
||||
|
||||
$qb->andWhere($orX);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param int $timestamp
|
||||
* @param string $field
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function limitToSince(IQueryBuilder $qb, int $timestamp, string $field) {
|
||||
$dTime = new DateTime();
|
||||
$dTime->setTimestamp($timestamp);
|
||||
|
||||
$expr = $qb->expr();
|
||||
$pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->defaultSelectAlias . '.' : '';
|
||||
$field = $pf . $field;
|
||||
|
||||
$orX = $expr->orX();
|
||||
$orX->add($expr->gte($field, $qb->createNamedParameter($dTime, IQueryBuilder::PARAM_DATE)));
|
||||
|
||||
$qb->andWhere($orX);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param array $values
|
||||
*/
|
||||
protected function limitToDBFieldArray(IQueryBuilder $qb, string $field, array $values): void {
|
||||
$expr = $qb->expr();
|
||||
$pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->defaultSelectAlias . '.' : '';
|
||||
$field = $pf . $field;
|
||||
|
||||
$orX = $expr->orX();
|
||||
foreach ($values as $value) {
|
||||
$orX->add($expr->eq($field, $qb->createNamedParameter($value)));
|
||||
}
|
||||
|
||||
$qb->andWhere($orX);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $field
|
||||
* @param string $value
|
||||
*/
|
||||
protected function searchInDBField(IQueryBuilder $qb, string $field, string $value) {
|
||||
$expr = $qb->expr();
|
||||
|
||||
$pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->defaultSelectAlias . '.' : '';
|
||||
$field = $pf . $field;
|
||||
|
||||
$qb->andWhere($expr->iLike($field, $qb->createNamedParameter($value)));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class ArrayNotFoundException
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class ArrayNotFoundException extends Exception {
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class CacheItemNotFoundException
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class CacheItemNotFoundException extends Exception {
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class RequestContentException
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class DateTimeException extends Exception {
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class ArrayNotFoundException
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class DependencyInjectionException extends Exception {
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class ArrayNotFoundException
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class InvalidItemException extends Exception {
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2020, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class SignatureException
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class InvalidOriginException extends Exception {
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class ArrayNotFoundException
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class ItemNotFoundException extends Exception {
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2020, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class JsonNotRequestedException
|
||||
*
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class JsonNotRequestedException extends Exception {
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class ArrayNotFoundException
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class MalformedArrayException extends Exception {
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class RequestContentException
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class RequestContentException extends Exception {
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class RequestNetworkException
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class RequestNetworkException extends Exception {
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class RequestResultNotJsonException
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class RequestResultNotJsonException extends Exception {
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class RequestResultSizeException
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class RequestResultSizeException extends Exception {
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class RequestServerException
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class RequestServerException extends Exception {
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Some tools for myself.
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Tools\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class RowNotFoundException
|
||||
*
|
||||
* @package OCA\Social\Tools\Exceptions
|
||||
*/
|
||||
class RowNotFoundException extends Exception {
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Ładowanie…
Reference in New Issue