| @@ 1340-1362 (lines=23) @@ | ||
| 1337 | * |
|
| 1338 | * @return int Number of affected rows. |
|
| 1339 | */ |
|
| 1340 | public function deleteUrlAliasesWithoutParent(): int |
|
| 1341 | { |
|
| 1342 | $existingAliasesQuery = $this->getAllUrlAliasesQuery(); |
|
| 1343 | ||
| 1344 | $query = $this->connection->createQueryBuilder(); |
|
| 1345 | $query |
|
| 1346 | ->delete($this->table) |
|
| 1347 | ->where( |
|
| 1348 | $query->expr()->neq( |
|
| 1349 | 'parent', |
|
| 1350 | $query->createPositionalParameter(0, \PDO::PARAM_INT) |
|
| 1351 | ) |
|
| 1352 | ) |
|
| 1353 | ->andWhere( |
|
| 1354 | $query->expr()->notIn( |
|
| 1355 | 'parent', |
|
| 1356 | $existingAliasesQuery |
|
| 1357 | ) |
|
| 1358 | ) |
|
| 1359 | ; |
|
| 1360 | ||
| 1361 | return $query->execute(); |
|
| 1362 | } |
|
| 1363 | ||
| 1364 | /** |
|
| 1365 | * Delete URL aliases which do not link to any existing URL alias node. |
|
| @@ 1369-1388 (lines=20) @@ | ||
| 1366 | * |
|
| 1367 | * Note: Typically link column value is used to determine original alias for an archived entries. |
|
| 1368 | */ |
|
| 1369 | public function deleteUrlAliasesWithBrokenLink() |
|
| 1370 | { |
|
| 1371 | $existingAliasesQuery = $this->getAllUrlAliasesQuery(); |
|
| 1372 | ||
| 1373 | $query = $this->connection->createQueryBuilder(); |
|
| 1374 | $query |
|
| 1375 | ->delete($this->table) |
|
| 1376 | ->where( |
|
| 1377 | $query->expr()->neq('id', 'link') |
|
| 1378 | ) |
|
| 1379 | ->andWhere( |
|
| 1380 | $query->expr()->notIn( |
|
| 1381 | 'link', |
|
| 1382 | $existingAliasesQuery |
|
| 1383 | ) |
|
| 1384 | ) |
|
| 1385 | ; |
|
| 1386 | ||
| 1387 | return $query->execute(); |
|
| 1388 | } |
|
| 1389 | ||
| 1390 | /** |
|
| 1391 | * Attempt repairing data corruption for broken archived URL aliases for Location, |
|