Skip to content

Commit b051397

Browse files
authored
Merge pull request #61409 from nextcloud/fix/skip-RemoveBrokenProperties-if-already-run
fix: skip repair RemoveBrokenProperties if already run
2 parents 3e31f1e + 7b9b0bb commit b051397

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

core/AppInfo/ConfigLexicon.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class ConfigLexicon implements ILexicon {
2828
public const SHARE_LINK_EXPIRE_DATE_ENFORCED = 'shareapi_enforce_expire_date';
2929
public const USER_LANGUAGE = 'lang';
3030
public const OCM_DISCOVERY_ENABLED = 'ocm_discovery_enabled';
31+
public const DAV_REPAIR_REMOVED_BROKEN_PROPERTIES = 'dav_repair_removed_broken_properties';
3132

3233
public const USER_LOCALE = 'locale';
3334
public const USER_TIMEZONE = 'timezone';
@@ -101,6 +102,13 @@ public function getAppConfigs(): array {
101102
defaultRaw: true,
102103
definition: 'Whether on demand preview migration is enabled.'
103104
),
105+
new Entry(
106+
key: self::DAV_REPAIR_REMOVED_BROKEN_PROPERTIES,
107+
type: ValueType::BOOL,
108+
defaultRaw: false,
109+
definition: 'Whether the RemoveBrokenProperties repair step has already been run.',
110+
lazy: true,
111+
),
104112
];
105113
}
106114

lib/private/Repair/RemoveBrokenProperties.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
namespace OC\Repair;
1111

12+
use OC\Core\AppInfo\ConfigLexicon;
1213
use OCP\DB\QueryBuilder\IQueryBuilder;
14+
use OCP\IAppConfig;
1315
use OCP\IDBConnection;
1416
use OCP\Migration\IOutput;
1517
use OCP\Migration\IRepairStep;
@@ -18,6 +20,7 @@
1820
class RemoveBrokenProperties implements IRepairStep {
1921
public function __construct(
2022
private readonly IDBConnection $db,
23+
private readonly IAppConfig $appConfig,
2124
) {
2225
}
2326

@@ -28,6 +31,10 @@ public function getName(): string {
2831

2932
#[Override]
3033
public function run(IOutput $output): void {
34+
if ($this->appConfig->getValueBool('core', ConfigLexicon::DAV_REPAIR_REMOVED_BROKEN_PROPERTIES, lazy: true)) {
35+
return;
36+
}
37+
3138
// retrieve all object properties
3239
$qb = $this->db->getQueryBuilder();
3340
$qb->select('id', 'propertyvalue')
@@ -56,6 +63,8 @@ public function run(IOutput $output): void {
5663
$qb->executeStatement();
5764
}
5865
$total = count($brokenIds);
66+
67+
$this->appConfig->setValueBool('core', ConfigLexicon::DAV_REPAIR_REMOVED_BROKEN_PROPERTIES, true, lazy: true);
5968
$output->info("$total broken object properties removed");
6069
}
6170
}

0 commit comments

Comments
 (0)