Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable25] fix(CI): Run repair steps against Oracle DB #36886

Merged
merged 6 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/oci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ jobs:
working-directory: tests
run: phpunit --configuration phpunit-autotest.xml --group DB,SLOWDB

- name: Run repair steps
run: |
./occ maintenance:repair --include-expensive

summary:
permissions:
contents: none
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Migration/RemoveObjectProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function run(IOutput $output) {
$query = $this->connection->getQueryBuilder();
$updated = $query->delete('properties')
->where($query->expr()->in('propertyname', $query->createNamedParameter([self::RESOURCE_TYPE_PROPERTY, self::ME_CARD_PROPERTY, self::CALENDAR_TRANSP_PROPERTY], IQueryBuilder::PARAM_STR_ARRAY)))
->andWhere($query->expr()->eq('propertyvalue', $query->createNamedParameter('Object')))
->andWhere($query->expr()->eq('propertyvalue', $query->createNamedParameter('Object'), IQueryBuilder::PARAM_STR))
->executeStatement();

$output->info("$updated invalid object properties removed.");
Expand Down
6 changes: 5 additions & 1 deletion core/Command/Maintenance/Repair.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Repair extends Command {
private ProgressBar $progress;
private OutputInterface $output;
private IAppManager $appManager;
protected bool $errored = false;

public function __construct(\OC\Repair $repair, IConfig $config, IEventDispatcher $dispatcher, IAppManager $appManager) {
$this->repair = $repair;
Expand Down Expand Up @@ -104,6 +105,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
}



$maintenanceMode = $this->config->getSystemValueBool('maintenance');
$this->config->setSystemValue('maintenance', true);

Expand All @@ -120,7 +123,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->repair->run();

$this->config->setSystemValue('maintenance', $maintenanceMode);
return 0;
return $this->errored ? 1 : 0;
}

public function handleRepairFeedBack(Event $event): void {
Expand All @@ -139,6 +142,7 @@ public function handleRepairFeedBack(Event $event): void {
$this->output->writeln('<comment> - WARNING: ' . $event->getMessage() . '</comment>');
} elseif ($event instanceof RepairErrorEvent) {
$this->output->writeln('<error> - ERROR: ' . $event->getMessage() . '</error>');
$this->errored = true;
}
}
}
3 changes: 2 additions & 1 deletion lib/private/AppConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

use OC\DB\Connection;
use OC\DB\OracleConnection;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IAppConfig;
use OCP\IConfig;

Expand Down Expand Up @@ -300,7 +301,7 @@ public function setValue($app, $key, $value) {
$sql->andWhere(
$sql->expr()->orX(
$sql->expr()->isNull('configvalue'),
$sql->expr()->neq('configvalue', $sql->createNamedParameter($value))
$sql->expr()->neq('configvalue', $sql->createNamedParameter($value), IQueryBuilder::PARAM_STR)
)
);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/private/Repair/NC21/ValidatePhoneNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public function getName(): string {

public function run(IOutput $output): void {
if ($this->config->getSystemValueString('default_phone_region', '') === '') {
throw new \Exception('Can not validate phone numbers without `default_phone_region` being set in the config file');
$output->warning('Can not validate phone numbers without `default_phone_region` being set in the config file');
return;
}

$numUpdated = 0;
Expand Down