Properly handle error on stop and start daemons

This commit is contained in:
osaajani 2025-07-18 12:02:26 +02:00
parent 1f8cdcd67c
commit 08cbb0f12e
2 changed files with 56 additions and 54 deletions

View file

@ -14,55 +14,55 @@ namespace controllers\internals;
use DateInterval;
use Faker\Factory;
/**
* Class to call the console scripts.
*/
class Console extends \descartes\InternalController
{
/**
* Class to call the console scripts.
* Start launcher daemon.
*/
class Console extends \descartes\InternalController
public function launcher()
{
/**
* Start launcher daemon.
*/
public function launcher()
{
new \daemons\Launcher();
}
new \daemons\Launcher();
}
/**
* Start sender daemon.
*/
public function sender()
{
new \daemons\Sender();
}
/**
* Start sender daemon.
*/
public function sender()
{
new \daemons\Sender();
}
/**
* Start webhook daemon.
*/
public function webhook()
{
new \daemons\Webhook();
}
/**
* Start webhook daemon.
*/
public function webhook()
{
new \daemons\Webhook();
}
/**
* Start mailer daemon.
*/
public function mailer()
{
new \daemons\Mailer();
}
/**
* Start mailer daemon.
*/
public function mailer()
{
new \daemons\Mailer();
}
/**
* Start a phone daemon.
*
* @param $id_phone : Phone id
*/
public function phone($id_phone)
{
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$internal_phone = new \controllers\internals\Phone($bdd);
/**
* Start a phone daemon.
*
* @param $id_phone : Phone id
*/
public function phone($id_phone)
{
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$internal_phone = new \controllers\internals\Phone($bdd);
$phone = $internal_phone->get($id_phone);
if (!$phone)
$phone = $internal_phone->get($id_phone);
if (!$phone)
{
exit(1);
}