friendica/src/Worker/UpdateGServer.php

32 lines
629 B
PHP
Raw Normal View History

2019-12-20 16:46:30 -05:00
<?php
/**
2019-12-21 13:11:51 -05:00
* @file src/Worker/UpdateGServer.php
2019-12-20 16:46:30 -05:00
*/
namespace Friendica\Worker;
use Friendica\Core\Logger;
use Friendica\Model\GServer;
use Friendica\Util\Strings;
2019-12-21 13:11:51 -05:00
class UpdateGServer
2019-12-20 16:46:30 -05:00
{
2019-12-21 15:18:44 -05:00
/**
* Update the given server
* @param string $server_url Server URL
*/
2019-12-20 16:46:30 -05: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 13:11:51 -05:00
Logger::info('Updated gserver', ['url' => $server_url, 'result' => $ret]);
2019-12-20 16:46:30 -05:00
}
}