]> git.mxchange.org Git - friendica.git/commitdiff
Directory moved
authorMichael <heluecht@pirati.ca>
Sat, 18 Nov 2017 07:59:30 +0000 (07:59 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 18 Nov 2017 07:59:30 +0000 (07:59 +0000)
include/Contact.php
include/api.php
include/directory.php [deleted file]
mod/admin.php
mod/profile_photo.php
mod/profiles.php
mod/register.php
mod/regmod.php
mod/settings.php
src/Worker/Directory.php [new file with mode: 0644]

index 60bef93a5af8e099161ce871275b172f3f434538..636bbc4a7a30346799b507d371e02c3cdccb1ba2 100644 (file)
@@ -37,7 +37,7 @@ function user_remove($uid) {
        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']);
index 33624dcf6ee3d6d8d57d2c8977d913581d342f24..69569bdc185813f638dfa1d659e2526f80aab7e1 100644 (file)
@@ -3870,7 +3870,7 @@ function api_account_update_profile_image($type)
        //$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());
diff --git a/include/directory.php b/include/directory.php
deleted file mode 100644 (file)
index f56e8db..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?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']);
-               }
-       }
-}
index 78e37afef6ff119c762017a4301dfd1f2d8f09d2..cda6d1a3b0baa23cb3edaf19885b44f42ddf5fc6 100644 (file)
@@ -705,7 +705,7 @@ function admin_page_site_post(App $a) {
        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;
        }
 
@@ -867,7 +867,7 @@ function admin_page_site_post(App $a) {
        // 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() != "") {
index 5f524514144f0d86d04f8633be13b17f7cb368ce..3ef0118da0178e373c588f345a292d17ec83946b 100644 (file)
@@ -132,7 +132,7 @@ function profile_photo_post(App $a) {
                                // 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());
@@ -232,7 +232,7 @@ function profile_photo_content(App $a) {
                        // 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');
index 4263897d0b19cbbac30704d8c1bd368c68cf8b9b..545fb2fc78bb6854a5df91d24e361f9c8f3795c1 100644 (file)
@@ -503,7 +503,7 @@ function profiles_post(App $a) {
                        // 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());
index 4d0ef964858b5f280119638283c9cae8e721a256..cd6385144cd21e660b13327d073b60f136357160 100644 (file)
@@ -72,7 +72,7 @@ function register_post(App $a) {
 
        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');
index d6e122a286d302e02652cfe7d712702417b8405a..6d76e7ea7eb7f8814d892283ace04fa144782aac 100644 (file)
@@ -45,7 +45,7 @@ function user_allow($hash) {
        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);
                }
        }
 
index e693f775958d9db5e14f832f9924c7601ed77a09..c0b3d2cc16082f5721a161b61f412e9010efc988 100644 (file)
@@ -645,7 +645,7 @@ function settings_post(App $a) {
                // 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);
                }
        }
 
diff --git a/src/Worker/Directory.php b/src/Worker/Directory.php
new file mode 100644 (file)
index 0000000..8e5383a
--- /dev/null
@@ -0,0 +1,53 @@
+<?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']);
+                       }
+               }
+       }
+}