From 63ba618dacfe8990adf398a32ce7452bbe59eaa8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 20 Feb 2023 13:34:44 +0100 Subject: [PATCH 1/6] fix(CI): Run repair steps against Oracle DB Signed-off-by: Joas Schilling --- .github/workflows/oci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/oci.yml b/.github/workflows/oci.yml index 8d09578cf4e2e..bd54b64e6581b 100644 --- a/.github/workflows/oci.yml +++ b/.github/workflows/oci.yml @@ -50,6 +50,10 @@ jobs: ./occ maintenance:install --verbose --database=oci --database-name=XE --database-host=127.0.0.1 --database-port=1521 --database-user=autotest --database-pass=owncloud --admin-user admin --admin-pass admin php -f index.php + - name: Run repair steps + run: | + ./occ maintenance:repair --include-expensive + - name: PHPUnit working-directory: tests run: phpunit --configuration phpunit-autotest.xml --group DB,SLOWDB From dcb5ccac4e07497c13ebac03ba7c29ca3a3ede36 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 23 Feb 2023 16:58:15 +0100 Subject: [PATCH 2/6] First run unit tests so they don't fail Signed-off-by: Joas Schilling --- .github/workflows/oci.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/oci.yml b/.github/workflows/oci.yml index bd54b64e6581b..c456b61f914d7 100644 --- a/.github/workflows/oci.yml +++ b/.github/workflows/oci.yml @@ -50,10 +50,24 @@ jobs: ./occ maintenance:install --verbose --database=oci --database-name=XE --database-host=127.0.0.1 --database-port=1521 --database-user=autotest --database-pass=owncloud --admin-user admin --admin-pass admin php -f index.php + - name: PHPUnit + working-directory: tests + run: phpunit --configuration phpunit-autotest.xml --group DB,SLOWDB + - name: Run repair steps run: | ./occ maintenance:repair --include-expensive - - name: PHPUnit - working-directory: tests - run: phpunit --configuration phpunit-autotest.xml --group DB,SLOWDB + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: phpunit-oci + + if: always() + + name: phpunit-oci-summary + + steps: + - name: Summary status + run: if ${{ needs.phpunit-oci.result != 'success' }}; then exit 1; fi From 51c2a51fed999b949c585c7674ebc101252f5d49 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 20 Feb 2023 14:33:06 +0100 Subject: [PATCH 3/6] Fail the repair command when an error happened Signed-off-by: Joas Schilling --- core/Command/Maintenance/Repair.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/Command/Maintenance/Repair.php b/core/Command/Maintenance/Repair.php index 2a3d7a908e270..91963b6dd0b15 100644 --- a/core/Command/Maintenance/Repair.php +++ b/core/Command/Maintenance/Repair.php @@ -52,6 +52,8 @@ class Repair extends Command { private $output; /** @var IAppManager */ private $appManager; + /** @var bool */ + protected $errored = false; /** * @param \OC\Repair $repair @@ -109,6 +111,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int } } + + $maintenanceMode = $this->config->getSystemValueBool('maintenance'); $this->config->setSystemValue('maintenance', true); @@ -125,7 +129,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) { @@ -154,6 +158,7 @@ public function handleRepairFeedBack($event) { break; case '\OC\Repair::error': $this->output->writeln(' - ERROR: ' . $event->getArgument(0) . ''); + $this->errored = true; break; } } From 84e5d349ed34d4060d038fa931dbb08e7aa2598b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 20 Feb 2023 14:40:50 +0100 Subject: [PATCH 4/6] fix(OCC): Don't throw in the repair step for phone validation Signed-off-by: Joas Schilling --- lib/private/Repair/NC21/ValidatePhoneNumber.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; From 0dd3b40260d91e7492740677f5efa03965c60e79 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 20 Feb 2023 14:46:00 +0100 Subject: [PATCH 5/6] Fix appconfig compatibility with Oracle DB Signed-off-by: Joas Schilling --- lib/private/AppConfig.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index dbfa391ca5bf3..e6007fc3e655b 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; @@ -297,7 +298,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) ) ); } From 5120c19d0fe4cb5fc4029c101044d7c3cac73187 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 28 Feb 2023 19:52:41 +0100 Subject: [PATCH 6/6] Neutralize action name Signed-off-by: Joas Schilling --- .github/workflows/oci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oci.yml b/.github/workflows/oci.yml index c456b61f914d7..9c6e23b14097a 100644 --- a/.github/workflows/oci.yml +++ b/.github/workflows/oci.yml @@ -8,7 +8,7 @@ on: - stable* jobs: - phpunit-oci8: + phpunit-oci: runs-on: ubuntu-20.04 strategy: