mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-07 00:36:48 +02:00
- update CI process to include quality stage (tests + code review) - add captainhook to install git pre-commit & pre-push hooks - remove .devcontainer Dockerfile to use project's docker-compose services: all services can now be started automatically using vscode - update docs/setup-development.md
39 lines
1 KiB
PHP
39 lines
1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @copyright 2021 Podlibre
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
* @link https://castopod.org/
|
|
*/
|
|
|
|
namespace ActivityPub\Controllers;
|
|
|
|
use CodeIgniter\Controller;
|
|
|
|
class SchedulerController extends Controller
|
|
{
|
|
/**
|
|
* @var string[]
|
|
*/
|
|
protected $helpers = ['activitypub'];
|
|
|
|
public function activity(): void
|
|
{
|
|
// retrieve scheduled activities from database
|
|
$scheduledActivities = model('ActivityModel')->getScheduledActivities();
|
|
|
|
// Send activity to all followers
|
|
foreach ($scheduledActivities as $scheduledActivity) {
|
|
// send activity to all actor followers
|
|
send_activity_to_followers(
|
|
$scheduledActivity->actor,
|
|
json_encode($scheduledActivity->payload, JSON_THROW_ON_ERROR),
|
|
);
|
|
|
|
// set activity status to delivered
|
|
model('ActivityModel')->update($scheduledActivity->id, [
|
|
'status' => 'delivered',
|
|
]);
|
|
}
|
|
}
|
|
}
|