19 declare(strict_types=1);
32 $this->
logger->debug(
'START - Add new entry to certificate cron job queue');
34 $id = $this->database->nextId(
'il_cert_cron_queue');
37 'id' => [
'integer',
$id],
38 'obj_id' => [
'integer', $certificateQueueEntry->
getObjId()],
39 'usr_id' => [
'integer', $certificateQueueEntry->
getUserId()],
41 'state' => [
'text', $certificateQueueEntry->
getState()],
43 'template_id' => [
'integer', $certificateQueueEntry->
getTemplateId()],
46 $this->
logger->debug(sprintf(
47 'Save queue entry with following values: %s',
48 json_encode($row, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT)
50 $this->
logger->debug(
'END - Added entry to queue');
52 $this->database->insert(
'il_cert_cron_queue', $row);
57 $this->
logger->debug(sprintf(
'START - Remove entry(id: "%s") from queue', $id));
59 $sql =
'DELETE FROM il_cert_cron_queue WHERE id = ' . $this->database->quote($id,
'integer');
61 $this->database->manipulate($sql);
63 $this->
logger->debug(sprintf(
'END - Entry(id: "%s") deleted from queue', $id));
71 $this->
logger->debug(
'START - Fetch all entries from queue');
73 $sql =
'SELECT * FROM il_cert_cron_queue';
74 $query = $this->database->query($sql);
77 while ($row = $this->database->fetchAssoc($query)) {
78 $this->
logger->debug(sprintf(
79 'Queue entry found: "%s"',
80 json_encode($row, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT)
86 $row[
'adapter_class'],
88 (
int) $row[
'template_id'],
89 (
int) $row[
'started_timestamp'],
94 $this->
logger->debug(sprintf(
'END - All queue entries fetched(Total: "%s")', count($result)));
101 $this->
logger->debug(sprintf(
'START - Remove entries for user (usr_id: "%s") from queue', $user_id));
103 $sql =
'DELETE FROM il_cert_cron_queue WHERE usr_id = ' . $this->database->quote($user_id,
'integer');
105 $this->database->manipulate($sql);
107 $this->
logger->debug(sprintf(
'END - Entries for user (usr_id: "%s") deleted from queue', $user_id));
__construct(private readonly ilDBInterface $database, private readonly ilLogger $logger)
removeFromQueueByUserId(int $user_id)
addToQueue(ilCertificateQueueEntry $certificateQueueEntry)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins