namespace Friendica\Worker;
use Friendica\Core\Logger;
+use Friendica\DI;
use Friendica\Model\GContact;
-use Friendica\Database\DBA;
class UpdateGContact
{
/**
* Update global contact via probe
- * @param string $url Global contact url
- * @param string $command
+ * @param string $url Global contact url
+ * @param string $command
+ * @param integer $following_gcid gcontact ID of the contact that is followed by this one
+ * @param integer $follower_gcid gcontact ID of the contact that is following this one
*/
- public static function execute($url, $command = '')
+ public static function execute(string $url, string $command = '', int $following_gcid = 0, int $follower_gcid = 0)
{
$force = ($command == "force");
$success = GContact::updateFromProbe($url, $force);
Logger::info('Updated from probe', ['url' => $url, 'force' => $force, 'success' => $success]);
+
+ if ($success && DI::config()->get('system', 'gcontact_discovery')) {
+ GContact::discoverFollowers($url, $following_gcid, $follower_gcid);
+ }
}
}