|
@@ 232-255 (lines=24) @@
|
| 229 |
|
/** |
| 230 |
|
* Outputs a report about storages with wrong path that need repairing in the file cache |
| 231 |
|
*/ |
| 232 |
|
private function reportAffectedStoragesParentIdWrongPath(IOutput $out) { |
| 233 |
|
$qb = $this->connection->getQueryBuilder(); |
| 234 |
|
$qb->selectDistinct('fc.storage'); |
| 235 |
|
$this->addQueryConditionsParentIdWrongPath($qb); |
| 236 |
|
|
| 237 |
|
// TODO: max results + paginate ? |
| 238 |
|
// TODO: join with oc_storages / oc_mounts to deliver user id ? |
| 239 |
|
|
| 240 |
|
$results = $qb->execute(); |
| 241 |
|
$rows = $results->fetchAll(); |
| 242 |
|
$results->closeCursor(); |
| 243 |
|
|
| 244 |
|
$storageIds = []; |
| 245 |
|
foreach ($rows as $row) { |
| 246 |
|
$storageIds[] = $row['storage']; |
| 247 |
|
} |
| 248 |
|
|
| 249 |
|
if (!empty($storageIds)) { |
| 250 |
|
$out->warning('The file cache contains entries with invalid path values for the following storage numeric ids: ' . \implode(' ', $storageIds)); |
| 251 |
|
$out->warning('Please run `occ files:scan --all --repair` to repair' |
| 252 |
|
.'all affected storages or run `occ files:scan userid --repair for ' |
| 253 |
|
.'each user with affected storages'); |
| 254 |
|
} |
| 255 |
|
} |
| 256 |
|
|
| 257 |
|
/** |
| 258 |
|
* Outputs a report about storages with non existing parents that need repairing in the file cache |
|
@@ 260-281 (lines=22) @@
|
| 257 |
|
/** |
| 258 |
|
* Outputs a report about storages with non existing parents that need repairing in the file cache |
| 259 |
|
*/ |
| 260 |
|
private function reportAffectedStoragesNonExistingParentIdEntry(IOutput $out) { |
| 261 |
|
$qb = $this->connection->getQueryBuilder(); |
| 262 |
|
$qb->selectDistinct('fc.storage'); |
| 263 |
|
$this->addQueryConditionsNonExistingParentIdEntry($qb); |
| 264 |
|
|
| 265 |
|
// TODO: max results + paginate ? |
| 266 |
|
// TODO: join with oc_storages / oc_mounts to deliver user id ? |
| 267 |
|
|
| 268 |
|
$results = $qb->execute(); |
| 269 |
|
$rows = $results->fetchAll(); |
| 270 |
|
$results->closeCursor(); |
| 271 |
|
|
| 272 |
|
$storageIds = []; |
| 273 |
|
foreach ($rows as $row) { |
| 274 |
|
$storageIds[] = $row['storage']; |
| 275 |
|
} |
| 276 |
|
|
| 277 |
|
if (!empty($storageIds)) { |
| 278 |
|
$out->warning('The file cache contains entries where the parent id does not point to any existing entry for the following storage numeric ids: ' . \implode(' ', $storageIds)); |
| 279 |
|
$out->warning('Please run `occ files:scan --all --repair` to repair all affected storages'); |
| 280 |
|
} |
| 281 |
|
} |
| 282 |
|
|
| 283 |
|
/** |
| 284 |
|
* Repair all entries for which the parent entry exists but the path |