Repository navigation
Expand file tree
/
Copy pathcli.php
More file actions
35 lines (30 loc) · 1.46 KB
/
Copy pathcli.php
File metadata and controls
35 lines (30 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
* Registers command-line tasks for the Event Attendance Tracker plugin.
*
* @copyright MighryMCoder
* @see https://github.com/MightyMCoder/EventAttendanceTracker
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2.0 only
*/
use Admidio\Infrastructure\Cli\CliApplication;
use Admidio\Infrastructure\Cli\CliTaskRegistry;
use Admidio\Infrastructure\Plugins\PluginRegistry;
use AdmidioPlugin\EventAttendance\Service\AttendanceAutomationService;
/* This registration file declares metadata only; the callback runs after actor authorization. */
CliTaskRegistry::register(
'event-attendance:close-due-events',
'event-attendance',
static function (array $arguments, array $options): int {
global $gCurrentOrgId, $gDb;
$plugin = PluginRegistry::requireEnabled('event-attendance');
if (($plugin->getSettingValues()['event_attendance_automation_method'] ?? 'disabled') !== 'cli') {
CliApplication::writeSuccess('The system cron automation is not enabled for this organization.', $options);
return CliApplication::EXIT_SUCCESS;
}
(new AttendanceAutomationService($gDb))->runForOrganization((int) $gCurrentOrgId);
CliApplication::writeSuccess('Closed due event-attendance records.', $options);
return CliApplication::EXIT_SUCCESS;
},
'Snapshot expected attendees and mark overdue open attendance records absent.',
'event-attendance:close-due-events'
);