fix condition error

This commit is contained in:
ghost 2023-05-04 11:35:22 +03:00
parent 297563d4a5
commit 5297e6e918

View File

@ -268,35 +268,38 @@ foreach ($db->getHostPageCrawlQueue(CRAWL_PAGE_LIMIT, time() - CRAWL_PAGE_SECOND
// Save image info // Save image info
$hostImageId = $db->getHostImageId($hostId, crc32($hostImageURI->string)); $hostImageId = $db->getHostImageId($hostId, crc32($hostImageURI->string));
if ($hostStatus && // host enabled if (!$hostImageId && // image not exists
$robots->uriAllowed($hostImageURI->string) && // src allowed by robots.txt rules $hostStatus && // host enabled
$hostImageLimit > $db->getTotalHostImages($hostId) && // images quantity not reached host limit $robots->uriAllowed($hostImageURI->string) && // src allowed by robots.txt rules
!$hostImageId) { // image not exists $hostImageLimit > $db->getTotalHostImages($hostId)) { // images quantity not reached host limit
// Add host image // Add host image
if ($hostImageId = $db->addHostImage($hostId, crc32($hostImageURI->string), $hostImageURI->string, time(), null, 200)) { if ($hostImageId = $db->addHostImage($hostId, crc32($hostImageURI->string), $hostImageURI->string, time(), null, 200)) {
$hostImagesAdded++; $hostImagesAdded++;
} else { } else {
continue; continue;
} }
} }
// Add/update host image description // Host image exists or created new one
$db->setHostImageDescription($hostImageId, if ($hostImageId) {
crc32(md5((string) $imageAlt . (string) $imageTitle)),
Filter::imageAlt($imageAlt),
Filter::imageTitle($imageTitle),
time(),
time());
// Add/update host image description
$db->setHostImageDescription($hostImageId,
crc32(md5((string) $imageAlt . (string) $imageTitle)),
Filter::imageAlt($imageAlt),
Filter::imageTitle($imageTitle),
time(),
time());
// Relate host image with host page was found // Relate host image with host page was found
$db->setHostImageToHostPage($hostImageId, $queueHostPage->hostPageId, time(), time(), 1); $db->setHostImageToHostPage($hostImageId, $queueHostPage->hostPageId, time(), time(), 1);
}
// Increase page rank when link does not match the current host // Increase image rank when link does not match the current host
if ($hostImageURL->scheme . '://' . if ($hostImageURL->scheme . '://' .
$hostImageURL->name . $hostImageURL->name .
($hostImageURL->port ? ':' . $hostImageURL->port : '') ($hostImageURL->port ? ':' . $hostImageURL->port : '')