diff --git a/src/Content/Widget.php b/src/Content/Widget.php
index 8633992870..1b2502d2d6 100644
--- a/src/Content/Widget.php
+++ b/src/Content/Widget.php
@@ -25,12 +25,14 @@ use Friendica\Core\Addon;
use Friendica\Core\Cache\Enum\Duration;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
+use Friendica\Core\Search;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Post;
+use Friendica\Model\Profile;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Temporal;
@@ -59,7 +61,7 @@ class Widget
*/
public static function findPeople()
{
- $global_dir = DI::config()->get('system', 'directory');
+ $global_dir = Search::getGlobalDirectory();
if (DI::config()->get('system', 'invitation_only')) {
$x = intval(DI::pConfig()->get(local_user(), 'system', 'invites_remaining'));
@@ -81,7 +83,7 @@ class Widget
$nv['random'] = DI::l10n()->t('Random Profile');
$nv['inv'] = DI::l10n()->t('Invite Friends');
$nv['directory'] = DI::l10n()->t('Global Directory');
- $nv['global_dir'] = $global_dir;
+ $nv['global_dir'] = Profile::zrl($global_dir, true);
$nv['local_directory'] = DI::l10n()->t('Local Directory');
$aside = [];
diff --git a/src/Core/Search.php b/src/Core/Search.php
index 17b9eeb8ff..41c75ad32b 100644
--- a/src/Core/Search.php
+++ b/src/Core/Search.php
@@ -104,7 +104,7 @@ class Search
*/
public static function getContactsFromGlobalDirectory($search, $type = self::TYPE_ALL, $page = 1)
{
- $server = DI::config()->get('system', 'directory', self::DEFAULT_DIRECTORY);
+ $server = self::getGlobalDirectory();
$searchUrl = $server . '/search';
diff --git a/src/Model/Contact.php b/src/Model/Contact.php
index acb4bc10ed..2204b6c6e0 100644
--- a/src/Model/Contact.php
+++ b/src/Model/Contact.php
@@ -2781,6 +2781,7 @@ class Contact
self::remove($contact['id']);
} else {
DI::logger()->info('Couldn\'t remove follower because of invalid contact array', ['contact' => $contact, 'callstack' => System::callstack()]);
+ return;
}
$cdata = Contact::getPublicAndUserContactID($contact['id'], $contact['uid']);
diff --git a/src/Model/User.php b/src/Model/User.php
index 500b63658d..71e2c8a812 100644
--- a/src/Model/User.php
+++ b/src/Model/User.php
@@ -30,6 +30,7 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
+use Friendica\Core\Search;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
@@ -1287,7 +1288,7 @@ class User
$profile = DBA::selectFirst('profile', ['net-publish'], ['uid' => $register['uid']]);
- if (DBA::isResult($profile) && $profile['net-publish'] && DI::config()->get('system', 'directory')) {
+ if (DBA::isResult($profile) && $profile['net-publish'] && Search::getGlobalDirectory()) {
$url = DI::baseUrl() . '/profile/' . $user['nickname'];
Worker::add(PRIORITY_LOW, "Directory", $url);
}
diff --git a/src/Module/Api/Friendica/Profile/Show.php b/src/Module/Api/Friendica/Profile/Show.php
index 2d686d9cae..67f4e22edf 100644
--- a/src/Module/Api/Friendica/Profile/Show.php
+++ b/src/Module/Api/Friendica/Profile/Show.php
@@ -23,6 +23,7 @@ namespace Friendica\Module\Api\Friendica\Profile;
use Friendica\Profile\ProfileField\Collection\ProfileFields;
use Friendica\Content\Text\BBCode;
+use Friendica\Core\Search;
use Friendica\DI;
use Friendica\Model\Profile;
use Friendica\Module\BaseApi;
@@ -39,7 +40,7 @@ class Show extends BaseApi
$uid = self::getCurrentUserID();
// retrieve general information about profiles for user
- $directory = DI::config()->get('system', 'directory');
+ $directory = Search::getGlobalDirectory();
$profile = Profile::getByUID($uid);
diff --git a/src/Module/Api/Mastodon/Accounts/Search.php b/src/Module/Api/Mastodon/Accounts/Search.php
index cec6cc0d95..60db5b057d 100644
--- a/src/Module/Api/Mastodon/Accounts/Search.php
+++ b/src/Module/Api/Mastodon/Accounts/Search.php
@@ -59,7 +59,7 @@ class Search extends BaseApi
if (empty($results)) {
if (DI::config()->get('system', 'poco_local_search')) {
$results = CoreSearch::getContactsFromLocalDirectory($request['q'], CoreSearch::TYPE_ALL, 0, $request['limit']);
- } elseif (!empty(DI::config()->get('system', 'directory'))) {
+ } elseif (CoreSearch::getGlobalDirectory()) {
$results = CoreSearch::getContactsFromGlobalDirectory($request['q'], CoreSearch::TYPE_ALL, 1);
}
}
diff --git a/src/Module/Api/Mastodon/Search.php b/src/Module/Api/Mastodon/Search.php
index 6915944776..e3f462325e 100644
--- a/src/Module/Api/Mastodon/Search.php
+++ b/src/Module/Api/Mastodon/Search.php
@@ -91,7 +91,7 @@ class Search extends BaseApi
if (empty($results)) {
if (DI::config()->get('system', 'poco_local_search')) {
$results = CoreSearch::getContactsFromLocalDirectory($q, CoreSearch::TYPE_ALL, 0, $limit);
- } elseif (!empty(DI::config()->get('system', 'directory'))) {
+ } elseif (CoreSearch::getGlobalDirectory()) {
$results = CoreSearch::getContactsFromGlobalDirectory($q, CoreSearch::TYPE_ALL, 1);
}
}
diff --git a/src/Module/BaseSearch.php b/src/Module/BaseSearch.php
index 3abc923182..ca5bb76127 100644
--- a/src/Module/BaseSearch.php
+++ b/src/Module/BaseSearch.php
@@ -91,7 +91,7 @@ class BaseSearch extends BaseModule
if ($localSearch && empty($results)) {
$pager->setItemsPerPage(80);
$results = Search::getContactsFromLocalDirectory($search, $type, $pager->getStart(), $pager->getItemsPerPage());
- } elseif (strlen($config->get('system', 'directory')) && empty($results)) {
+ } elseif (Search::getGlobalDirectory() && empty($results)) {
$results = Search::getContactsFromGlobalDirectory($search, $type, $pager->getPage());
$pager->setItemsPerPage($results->getItemsPage());
}
diff --git a/src/Module/Directory.php b/src/Module/Directory.php
index 8d7b8611b6..b79e7b1495 100644
--- a/src/Module/Directory.php
+++ b/src/Module/Directory.php
@@ -28,6 +28,7 @@ use Friendica\Content\Widget;
use Friendica\Core\Hook;
use Friendica\Core\Session;
use Friendica\Core\Renderer;
+use Friendica\Core\Search;
use Friendica\DI;
use Friendica\Model;
use Friendica\Model\Profile;
@@ -61,7 +62,7 @@ class Directory extends BaseModule
$search = trim(rawurldecode($_REQUEST['search'] ?? ''));
$gDirPath = '';
- $dirURL = $config->get('system', 'directory');
+ $dirURL = Search::getGlobalDirectory();
if (strlen($dirURL)) {
$gDirPath = Profile::zrl($dirURL, true);
}
diff --git a/src/Module/Invite.php b/src/Module/Invite.php
index 1ce9700697..77a7585bd4 100644
--- a/src/Module/Invite.php
+++ b/src/Module/Invite.php
@@ -23,6 +23,7 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\Renderer;
+use Friendica\Core\Search;
use Friendica\DI;
use Friendica\Model;
use Friendica\Model\User;
@@ -143,7 +144,7 @@ class Invite extends BaseModule
}
}
- $dirLocation = $config->get('system', 'directory');
+ $dirLocation = Search::getGlobalDirectory();
if (strlen($dirLocation)) {
if ($config->get('config', 'register_policy') === Register::CLOSED) {
$linkTxt = DI::l10n()->t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.', $dirLocation . '/servers');
diff --git a/src/Module/Settings/Account.php b/src/Module/Settings/Account.php
index d991fd89ec..bba8e19413 100644
--- a/src/Module/Settings/Account.php
+++ b/src/Module/Settings/Account.php
@@ -25,6 +25,7 @@ use Exception;
use Friendica\Core\ACL;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
+use Friendica\Core\Search;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
@@ -516,8 +517,8 @@ class Account extends BaseSettings
}
$net_pub_desc = '';
- if (strlen(DI::config()->get('system', 'directory'))) {
- $net_pub_desc = ' ' . DI::l10n()->t('Your profile will also be published in the global friendica directories (e.g. %s).', DI::config()->get('system', 'directory'), DI::config()->get('system', 'directory'));
+ if (Search::getGlobalDirectory()) {
+ $net_pub_desc = ' ' . DI::l10n()->t('Your profile will also be published in the global friendica directories (e.g. %s).', Search::getGlobalDirectory(), Search::getGlobalDirectory());
}
/* Installed langs */
diff --git a/src/Worker/Directory.php b/src/Worker/Directory.php
index 65034a44ae..d6294d0498 100644
--- a/src/Worker/Directory.php
+++ b/src/Worker/Directory.php
@@ -23,6 +23,7 @@ namespace Friendica\Worker;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
+use Friendica\Core\Search;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
@@ -35,7 +36,7 @@ class Directory
{
public static function execute($url = '')
{
- $dir = DI::config()->get('system', 'directory');
+ $dir = Search::getGlobalDirectory();
if (!strlen($dir)) {
return;
diff --git a/src/Worker/PullDirectory.php b/src/Worker/PullDirectory.php
index 2cf0841246..8a22e504c0 100644
--- a/src/Worker/PullDirectory.php
+++ b/src/Worker/PullDirectory.php
@@ -22,6 +22,7 @@
namespace Friendica\Worker;
use Friendica\Core\Logger;
+use Friendica\Core\Search;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
@@ -38,7 +39,7 @@ class PullDirectory
return;
}
- $directory = DI::config()->get('system', 'directory');
+ $directory = Search::getGlobalDirectory();
if (empty($directory)) {
Logger::info('No directory configured');
return;