Skip to content

Commit

Permalink
removing countIncremental
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtificialOwl committed Sep 29, 2021
1 parent b66df99 commit 60367d4
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 52 deletions.
3 changes: 1 addition & 2 deletions lib/Command/PointList.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output = new ConsoleOutput();
$output = $output->section();
$table = new Table($output);
$table->setHeaders(['Id', 'Parent', 'Children', 'Date']);
$table->setHeaders(['Id', 'Parent', 'Date']);
$table->render();

foreach ($points as $point) {
$table->appendRow(
[
$point->getId(),
$point->getParent(),
$point->getCountIncremental(),
date('Y-m-d H:i:s', $point->getDate())
]
);
Expand Down
24 changes: 1 addition & 23 deletions lib/Db/CoreQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
namespace OCA\Backup\Db;

use ArtificialOwl\MySmallPhpTools\Db\Nextcloud\nc23\NC23ExtendedQueryBuilder;
use Doctrine\DBAL\Query\QueryBuilder;


/**
Expand Down Expand Up @@ -83,26 +82,5 @@ public function limitToInstance(string $instance): void {
public function limitToParent(string $parent): void {
$this->limit('parent', $parent);
}


/**
*
*/
public function countIncremental(): void {
if ($this->getType() !== QueryBuilder::SELECT) {
return;
}

$expr = $this->expr();
$incremental = 'incremental';
$this->selectAlias(
$this->createFunction('COUNT(`' . $incremental . '`.`id`)'),
'count_incremental'
);
$this->leftJoin(
$this->getDefaultSelectAlias(), CoreRequestBuilder::TABLE_RESTORING_POINT, $incremental,
$expr->eq($this->getDefaultSelectAlias() . '.uid', $incremental . '.parent')
);
}


}
4 changes: 0 additions & 4 deletions lib/Db/PointRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ public function getLocalById(string $pointId): RestoringPoint {
$qb->limitToUid($pointId);
$qb->limitToInstance('');

$qb->countIncremental();

return $this->getItemFromRequest($qb);
}

Expand All @@ -147,7 +145,6 @@ public function getById(string $pointId, string $instance = ''): RestoringPoint
if ($instance !== '') {
$qb->limitToInstance($instance);
}
$qb->countIncremental();

return $this->getItemFromRequest($qb);
}
Expand All @@ -161,7 +158,6 @@ public function getById(string $pointId, string $instance = ''): RestoringPoint
public function getByInstance(string $instance): array {
$qb = $this->getPointSelectSql();
$qb->limitToInstance($instance);
$qb->countIncremental();

return $this->getItemsFromRequest($qb);
}
Expand Down
24 changes: 1 addition & 23 deletions lib/Model/RestoringPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ class RestoringPoint implements IDeserializable, INC23QueryRow, ISignedModel, Js
/** @var bool */
private $package = false;

/** @var int */
private $countIncremental = 0;

/**
* @param string $id
Expand Down Expand Up @@ -383,25 +381,6 @@ public function getMetadata(): array {
}


/**
* @param int $count
*
* @return RestoringPoint
*/
public function setCountIncremental(int $count): self {
$this->countIncremental = $count;

return $this;
}

/**
* @return int
*/
public function getCountIncremental(): int {
return $this->countIncremental;
}


/**
* @param array $data
*
Expand All @@ -413,8 +392,7 @@ public function importFromDatabase(array $data): INC23QueryRow {
->setInstance($this->get('instance', $data))
->setParent($this->get('parent', $data))
->setStatus($this->getInt('status', $data))
->setDate($this->getInt('date', $data))
->setCountIncremental($this->getInt('count_incremental', $data));
->setDate($this->getInt('date', $data));

if ($this->getId() === '') {
throw new InvalidItemException();
Expand Down

0 comments on commit 60367d4

Please sign in to comment.