Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
Hypolite Petovan | d1933a1f74 |
|
@ -57,4 +57,13 @@ class Server extends \Friendica\Directory\Model
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getByBaseUrl(string $polled_url): ?array
|
||||
{
|
||||
$polled_url = trim($polled_url, '/');
|
||||
|
||||
return $this->atlas->fetchOne('SELECT s.* FROM `server` s WHERE s.`base_url` = :base_url',
|
||||
['base_url' => $polled_url]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,16 @@ class Server
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Disabling exact match first
|
||||
if ($server = $this->serverModel->getByBaseUrl($polled_url)) {
|
||||
$this->atlas->perform('UPDATE `server` SET `available` = 0 WHERE `id` = :server_id', ['server_id' => $server['id']]);
|
||||
}
|
||||
|
||||
// Disabling before probe to avoid zombie records
|
||||
$server = $this->serverModel->getByUrlAlias($polled_url);
|
||||
if ($server) {
|
||||
$this->atlas->perform('UPDATE `server` SET `available` = 0 WHERE `id` = :server_id', ['server_id' => $server['id']]);
|
||||
}
|
||||
|
||||
if (
|
||||
$server
|
||||
|
@ -89,10 +98,6 @@ class Server
|
|||
return $server['id'];
|
||||
}
|
||||
|
||||
if ($server) {
|
||||
$this->atlas->perform('UPDATE `server` SET `available` = 0 WHERE `id` = :server_id', ['server_id' => $server['id']]);
|
||||
}
|
||||
|
||||
$probe_result = $this->getProbeResult($polled_url);
|
||||
|
||||
$parse_success = !empty($probe_result['data']['url']);
|
||||
|
|
Loading…
Reference in a new issue