deprecate directory stuff

This commit is contained in:
Mike Macgirvin 2022-06-06 20:41:40 -07:00
parent d22c7e5aef
commit 29423d8039
8 changed files with 5 additions and 85 deletions

View file

@ -754,7 +754,6 @@ class Libzot
Hook::call('import_xchan', $arr);
$ret = array('success' => false);
$dirmode = intval(get_config('system', 'directory_mode'));
$changed = false;
$what = '';
@ -804,15 +803,6 @@ class Libzot
$import_photos = true;
}
// if we import an entry from a site that's not ours and either or both of us is off the grid - hide the entry.
/** @TODO: check if we're the same directory realm, which would mean we are allowed to see it */
$dirmode = get_config('system', 'directory_mode');
if ((($arr['site']['directory_mode'] === 'standalone') || ($dirmode & DIRECTORY_MODE_STANDALONE)) && ($arr['site']['url'] != z_root())) {
$arr['searchable'] = false;
}
$hidden = (1 - intval($arr['searchable']));
$hidden_changed = $adult_changed = $deleted_changed = $type_changed = 0;
@ -906,15 +896,6 @@ class Libzot
} else {
$import_photos = true;
if (
(($arr['site']['directory_mode'] === 'standalone')
|| ($dirmode & DIRECTORY_MODE_STANDALONE))
&& ($arr['site']['url'] != z_root())
) {
$arr['searchable'] = false;
}
if ($arr['channel_type'] === 'collection') {
$px = 2;
} elseif ($arr['channel_type'] === 'group') {
@ -2728,14 +2709,6 @@ class Libzot
$siterecord = $r[0];
}
$site_directory = 0;
if ($arr['directory_mode'] == 'normal') {
$site_directory = DIRECTORY_MODE_NORMAL;
}
if ($arr['directory_mode'] == 'standalone') {
$site_directory = DIRECTORY_MODE_STANDALONE;
}
$register_policy = 0;
if ($arr['register_policy'] == 'closed') {
$register_policy = REGISTER_CLOSED;

View file

@ -17,38 +17,6 @@ require_once('include/permissions.php');
class Libzotdir
{
/**
* Directories may come and go over time. We will need to check that our
* directory server is still valid occasionally, and reset to something that
* is if our directory has gone offline for any reason
*/
public static function check_upstream_directory()
{
$directory = get_config('system', 'directory_server');
// it's possible there is no directory server configured and the local hub is being used.
// If so, default to preserving the absence of a specific server setting.
$isadir = true;
if ($directory) {
$j = Zotfinger::exec($directory);
if (array_path_exists('data/directory_mode', $j)) {
if ($j['data']['directory_mode'] === 'normal') {
$isadir = false;
}
}
}
if (!$isadir) {
set_config('system', 'directory_server', '');
}
}
public static function get_directory_setting($observer, $setting)
{

View file

@ -14,12 +14,6 @@ class Dircensor extends Controller
return;
}
$dirmode = intval(get_config('system', 'directory_mode'));
if (!($dirmode == DIRECTORY_MODE_PRIMARY || $dirmode == DIRECTORY_MODE_STANDALONE)) {
return;
}
$xchan = argv(1);
if (!$xchan) {
return;

View file

@ -102,7 +102,7 @@ class Dirsearch extends Controller
$sync = false;
}
if (($dirmode == DIRECTORY_MODE_STANDALONE) && (!$hub)) {
if (!$hub) {
$hub = App::get_hostname();
}
@ -203,10 +203,6 @@ class Dirsearch extends Controller
$logic = 'true';
}
if ($dirmode == DIRECTORY_MODE_STANDALONE) {
$sql_extra .= " and xchan_addr like '%%" . App::get_hostname() . "' ";
}
$safesql = (($safe > 0) ? " and xchan_censored = 0 and xchan_selfcensored = 0 " : '');
if ($safe < 0) {
$safesql = " and ( xchan_censored = 1 OR xchan_selfcensored = 1 ) ";

View file

@ -209,11 +209,7 @@ class Register extends Controller
if (intval(get_config('system', 'register_policy')) === REGISTER_CLOSED) {
notice(t('Registration on this website is disabled.') . EOL);
if (intval(get_config('system', 'directory_mode')) === DIRECTORY_MODE_STANDALONE) {
return EMPTY_STR;
} else {
$other_sites = true;
}
$other_sites = true;
}
if (intval(get_config('system', 'register_policy')) == REGISTER_APPROVE) {

View file

@ -285,10 +285,7 @@ function mark_orphan_hubsxchans()
return;
$dirmode = intval(get_config('system', 'directory_mode'));
if ($dirmode == DIRECTORY_MODE_NORMAL) {
return;
}
$r = q("update hubloc set hubloc_deleted = 1 where hubloc_deleted = 0
and hubloc_network in ('nomad','zot6') and hubloc_connected < %s - interval %s",

View file

@ -90,6 +90,7 @@ function collecturls($message)
preg_match_all($pattern, $message, $result, PREG_SET_ORDER);
$urls = [];
$ignore = false;
foreach ($result as $treffer) {
// A list of some links that should be ignored
$list = array("/user/", "/tag/", "/group/", "/profile/", "/channel/", "/search?search=", "/search?tag=", "mailto:", "/u/", "/node/",

View file

@ -1351,7 +1351,6 @@ function get_site_info()
{
$register_policy = array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
$directory_mode = array('DIRECTORY_MODE_NORMAL', 'DIRECTORY_MODE_PRIMARY', 'DIRECTORY_MODE_SECONDARY', 256 => 'DIRECTORY_MODE_STANDALONE');
$sql_extra = '';
@ -1428,7 +1427,7 @@ function get_site_info()
}
}
$protocols = [ 'nomad' ];
$protocols = [ 'nomad', 'zot6' ];
if (get_config('system', 'activitypub', ACTIVITYPUB_ENABLED)) {
$protocols[] = 'activitypub';
}
@ -1438,17 +1437,13 @@ function get_site_info()
'platform' => System::get_project_name(),
'site_name' => (($site_name) ? $site_name : ''),
'version' => $version,
// 'version_tag' => $tag,
'addon_version' => defined('ADDON_VERSION') ? ADDON_VERSION : 'unknown',
'commit' => $commit,
'protocols' => $protocols,
'plugins' => $visible_plugins,
'register_policy' => $register_policy[get_config('system', 'register_policy')],
'invitation_only' => (bool) (defined('INVITE_WORKING') && intval(get_config('system', 'invitation_only'))),
'directory_mode' => $directory_mode[get_config('system', 'directory_mode')],
// 'directory_server' => get_config('system','directory_server'),
'language' => get_config('system', 'language'),
// 'rss_connections' => (bool) intval(get_config('system','feed_contacts')),
'expiration' => $site_expire,
'default_service_restrictions' => $service_class,
'locked_features' => $locked_features,