mirror of
https://github.com/friendica/friendica
synced 2025-02-10 14:54:01 +00:00
New function "add"
This commit is contained in:
parent
d45cd93278
commit
e5bf1b976a
2 changed files with 20 additions and 1 deletions
|
@ -24,6 +24,7 @@ use Friendica\Protocol\ActivityPub;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
use Friendica\Worker\AddContact;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides relationship information based on the `contact-relation` table.
|
* This class provides relationship information based on the `contact-relation` table.
|
||||||
|
@ -179,7 +180,7 @@ class Relation
|
||||||
$following_counter++;
|
$following_counter++;
|
||||||
}
|
}
|
||||||
} elseif (!Network::isUrlBlocked($contact_url)) {
|
} elseif (!Network::isUrlBlocked($contact_url)) {
|
||||||
Worker::add(Worker::PRIORITY_LOW, 'AddContact', 0, $contact_url);
|
AddContact::add(Worker::PRIORITY_LOW, 0, $contact_url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,12 @@
|
||||||
|
|
||||||
namespace Friendica\Worker;
|
namespace Friendica\Worker;
|
||||||
|
|
||||||
|
use Friendica\Core\Worker;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||||
use Friendica\Network\HTTPException\NotFoundException;
|
use Friendica\Network\HTTPException\NotFoundException;
|
||||||
|
use Friendica\Util\Network;
|
||||||
|
|
||||||
class AddContact
|
class AddContact
|
||||||
{
|
{
|
||||||
|
@ -39,4 +41,20 @@ class AddContact
|
||||||
DI::logger()->notice('Imagick not found.', ['exception' => $e, 'uid' => $uid, 'url' => $url]);
|
DI::logger()->notice('Imagick not found.', ['exception' => $e, 'uid' => $uid, 'url' => $url]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array|int $run_parameters Priority constant or array of options described in Worker::add
|
||||||
|
* @param int $uid User ID
|
||||||
|
* @param string $url Contact link
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function add($run_parameters, int $uid, string $url): int
|
||||||
|
{
|
||||||
|
if (Network::isUrlBlocked($url)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DI::logger()->debug('Add contact', ['uid' => $uid, 'url' => $url]);
|
||||||
|
return Worker::add($run_parameters, 'AddContact', 0, $url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue