2023-08-30 21:17:42 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2024-01-02 21:57:26 +01:00
|
|
|
* @copyright Copyright (C) 2010-2024, the Friendica project
|
2023-08-30 21:17:42 +02:00
|
|
|
*
|
|
|
|
* @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\Worker;
|
|
|
|
|
|
|
|
use Friendica\Core\Logger;
|
|
|
|
use Friendica\Database\DBA;
|
|
|
|
use Friendica\Model\Contact\Relation;
|
2023-09-01 23:56:59 +02:00
|
|
|
use Friendica\Model\Post;
|
2023-08-30 21:17:42 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the interaction scores
|
|
|
|
*/
|
|
|
|
class UpdateScores
|
|
|
|
{
|
|
|
|
public static function execute($param = '', $hook_function = '')
|
|
|
|
{
|
|
|
|
Logger::notice('Start score update');
|
|
|
|
|
2023-09-08 17:01:51 +02:00
|
|
|
$users = DBA::select('user', ['uid'], ["`verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired` AND `uid` > ?", 0]);
|
2023-08-30 21:17:42 +02:00
|
|
|
while ($user = DBA::fetch($users)) {
|
|
|
|
Relation::calculateInteractionScore($user['uid']);
|
|
|
|
}
|
|
|
|
DBA::close($users);
|
|
|
|
|
|
|
|
Logger::notice('Score update done');
|
2023-09-01 23:56:59 +02:00
|
|
|
|
|
|
|
Post\Engagement::expire();
|
|
|
|
|
2023-08-30 21:17:42 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|