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,9 +78,18 @@ class Server
|
|||
return 0;
|
||||
}
|
||||
|
||||
$server = $this->serverModel->getByUrlAlias($polled_url);
|
||||
// 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']]);
|
||||
}
|
||||
|
||||
if (
|
||||
// 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
|
||||
&& substr($polled_url, 0, 7) == 'http://'
|
||||
&& substr($server['base_url'], 0, 8) == 'https://'
|
||||
|
@ -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