protected function LinkCheckerService::updateSameLinks in Link checker 8
Helper function to update same links that were found in other entities.
2 calls to LinkCheckerService::updateSameLinks()
- LinkCheckerService::exceptionHandling in src/
LinkCheckerService.php - Exception handling.
- LinkCheckerService::statusHandling in src/
LinkCheckerService.php - Status code handling.
File
- src/
LinkCheckerService.php, line 367
Class
- LinkCheckerService
- Class LinkCheckerService.
Namespace
Drupal\linkcheckerCode
protected function updateSameLinks(LinkCheckerLinkInterface $link) {
$storage = $this->entityTypeManager
->getStorage($link
->getEntityTypeId());
$query = $storage
->getQuery();
$query
->condition('urlhash', $link
->getHash());
$query
->condition('lid', $link
->id(), '!=');
$ids = $query
->execute();
foreach ($ids as $id) {
/** @var \Drupal\linkchecker\LinkCheckerLinkInterface $linkToUpdate */
$linkToUpdate = $storage
->load($id);
$linkToUpdate
->setRequestMethod($link
->getRequestMethod());
$linkToUpdate
->setStatusCode($link
->getStatusCode());
$linkToUpdate
->setErrorMessage($link
->getErrorMessage());
$linkToUpdate
->setFailCount($link
->getFailCount());
$linkToUpdate
->setLastCheckTime($link
->getLastCheckTime());
$linkToUpdate
->save();
}
}