kopia lustrzana https://github.com/nextcloud/social
use id_prim on icon_id
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/1662/head
rodzic
3fc14ced4f
commit
dd0ef70b74
|
@ -38,6 +38,7 @@ use OCA\Social\Service\CacheActorService;
|
||||||
use OCA\Social\Service\DocumentService;
|
use OCA\Social\Service\DocumentService;
|
||||||
use OCA\Social\Service\HashtagService;
|
use OCA\Social\Service\HashtagService;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
class CacheRefresh extends Base {
|
class CacheRefresh extends Base {
|
||||||
|
@ -61,7 +62,8 @@ class CacheRefresh extends Base {
|
||||||
protected function configure() {
|
protected function configure() {
|
||||||
parent::configure();
|
parent::configure();
|
||||||
$this->setName('social:cache:refresh')
|
$this->setName('social:cache:refresh')
|
||||||
->setDescription('Update the cache');
|
->setDescription('Update the cache')
|
||||||
|
->addOption('force', 'f', InputOption::VALUE_NONE, 'enforce update of cached account');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,7 +82,7 @@ class CacheRefresh extends Base {
|
||||||
$result = $this->cacheActorService->missingCacheRemoteActors();
|
$result = $this->cacheActorService->missingCacheRemoteActors();
|
||||||
$output->writeLn($result . ' remote accounts created');
|
$output->writeLn($result . ' remote accounts created');
|
||||||
|
|
||||||
$result = $this->cacheActorService->manageCacheRemoteActors();
|
$result = $this->cacheActorService->manageCacheRemoteActors($input->getOption('force'));
|
||||||
$output->writeLn($result . ' remote accounts updated');
|
$output->writeLn($result . ' remote accounts updated');
|
||||||
|
|
||||||
$result = $this->documentService->manageCacheDocuments();
|
$result = $this->documentService->manageCacheDocuments();
|
||||||
|
|
|
@ -91,7 +91,7 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
||||||
$iconId = $actor->getIconId();
|
$iconId = $actor->getIconId();
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->setValue('icon_id', $qb->createNamedParameter($iconId));
|
$qb->setValue('icon_id', $qb->createNamedParameter($qb->prim($iconId)));
|
||||||
$qb->generatePrimaryKey($actor->getId());
|
$qb->generatePrimaryKey($actor->getId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -143,9 +143,8 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
||||||
$iconId = $actor->getIconId();
|
$iconId = $actor->getIconId();
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->set('icon_id', $qb->createNamedParameter($iconId));
|
$qb->set('icon_id', $qb->createNamedParameter($qb->prim($iconId)));
|
||||||
|
$qb->limitToIdString($actor->getId());
|
||||||
$this->limitToIdString($qb, $actor->getId());
|
|
||||||
|
|
||||||
return $qb->executeStatement();
|
return $qb->executeStatement();
|
||||||
}
|
}
|
||||||
|
@ -226,10 +225,12 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
||||||
* @return Person[]
|
* @return Person[]
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getRemoteActorsToUpdate(): array {
|
public function getRemoteActorsToUpdate(bool $force = false): array {
|
||||||
$qb = $this->getCacheActorsSelectSql();
|
$qb = $this->getCacheActorsSelectSql();
|
||||||
$this->limitToLocal($qb, false);
|
$this->limitToLocal($qb, false);
|
||||||
$this->limitToCreation($qb, self::CACHE_TTL);
|
if (!$force) {
|
||||||
|
$this->limitToCreation($qb, self::CACHE_TTL);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->getCacheActorsFromRequest($qb);
|
return $this->getCacheActorsFromRequest($qb);
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
||||||
->selectAlias('cd.creation', 'cachedocument_creation')
|
->selectAlias('cd.creation', 'cachedocument_creation')
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
$this->getDefaultSelectAlias(), CoreRequestBuilder::TABLE_CACHE_DOCUMENTS, 'cd',
|
$this->getDefaultSelectAlias(), CoreRequestBuilder::TABLE_CACHE_DOCUMENTS, 'cd',
|
||||||
$expr->eq($func->lower($pf . '.' . $fieldDocumentId), $func->lower('cd.id'))
|
$expr->eq($pf . '.' . $fieldDocumentId, 'cd.id_prim')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,8 +291,8 @@ class CacheActorService {
|
||||||
* @return int
|
* @return int
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function manageCacheRemoteActors(): int {
|
public function manageCacheRemoteActors(bool $force = false): int {
|
||||||
$update = $this->cacheActorsRequest->getRemoteActorsToUpdate();
|
$update = $this->cacheActorsRequest->getRemoteActorsToUpdate($force);
|
||||||
|
|
||||||
foreach ($update as $item) {
|
foreach ($update as $item) {
|
||||||
try {
|
try {
|
||||||
|
|
Ładowanie…
Reference in New Issue