diff --git a/.github/workflows/oci.yml b/.github/workflows/oci.yml index ef1782342ed4f..470e80859d51a 100644 --- a/.github/workflows/oci.yml +++ b/.github/workflows/oci.yml @@ -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 diff --git a/apps/dav/lib/Migration/RemoveObjectProperties.php b/apps/dav/lib/Migration/RemoveObjectProperties.php index c72dfbebfea3c..b771b70e68404 100644 --- a/apps/dav/lib/Migration/RemoveObjectProperties.php +++ b/apps/dav/lib/Migration/RemoveObjectProperties.php @@ -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."); diff --git a/core/Command/Maintenance/Repair.php b/core/Command/Maintenance/Repair.php index 01e62f2cd3232..a1d97476f9412 100644 --- a/core/Command/Maintenance/Repair.php +++ b/core/Command/Maintenance/Repair.php @@ -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 @@ protected function execute(InputInterface $input, OutputInterface $output): int } } + + $maintenanceMode = $this->config->getSystemValueBool('maintenance'); $this->config->setSystemValue('maintenance', true); @@ -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 { @@ -139,6 +142,7 @@ public function handleRepairFeedBack(Event $event): void { $this->output->writeln(' - WARNING: ' . $event->getMessage() . ''); } elseif ($event instanceof RepairErrorEvent) { $this->output->writeln(' - ERROR: ' . $event->getMessage() . ''); + $this->errored = true; } } } diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index 325220823b89e..e5d081444e1b8 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -34,6 +34,7 @@ use OC\DB\Connection; use OC\DB\OracleConnection; +use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IAppConfig; use OCP\IConfig; @@ -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) ) ); } diff --git a/lib/private/Repair/NC21/ValidatePhoneNumber.php b/lib/private/Repair/NC21/ValidatePhoneNumber.php index 3217a1f082c53..964d62ad0abb1 100644 --- a/lib/private/Repair/NC21/ValidatePhoneNumber.php +++ b/lib/private/Repair/NC21/ValidatePhoneNumber.php @@ -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;