sforkowany z mirror/social
rodzic
4abb819e86
commit
9cb3b7e886
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
/**
|
||||
* Nextcloud - Social Support
|
||||
*
|
||||
* 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\Cron;
|
||||
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\BackgroundJob\TimedJob;
|
||||
use OCA\Social\Service\ConfigService;
|
||||
use OCP\AppFramework\QueryException;
|
||||
|
||||
/**
|
||||
* Class Queue
|
||||
*
|
||||
* @package OCA\Social\Cron
|
||||
*/
|
||||
class Chunk extends TimedJob {
|
||||
private ConfigService $configService;
|
||||
|
||||
public function __construct(ITimeFactory $time, ConfigService $configService) {
|
||||
parent::__construct($time);
|
||||
$this->setInterval(12 * 3600); // 12 hours
|
||||
$this->configService = $configService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed $argument
|
||||
*
|
||||
* @throws QueryException
|
||||
*/
|
||||
protected function run($argument) {
|
||||
$size = (int)$this->configService->getAppValue(ConfigService::DATABASE_CHUNK_SIZE);
|
||||
$this->morphChunks($size);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param int $size
|
||||
*/
|
||||
private function morphChunks(int $size): void {
|
||||
}
|
||||
}
|
|
@ -34,7 +34,6 @@ namespace OCA\Social\Db;
|
|||
use OCA\Social\Tools\Db\ExtendedQueryBuilder;
|
||||
use OC\SystemConfig;
|
||||
use OCA\Social\Model\ActivityPub\Actor\Person;
|
||||
use OCP\DB\QueryBuilder\ICompositeExpression;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IURLGenerator;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
@ -47,7 +46,6 @@ use Psr\Log\LoggerInterface;
|
|||
class SocialCoreQueryBuilder extends ExtendedQueryBuilder {
|
||||
protected IURLGenerator $urlGenerator;
|
||||
private ?Person $viewer = null;
|
||||
private int $chunk = 0;
|
||||
|
||||
public function __construct(
|
||||
IDBConnection $connection, SystemConfig $systemConfig, LoggerInterface $logger, IURLGenerator $urlGenerator
|
||||
|
@ -57,32 +55,6 @@ class SocialCoreQueryBuilder extends ExtendedQueryBuilder {
|
|||
$this->urlGenerator = $urlGenerator;
|
||||
}
|
||||
|
||||
public function setChunk(int $chunk): self {
|
||||
$this->chunk = $chunk;
|
||||
$this->inChunk();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getChunk(): int {
|
||||
return $this->chunk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit the request to a chunk
|
||||
*/
|
||||
public function inChunk(string $alias = '', ?ICompositeExpression $expr = null): void {
|
||||
if ($this->getChunk() === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($expr !== null) {
|
||||
$expr->add($this->exprLimitToDBFieldInt('chunk', $this->getChunk(), $alias));
|
||||
|
||||
return;
|
||||
}
|
||||
$this->limitToDBFieldInt('chunk', $this->getChunk(), $alias);
|
||||
}
|
||||
|
||||
public function hasViewer(): bool {
|
||||
return ($this->viewer !== null);
|
||||
|
|
|
@ -56,7 +56,6 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
|
||||
if ($aliasDest !== '') {
|
||||
$this->from(CoreRequestBuilder::TABLE_STREAM_DEST, $aliasDest);
|
||||
// $this->inChunk($aliasDest);
|
||||
}
|
||||
if ($aliasFollowing !== '') {
|
||||
$this->from(CoreRequestBuilder::TABLE_FOLLOWS, $aliasFollowing);
|
||||
|
@ -277,7 +276,6 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
$orX->add($expr->eq($alias . '.stream_id_prim', $pf . '.object_id_prim'));
|
||||
|
||||
$on = $expr->andX();
|
||||
// $this->inChunk('sa', $on);
|
||||
$viewer = $this->getViewer();
|
||||
$idPrim = $this->prim($viewer->getId());
|
||||
|
||||
|
|
|
@ -359,7 +359,6 @@ class StreamRequest extends StreamRequestBuilder {
|
|||
*/
|
||||
public function getTimelineHome(TimelineOptions $options): array {
|
||||
$qb = $this->getStreamSelectSql($options->getFormat());
|
||||
$qb->setChunk(1);
|
||||
|
||||
$qb->filterType(SocialAppNotification::TYPE);
|
||||
$qb->paginate($options);
|
||||
|
@ -396,7 +395,6 @@ class StreamRequest extends StreamRequestBuilder {
|
|||
int $since = 0, int $limit = 5, int $format = Stream::FORMAT_ACTIVITYPUB
|
||||
): array {
|
||||
$qb = $this->getStreamSelectSql($format);
|
||||
$qb->setChunk(1);
|
||||
|
||||
$qb->filterType(SocialAppNotification::TYPE);
|
||||
$qb->limitPaginate($since, $limit);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<files psalm-version="4.29.0@7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3">
|
||||
<files psalm-version="4.30.0@d0bc6e25d89f649e4f36a534f330f8bb4643dd69">
|
||||
<file src="lib/AP.php">
|
||||
<InvalidScalarArgument occurrences="1">
|
||||
<code>$level</code>
|
||||
|
@ -138,10 +138,4 @@
|
|||
<code>HintException</code>
|
||||
</UndefinedClass>
|
||||
</file>
|
||||
<file src="lib/Tools/Traits/TNCRequest.php">
|
||||
<InvalidArgument occurrences="21">
|
||||
<code>$curl</code>
|
||||
</InvalidArgument>
|
||||
<InvalidReturnType occurrences="1"/>
|
||||
</file>
|
||||
</files>
|
||||
|
|
Ładowanie…
Reference in New Issue