From: Michael Date: Mon, 17 Apr 2017 21:39:11 +0000 (+0000) Subject: Resubmit all profiles on directory change X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=47fd9226c3f0b90f460fe2031fa46cbb49a87100;p=friendica.git Resubmit all profiles on directory change --- diff --git a/include/directory.php b/include/directory.php index 088adbe789..4a221fac0c 100644 --- a/include/directory.php +++ b/include/directory.php @@ -2,16 +2,17 @@ use \Friendica\Core\Config; function directory_run(&$argv, &$argc){ - if ($argc != 2) { - return; - } - $dir = get_config('system', 'directory'); if (!strlen($dir)) { return; } + if ($argc < 2) { + directory_update_all(); + return; + } + $dir .= "/submit"; $arr = array('url' => $argv[1]); @@ -24,3 +25,17 @@ function directory_run(&$argv, &$argc){ } return; } + +function directory_update_all() { + $r = q("SELECT `url` FROM `contact` + INNER JOIN `profile` ON `profile`.`uid` = `contact`.`uid` + INNER JOIN `user` ON `user`.`uid` = `contact`.`uid` + WHERE `contact`.`self` AND `profile`.`net-publish` AND `profile`.`is-default` AND + NOT `user`.`account_expired` AND `user`.`verified`"); + + if (dbm::is_result($r)) { + foreach ($r AS $user) { + proc_run(PRIORITY_LOW, 'include/directory.php', $user['url']); + } + } +} diff --git a/mod/admin.php b/mod/admin.php index fb463d31c0..fe89faf443 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -668,6 +668,12 @@ function admin_page_site_post(App $a) { $worker_fastlane = ((x($_POST,'worker_fastlane')) ? True : False); $worker_frontend = ((x($_POST,'worker_frontend')) ? True : False); + // Has the directory url changed? If yes, then resubmit the existing profiles there + if ($global_directory != Config::get('system', 'directory') AND ($global_directory != '')) { + Config::set('system', 'directory', $global_directory); + proc_run(PRIORITY_LOW, 'include/directory.php'); + } + if ($a->get_path() != "") { $diaspora_enabled = false; } @@ -771,7 +777,6 @@ function admin_page_site_post(App $a) { set_config('system', 'allowed_email', $allowed_email); set_config('system', 'block_public', $block_public); set_config('system', 'publish_all', $force_publish); - set_config('system', 'directory', $global_directory); set_config('system', 'thread_allow', $thread_allow); set_config('system', 'newuser_private', $newuser_private); set_config('system', 'enotify_no_content', $enotify_no_content);