mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-13 11:37:46 +02:00
refactor(modules): extract castopod parts into a modules/ folder for a scalable HMVC structure
- create Admin, Analytics, Auth, Fediverse and Install modules in the root modules/ folder - rename ActivityPub to Fediverse
This commit is contained in:
parent
94872f2338
commit
5083cd2fda
268 changed files with 4221 additions and 2186 deletions
43
modules/Fediverse/Controllers/SchedulerController.php
Normal file
43
modules/Fediverse/Controllers/SchedulerController.php
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
* @link https://castopod.org/
|
||||
*/
|
||||
|
||||
namespace Modules\Fediverse\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 post to delivered
|
||||
model('ActivityModel')
|
||||
->update($scheduledActivity->id, [
|
||||
'task_status' => 'delivered',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue