]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/Cron.php
Merge remote-tracking branch 'upstream/develop' into reduce-update-contacts
[friendica.git] / src / Worker / Cron.php
index 2c724366dab13aa3ab175c370950ea9fca44849d..94f002805b4baf2974eb823e6e051833906e359a 100644 (file)
@@ -29,6 +29,7 @@ use Friendica\DI;
 use Friendica\Model\Tag;
 use Friendica\Protocol\ActivityPub\Queue;
 use Friendica\Protocol\Relay;
+use Friendica\Util\DateTimeFormat;
 
 class Cron
 {
@@ -62,29 +63,30 @@ class Cron
                }
 
                // Fork the cron jobs in separate parts to avoid problems when one of them is crashing
-               Hook::fork(PRIORITY_MEDIUM, 'cron');
+               Hook::fork(Worker::PRIORITY_MEDIUM, 'cron');
 
                // Poll contacts
-               Worker::add(PRIORITY_MEDIUM, 'PollContacts');
+               Worker::add(Worker::PRIORITY_MEDIUM, 'PollContacts');
 
                // Update contact information
-               Worker::add(PRIORITY_LOW, 'UpdateContacts');
+               Worker::add(Worker::PRIORITY_LOW, 'UpdateContacts');
 
                // Update server information
-               Worker::add(PRIORITY_LOW, 'UpdateGServers');
+               Worker::add(Worker::PRIORITY_LOW, 'UpdateGServers');
 
                // run the process to update server directories in the background
-               Worker::add(PRIORITY_LOW, 'UpdateServerDirectories');
+               Worker::add(Worker::PRIORITY_LOW, 'UpdateServerDirectories');
 
                // Expire and remove user entries
-               Worker::add(PRIORITY_MEDIUM, 'ExpireAndRemoveUsers');
+               Worker::add(Worker::PRIORITY_MEDIUM, 'ExpireAndRemoveUsers');
 
                // Call possible post update functions
-               Worker::add(PRIORITY_LOW, 'PostUpdate');
+               Worker::add(Worker::PRIORITY_LOW, 'PostUpdate');
 
                // Hourly cron calls
                if (DI::config()->get('system', 'last_cron_hourly', 0) + 3600 < time()) {
 
+
                        // Update trending tags cache for the community page
                        Tag::setLocalTrendingHashtags(24, 20);
                        Tag::setGlobalTrendingHashtags(24, 20);
@@ -93,17 +95,15 @@ class Cron
                        Queue::clear();
 
                        // Process all unprocessed entries
-                       if (DI::config()->get('system', 'decoupled_receiver')) {
-                               Queue::processAll();
-                       }
+                       Queue::processAll();
 
                        // Search for new contacts in the directory
                        if (DI::config()->get('system', 'synchronize_directory')) {
-                               Worker::add(PRIORITY_LOW, 'PullDirectory');
+                               Worker::add(Worker::PRIORITY_LOW, 'PullDirectory');
                        }
 
                        // Clear cache entries
-                       Worker::add(PRIORITY_LOW, 'ClearCache');
+                       Worker::add(Worker::PRIORITY_LOW, 'ClearCache');
 
                        DI::config()->set('system', 'last_cron_hourly', time());
                }
@@ -111,29 +111,37 @@ class Cron
                // Daily maintenance cron calls
                if (Worker::isInMaintenanceWindow(true)) {
 
-                       Worker::add(PRIORITY_LOW, 'UpdateContactBirthdays');
+                       Worker::add(Worker::PRIORITY_LOW, 'UpdateContactBirthdays');
 
-                       Worker::add(PRIORITY_LOW, 'UpdatePhotoAlbums');
+                       Worker::add(Worker::PRIORITY_LOW, 'UpdatePhotoAlbums');
 
-                       Worker::add(PRIORITY_LOW, 'ExpirePosts');
+                       Worker::add(Worker::PRIORITY_LOW, 'ExpirePosts');
 
-                       Worker::add(PRIORITY_LOW, 'ExpireActivities');
+                       Worker::add(Worker::PRIORITY_LOW, 'ExpireActivities');
 
-                       Worker::add(PRIORITY_LOW, 'RemoveUnusedTags');
+                       Worker::add(Worker::PRIORITY_LOW, 'RemoveUnusedTags');
 
-                       Worker::add(PRIORITY_LOW, 'RemoveUnusedContacts');
+                       Worker::add(Worker::PRIORITY_LOW, 'RemoveUnusedContacts');
 
-                       Worker::add(PRIORITY_LOW, 'RemoveUnusedAvatars');
+                       Worker::add(Worker::PRIORITY_LOW, 'RemoveUnusedAvatars');
 
                        // check upstream version?
-                       Worker::add(PRIORITY_LOW, 'CheckVersion');
+                       Worker::add(Worker::PRIORITY_LOW, 'CheckVersion');
 
-                       Worker::add(PRIORITY_LOW, 'CheckDeletedContacts');
+                       Worker::add(Worker::PRIORITY_LOW, 'CheckDeletedContacts');
+
+                       Worker::add(Worker::PRIORITY_LOW, 'UpdateAllSuggestions');
 
                        if (DI::config()->get('system', 'optimize_tables')) {
-                               Worker::add(PRIORITY_LOW, 'OptimizeTables');
+                               Worker::add(Worker::PRIORITY_LOW, 'OptimizeTables');
                        }
 
+                       $users = DBA::select('owner-view', ['uid'], ["`homepage_verified` OR (`last-activity` > ? AND `homepage` != ?)", DateTimeFormat::utc('now - 7 days', 'Y-m-d'), '']);
+                       while ($user = DBA::fetch($users)) {
+                               Worker::add(Worker::PRIORITY_LOW, 'CheckRelMeProfileLink', $user['uid']);
+                       }
+                       DBA::close($users);
+       
                        // Resubscribe to relay servers
                        Relay::reSubscribe();