Skip to content
Snippets Groups Projects
Unverified Commit fbbdc641 authored by Joas Schilling's avatar Joas Schilling Committed by GitHub
Browse files

Merge pull request #36781 from nextcloud/bugfix/noid/run-repairsteps-against-oracle

fix(CI): Run repair steps against Oracle DB
parents 4908d87c f32804e9
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,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
......
......@@ -57,7 +57,7 @@ class RemoveObjectProperties implements IRepairStep {
$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.");
......
......@@ -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;
......@@ -104,6 +105,8 @@ class Repair extends Command {
}
}
$maintenanceMode = $this->config->getSystemValueBool('maintenance');
$this->config->setSystemValue('maintenance', true);
......@@ -120,7 +123,7 @@ class Repair extends Command {
$this->repair->run();
$this->config->setSystemValue('maintenance', $maintenanceMode);
return 0;
return $this->errored ? 1 : 0;
}
public function handleRepairFeedBack(Event $event): void {
......@@ -139,6 +142,7 @@ class Repair extends Command {
$this->output->writeln('<comment> - WARNING: ' . $event->getMessage() . '</comment>');
} elseif ($event instanceof RepairErrorEvent) {
$this->output->writeln('<error> - ERROR: ' . $event->getMessage() . '</error>');
$this->errored = true;
}
}
}
......@@ -34,6 +34,7 @@ namespace OC;
use OC\DB\Connection;
use OC\DB\OracleConnection;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IAppConfig;
use OCP\IConfig;
......@@ -298,7 +299,7 @@ class AppConfig implements IAppConfig {
$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)
)
);
}
......
......@@ -55,7 +55,8 @@ class ValidatePhoneNumber implements IRepairStep {
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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment