mirror of
https://github.com/friendica/friendica
synced 2024-11-18 13:03:41 +00:00
Use central function to fetch the global directory
This commit is contained in:
parent
478ee7b6fc
commit
171354181d
13 changed files with 24 additions and 14 deletions
|
@ -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 = [];
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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. <a href="%s">%s</a>).', 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. <a href="%s">%s</a>).', Search::getGlobalDirectory(), Search::getGlobalDirectory());
|
||||
}
|
||||
|
||||
/* Installed langs */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue