friendica-github/src/Worker/UpdateGServer.php

32 lines
629 B
PHP
Raw Normal View History

2019-12-20 21:46:30 +00:00
<?php
/**
2019-12-21 18:11:51 +00:00
* @file src/Worker/UpdateGServer.php
2019-12-20 21:46:30 +00:00
*/
namespace Friendica\Worker;
use Friendica\Core\Logger;
use Friendica\Model\GServer;
use Friendica\Util\Strings;
2019-12-21 18:11:51 +00:00
class UpdateGServer
2019-12-20 21:46:30 +00:00
{
2019-12-21 20:18:44 +00:00
/**
* Update the given server
* @param string $server_url Server URL
*/
2019-12-20 21:46:30 +00:00
public static function execute($server_url)
{
if (empty($server_url)) {
return;
}
$server_url = filter_var($server_url, FILTER_SANITIZE_URL);
if (substr(Strings::normaliseLink($server_url), 0, 7) != 'http://') {
return;
}
$ret = GServer::check($server_url);
2019-12-21 18:11:51 +00:00
Logger::info('Updated gserver', ['url' => $server_url, 'result' => $ret]);
2019-12-20 21:46:30 +00:00
}
}