Merge pull request #8230 from AlfredSK/AlfredSK-statistics-query
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 9 Feb 2020 22:54:22 +0000 (17:54 -0500)
committerGitHub <noreply@github.com>
Sun, 9 Feb 2020 22:54:22 +0000 (17:54 -0500)
Changed statistics query for nodeinfo

1  2 
src/Model/User.php

diff --combined src/Model/User.php
@@@ -1,22 -1,8 +1,22 @@@
  <?php
 -
  /**
 - * @file src/Model/User.php
 - * This file includes the User class with user related database functions
 + * @copyright Copyright (C) 2020, Friendica
 + *
 + * @license GNU AGPL version 3 or any later version
 + *
 + * This program is free software: you can redistribute it and/or modify
 + * it under the terms of the GNU Affero General Public License as
 + * published by the Free Software Foundation, either version 3 of the
 + * License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU Affero General Public License for more details.
 + *
 + * You should have received a copy of the GNU Affero General Public License
 + * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 + *
   */
  
  namespace Friendica\Model;
@@@ -911,13 -897,13 +911,13 @@@ class Use
                        $password
                ));
  
 -              return notification([
 -                      'type'     => SYSTEM_EMAIL,
 -                      'uid'      => $user['uid'],
 -                      'to_email' => $user['email'],
 -                      'subject'  => DI::l10n()->t('Registration at %s', $sitename),
 -                      'body'     => $body
 -              ]);
 +              $email = DI::emailer()
 +                      ->newSystemMail()
 +                      ->withMessage(DI::l10n()->t('Registration at %s', $sitename), $body)
 +                      ->forUser($user)
 +                      ->withRecipient($user['email'])
 +                      ->build();
 +              return DI::emailer()->send($email);
        }
  
        /**
                        $password
                ));
  
 -              return notification([
 -                      'uid'      => $user['uid'],
 -                      'language' => $user['language'],
 -                      'type'     => SYSTEM_EMAIL,
 -                      'to_email' => $user['email'],
 -                      'subject'  => DI::l10n()->t('Registration details for %s', $sitename),
 -                      'preamble' => $preamble,
 -                      'body'     => $body
 -              ]);
 +              $email = DI::emailer()
 +                      ->newSystemMail()
 +                      ->withMessage(DI::l10n()->t('Registration details for %s', $sitename), $preamble, $body)
 +                      ->forUser($user)
 +                      ->withRecipient($user['email'])
 +                      ->build();
 +              return DI::emailer()->send($email);
        }
  
        /**
  
                $userStmt = DBA::p("SELECT `user`.`uid`, `user`.`login_date`, `contact`.`last-item`
                        FROM `user`
-                       INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`
                        INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
-                       WHERE (`profile`.`publish` OR `profile`.`net-publish`) AND `user`.`verified`
-                               AND NOT `user`.`blocked` AND NOT `user`.`account_removed`
-                               AND NOT `user`.`account_expired`");
+                       WHERE `user`.`verified`
+                               AND `user`.`login_date` > ?
+                               AND NOT `user`.`blocked`
+                               AND NOT `user`.`account_removed`
+                               AND NOT `user`.`account_expired`",
+                               DBA::NULL_DATETIME
+               );
  
                if (!DBA::isResult($userStmt)) {
                        return $statistics;