ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCertificateQueueRepository Class Reference
+ Collaboration diagram for ilCertificateQueueRepository:

Public Member Functions

 __construct (\ilDBInterface $database, ilLogger $logger)
 
 addToQueue (ilCertificateQueueEntry $certificateQueueEntry)
 
 removeFromQueue ($id)
 
 getAllEntriesFromQueue ()
 
 removeFromQueueByUserId (int $user_id)
 

Private Attributes

 $database
 
 $logger
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificateQueueRepository::__construct ( \ilDBInterface  $database,
ilLogger  $logger 
)
Parameters
ilDBInterface$database
ilLogger$logger

Definition at line 23 of file class.ilCertificateQueueRepository.php.

References $database, and $logger.

Member Function Documentation

◆ addToQueue()

ilCertificateQueueRepository::addToQueue ( ilCertificateQueueEntry  $certificateQueueEntry)
Parameters
ilCertificateQueueEntry$certificateQueueEntry

Definition at line 32 of file class.ilCertificateQueueRepository.php.

References $id, $row, ilCertificateQueueEntry\getAdapterClass(), ilCertificateQueueEntry\getObjId(), ilCertificateQueueEntry\getStartedTimestamp(), ilCertificateQueueEntry\getState(), ilCertificateQueueEntry\getTemplateId(), and ilCertificateQueueEntry\getUserId().

33  {
34  $this->logger->info('START - Add new entry to certificate cron job queue');
35 
36  $id = $this->database->nextId('il_cert_cron_queue');
37 
38  $row = array(
39  'id' => array('integer', $id),
40  'obj_id' => array('integer', $certificateQueueEntry->getObjId()),
41  'usr_id' => array('integer', $certificateQueueEntry->getUserId()),
42  'adapter_class' => array('text', $certificateQueueEntry->getAdapterClass()),
43  'state' => array('text', $certificateQueueEntry->getState()),
44  'started_timestamp' => array('integer', $certificateQueueEntry->getStartedTimestamp()),
45  'template_id' => array('integer', $certificateQueueEntry->getTemplateId()),
46 
47  );
48 
49  $this->logger->debug(sprintf('Save queue entry with following values: %s', json_encode($row, JSON_PRETTY_PRINT)));
50  $this->logger->info(sprintf('END - Added entry to queue'));
51 
52  $this->database->insert('il_cert_cron_queue', $row);
53  }
if(!array_key_exists('StateId', $_REQUEST)) $id
$row
+ Here is the call graph for this function:

◆ getAllEntriesFromQueue()

ilCertificateQueueRepository::getAllEntriesFromQueue ( )
Returns
array

Definition at line 73 of file class.ilCertificateQueueRepository.php.

References $query, $result, and $row.

74  {
75  $this->logger->info('START - Fetch all entries from queue');
76 
77  $sql = 'SELECT * FROM il_cert_cron_queue';
78  $query = $this->database->query($sql);
79 
80  $result = array();
81  while ($row = $this->database->fetchAssoc($query)) {
82  $this->logger->debug(sprintf('Queue entry found: ', json_encode($row, JSON_PRETTY_PRINT)));
83 
85  $row['obj_id'],
86  $row['usr_id'],
87  $row['adapter_class'],
88  $row['state'],
89  $row['template_id'],
90  $row['started_timestamp'],
91  $row['id']
92  );
93  }
94 
95  $this->logger->info(sprintf('END - All queue entries fetched(Total: "%s")', count($result)));
96 
97  return $result;
98  }
$result
$query
$row

◆ removeFromQueue()

ilCertificateQueueRepository::removeFromQueue (   $id)
Parameters
integer$id
Exceptions
ilDatabaseException

Definition at line 59 of file class.ilCertificateQueueRepository.php.

References $id.

60  {
61  $this->logger->info(sprintf('START - Remove entry(id: "%s") from queue', $id));
62 
63  $sql = 'DELETE FROM il_cert_cron_queue WHERE id = ' . $this->database->quote($id, 'integer');
64 
65  $this->database->manipulate($sql);
66 
67  $this->logger->info(sprintf('END - Entry(id: "%s") deleted from queue', $id));
68  }
if(!array_key_exists('StateId', $_REQUEST)) $id

◆ removeFromQueueByUserId()

ilCertificateQueueRepository::removeFromQueueByUserId ( int  $user_id)
Parameters
int$user_id

Definition at line 103 of file class.ilCertificateQueueRepository.php.

104  {
105  $this->logger->info(sprintf('START - Remove entries for user(user_id: "%s") from queue', $user_id));
106 
107  $sql = 'DELETE FROM il_cert_cron_queue WHERE usr_id = ' . $this->database->quote($user_id, 'integer');
108 
109  $this->database->manipulate($sql);
110 
111  $this->logger->info(sprintf('END - Entries for user(user_id: "%s") deleted from queue', $user_id));
112  }

Field Documentation

◆ $database

ilCertificateQueueRepository::$database
private

Definition at line 12 of file class.ilCertificateQueueRepository.php.

Referenced by __construct().

◆ $logger

ilCertificateQueueRepository::$logger
private

Definition at line 17 of file class.ilCertificateQueueRepository.php.

Referenced by __construct().


The documentation for this class was generated from the following file: