Browse Source

Merge pull request #7700 from annando/gserver-class

New class "GServer"
tags/2019.12
Hypolite Petovan 1 year ago
committed by GitHub
parent
commit
9df7aa93fd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1165 additions and 954 deletions
  1. +1
    -1
      src/Model/Contact.php
  2. +2
    -2
      src/Model/GContact.php
  3. +1150
    -0
      src/Model/GServer.php
  4. +6
    -947
      src/Protocol/PortableContact.php
  5. +4
    -3
      src/Worker/DiscoverPoCo.php
  6. +2
    -1
      src/Worker/PubSubPublish.php

+ 1
- 1
src/Model/Contact.php View File

@@ -1481,7 +1481,7 @@ class Contact extends BaseObject
$data = Probe::uri($url, "", $uid);
// Ensure that there is a gserver entry
if (!empty($data['baseurl']) && ($data['network'] != Protocol::PHANTOM)) {
PortableContact::checkServer($data['baseurl']);
GServer::check($data['baseurl']);
}
}



+ 2
- 2
src/Model/GContact.php View File

@@ -231,7 +231,7 @@ class GContact
}

// The server URL doesn't seem to be valid, so we don't store it.
if (!PortableContact::checkServer($gcontact['server_url'], $gcontact['network'])) {
if (!GServer::check($gcontact['server_url'], $gcontact['network'])) {
$gcontact['server_url'] = "";
}

@@ -541,7 +541,7 @@ class GContact
$j = json_decode($x);
if (!empty($j->entries)) {
foreach ($j->entries as $entry) {
PortableContact::checkServer($entry->url);
GServer::check($entry->url);

$url = $entry->url . '/poco';
if (!in_array($url, $done)) {


+ 1150
- 0
src/Model/GServer.php
File diff suppressed because it is too large
View File


+ 6
- 947
src/Protocol/PortableContact.php
File diff suppressed because it is too large
View File


+ 4
- 3
src/Worker/DiscoverPoCo.php View File

@@ -12,6 +12,7 @@ use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\GContact;
use Friendica\Model\Contact;
use Friendica\Model\GServer;
use Friendica\Network\Probe;
use Friendica\Protocol\PortableContact;
use Friendica\Util\DateTimeFormat;
@@ -86,7 +87,7 @@ class DiscoverPoCo
return;
}
$result = "Checking server ".$server_url." - ";
$ret = PortableContact::checkServer($server_url);
$ret = GServer::check($server_url);
if ($ret) {
$result .= "success";
} else {
@@ -186,7 +187,7 @@ class DiscoverPoCo
$server_url = $user["server_url"];
}

if ((($server_url == "") && ($user["network"] == Protocol::FEED)) || $force_update || PortableContact::checkServer($server_url, $user["network"])) {
if ((($server_url == "") && ($user["network"] == Protocol::FEED)) || $force_update || GServer::check($server_url, $user["network"])) {
Logger::log('Check profile '.$user["url"]);
Worker::add(PRIORITY_LOW, "DiscoverPoCo", "check_profile", $user["url"]);

@@ -237,7 +238,7 @@ class DiscoverPoCo

$server_url = Contact::getBasepath($jj->url);
if ($server_url != '') {
if (!PortableContact::checkServer($server_url)) {
if (!GServer::check($server_url)) {
Logger::log("Friendica server ".$server_url." doesn't answer.", Logger::DEBUG);
continue;
}


+ 2
- 1
src/Worker/PubSubPublish.php View File

@@ -9,6 +9,7 @@ use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\PushSubscriber;
use Friendica\Model\GServer;
use Friendica\Protocol\OStatus;
use Friendica\Util\Network;

@@ -30,7 +31,7 @@ class PubSubPublish
return;
}

/// @todo Check server status with PortableContact::checkServer()
/// @todo Check server status with GServer::check()
// Before this can be done we need a way to safely detect the server url.

Logger::log("Generate feed of user " . $subscriber['nickname']. " to " . $subscriber['callback_url']. " - last updated " . $subscriber['last_update'], Logger::DEBUG);


Loading…
Cancel
Save