Worker::add(PRIORITY_HIGH, "notifier", "removeme", $uid);
// Send an update to the directory
- Worker::add(PRIORITY_LOW, "directory", $r['url']);
+ Worker::add(PRIORITY_LOW, "Directory", $r['url']);
if($uid == local_user()) {
unset($_SESSION['authenticated']);
//$user = api_get_user(get_app());
$url = System::baseUrl() . '/profile/' . get_app()->user['nickname'];
if ($url && strlen(Config::get('system', 'directory'))) {
- Worker::add(PRIORITY_LOW, "directory", $url);
+ Worker::add(PRIORITY_LOW, "Directory", $url);
}
Worker::add(PRIORITY_LOW, 'profile_update', api_user());
+++ /dev/null
-<?php
-
-use Friendica\Core\Config;
-use Friendica\Core\Worker;
-use Friendica\Database\DBM;
-
-function directory_run(&$argv, &$argc){
- $dir = Config::get('system', 'directory');
-
- if (!strlen($dir)) {
- return;
- }
-
- if ($argc < 2) {
- directory_update_all();
- return;
- }
-
- $dir .= "/submit";
-
- $arr = array('url' => $argv[1]);
-
- call_hooks('globaldir_update', $arr);
-
- logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
- if (strlen($arr['url'])) {
- fetch_url($dir . '?url=' . bin2hex($arr['url']));
- }
-
- 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) {
- Worker::add(PRIORITY_LOW, 'directory', $user['url']);
- }
- }
-}
check_form_security_token_redirectOnErr('/admin/site', 'admin_site');
if (!empty($_POST['republish_directory'])) {
- Worker::add(PRIORITY_LOW, 'directory');
+ Worker::add(PRIORITY_LOW, 'Directory');
return;
}
// Has the directory url changed? If yes, then resubmit the existing profiles there
if ($global_directory != Config::get('system', 'directory') && ($global_directory != '')) {
Config::set('system', 'directory', $global_directory);
- Worker::add(PRIORITY_LOW, 'directory');
+ Worker::add(PRIORITY_LOW, 'Directory');
}
if ($a->get_path() != "") {
// Update global directory in background
$url = System::baseUrl() . '/profile/' . $a->user['nickname'];
if ($url && strlen(Config::get('system','directory'))) {
- Worker::add(PRIORITY_LOW, "directory", $url);
+ Worker::add(PRIORITY_LOW, "Directory", $url);
}
Worker::add(PRIORITY_LOW, 'profile_update', local_user());
// Update global directory in background
$url = $_SESSION['my_url'];
if ($url && strlen(Config::get('system','directory'))) {
- Worker::add(PRIORITY_LOW, "directory", $url);
+ Worker::add(PRIORITY_LOW, "Directory", $url);
}
goaway(System::baseUrl() . '/profiles');
// Update global directory in background
$url = $_SESSION['my_url'];
if ($url && strlen(Config::get('system', 'directory'))) {
- Worker::add(PRIORITY_LOW, "directory", $url);
+ Worker::add(PRIORITY_LOW, "Directory", $url);
}
Worker::add(PRIORITY_LOW, 'profile_update', local_user());
if($netpublish && $a->config['register_policy'] != REGISTER_APPROVE) {
$url = System::baseUrl() . '/profile/' . $user['nickname'];
- Worker::add(PRIORITY_LOW, "directory", $url);
+ Worker::add(PRIORITY_LOW, "Directory", $url);
}
$using_invites = Config::get('system','invitation_only');
if (DBM::is_result($r) && $r[0]['net-publish']) {
$url = System::baseUrl() . '/profile/' . $user[0]['nickname'];
if ($url && strlen(Config::get('system','directory'))) {
- Worker::add(PRIORITY_LOW, "directory", $url);
+ Worker::add(PRIORITY_LOW, "Directory", $url);
}
}
// Update global directory in background
$url = $_SESSION['my_url'];
if ($url && strlen(Config::get('system', 'directory'))) {
- Worker::add(PRIORITY_LOW, "directory", $url);
+ Worker::add(PRIORITY_LOW, "Directory", $url);
}
}
--- /dev/null
+<?php
+/**
+ * @file src/Worker/Directory.php
+ * @brief Sends updated profile data to the directory
+ */
+
+namespace Friendica\Worker;
+
+use Friendica\Core\Config;
+use Friendica\Core\Worker;
+use Friendica\Database\DBM;
+
+class Directory {
+ public static function execute($url = '') {
+ $dir = Config::get('system', 'directory');
+
+ if (!strlen($dir)) {
+ return;
+ }
+
+ if ($url == '') {
+ self::updateAll();
+ return;
+ }
+
+ $dir .= "/submit";
+
+ $arr = array('url' => $argv[1]);
+
+ call_hooks('globaldir_update', $arr);
+
+ logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
+ if (strlen($arr['url'])) {
+ fetch_url($dir . '?url=' . bin2hex($arr['url']));
+ }
+
+ return;
+ }
+
+ private static function updateAll() {
+ $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) {
+ Worker::add(PRIORITY_LOW, 'Directory', $user['url']);
+ }
+ }
+ }
+}