]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/User.php
Make "HTTPRequest::fetchUrl" dynamic
[friendica.git] / src / Model / User.php
index 89574e76094fc5857e6651badb36efaf3d7a969f..9980c48d5aeeaaa2af4d5455da6305e343b2763d 100644 (file)
@@ -823,7 +823,7 @@ class User
                        $photo_failure = false;
 
                        $filename = basename($photo);
-                       $curlResult = Network::curl($photo, true);
+                       $curlResult = DI::httpRequest()->curl($photo, true);
                        if ($curlResult->isSuccess()) {
                                $img_str = $curlResult->getBody();
                                $type = $curlResult->getContentType();
@@ -1162,7 +1162,7 @@ class User
                // unique), so it cannot be re-registered in the future.
                DBA::insert('userd', ['username' => $user['nickname']]);
 
-               // The user and related data will be deleted in "cron_expire_and_remove_users" (cronjobs.php)
+               // The user and related data will be deleted in Friendica\Worker\CronJobs::expireAndRemoveUsers()
                DBA::update('user', ['account_removed' => true, 'account_expires_on' => DateTimeFormat::utc('now + 7 day')], ['uid' => $uid]);
                Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::REMOVAL, $uid);
 
@@ -1272,6 +1272,7 @@ class User
                        'total_users'           => 0,
                        'active_users_halfyear' => 0,
                        'active_users_monthly'  => 0,
+                       'active_users_weekly'   => 0,
                ];
 
                $userStmt = DBA::select('owner-view', ['uid', 'login_date', 'last-item'],
@@ -1284,6 +1285,7 @@ class User
 
                $halfyear = time() - (180 * 24 * 60 * 60);
                $month = time() - (30 * 24 * 60 * 60);
+               $week = time() - (7 * 24 * 60 * 60);
 
                while ($user = DBA::fetch($userStmt)) {
                        $statistics['total_users']++;
@@ -1297,6 +1299,11 @@ class User
                        ) {
                                $statistics['active_users_monthly']++;
                        }
+
+                       if ((strtotime($user['login_date']) > $week) || (strtotime($user['last-item']) > $week)
+                       ) {
+                               $statistics['active_users_weekly']++;
+                       }
                }
                DBA::close($userStmt);
 
@@ -1321,6 +1328,7 @@ class User
                $condition = [];
                switch ($type) {
                        case 'active':
+                               $condition['account_removed'] = false;
                                $condition['blocked'] = false;
                                break;
                        case 'blocked':