diff options
-rw-r--r-- | .github/workflows/oci.yml | 4 | ||||
-rw-r--r-- | apps/dav/lib/Migration/RemoveObjectProperties.php | 2 | ||||
-rw-r--r-- | core/Command/Maintenance/Repair.php | 6 | ||||
-rw-r--r-- | lib/private/AppConfig.php | 3 | ||||
-rw-r--r-- | lib/private/Repair/NC21/ValidatePhoneNumber.php | 3 |
5 files changed, 14 insertions, 4 deletions
diff --git a/.github/workflows/oci.yml b/.github/workflows/oci.yml index 12bef5b1ed8..34d548c7f9f 100644 --- a/.github/workflows/oci.yml +++ b/.github/workflows/oci.yml @@ -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 diff --git a/apps/dav/lib/Migration/RemoveObjectProperties.php b/apps/dav/lib/Migration/RemoveObjectProperties.php index c72dfbebfea..b771b70e684 100644 --- a/apps/dav/lib/Migration/RemoveObjectProperties.php +++ b/apps/dav/lib/Migration/RemoveObjectProperties.php @@ -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."); diff --git a/core/Command/Maintenance/Repair.php b/core/Command/Maintenance/Repair.php index 01e62f2cd32..a1d97476f94 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 @@ 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; } } } diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index 04e76373466..cd93c4f42c4 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -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) ) ); } diff --git a/lib/private/Repair/NC21/ValidatePhoneNumber.php b/lib/private/Repair/NC21/ValidatePhoneNumber.php index f9c3c5952bf..b3534dbeae8 100644 --- a/lib/private/Repair/NC21/ValidatePhoneNumber.php +++ b/lib/private/Repair/NC21/ValidatePhoneNumber.php @@ -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; |