-
Notifications
You must be signed in to change notification settings - Fork 2
/
Job.php
29 lines (23 loc) · 1019 Bytes
/
Job.php
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
<?php
/*
* CardDAV Middleware UI
* Written by Massi-X <[email protected]> © 2024
* This file is protected under CC-BY-NC-ND-4.0, please see "LICENSE" file for more information
*/
namespace FreePBX\modules\PhoneMiddleware;
/**
* Helper class to manage background tasks.
* To test job: runuser -l asterisk -c "fwconsole job --run [ID] --quiet". Do not run tests as root or you will get unexpected results
*/
require_once __DIR__ . '/core/core.php';
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;
class Job implements \FreePBX\Job\TaskInterface
{
public static function run(InputInterface $input, OutputInterface $output)
{
if (method_exists(\Core::class, 'run_job'))
\Core::run_job(\FreePBX::create(), $input, $output); //you MUST manage timing yourself (this is called every minute) and you MUST catch any exception to prevent log spamming (except when it is a very serious one!)
return true; //if YOU developer forget about it...
}
}