Files
meetletacbfree/classes/task/sync_recordings.php
T

62 lines
2.2 KiB
PHP

<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Scheduled task: sync Adobe Connect recordings into Moodle.
*
* @package mod_meetletacbfree
* @copyright 2026 MeetLet <info@meetlet.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_meetletacbfree\task;
use mod_meetletacbfree\api\service;
use mod_meetletacbfree\local\instance;
use mod_meetletacbfree\local\recordings;
defined('MOODLE_INTERNAL') || die();
/**
* Sync recordings for all activity instances.
*/
class sync_recordings extends \core\task\scheduled_task {
public function get_name() {
return get_string('tasksync', 'meetletacbfree');
}
public function execute() {
if (!\mod_meetletacbfree\registration\manager::is_registered()) {
mtrace('MeetLet registration: inactive — skip recording sync.');
return;
}
global $DB;
foreach ($DB->get_records('meetletacbfree') as $activity) {
foreach ($DB->get_records('meetletacbfree_meetings', ['instanceid' => $activity->id]) as $map) {
try {
$inst = instance::get_from_instanceid((int)$activity->id, (int)$map->groupid);
$service = new service();
$service->login_admin();
recordings::sync($inst, $service);
$service->logout();
} catch (\Throwable $e) {
mtrace('MeetLet marketplace sync failed for instance ' . $activity->id . ': ' . $e->getMessage());
}
}
}
}
}