ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilForumCronNotification Class Reference

Forum notifications. More...

+ Inheritance diagram for ilForumCronNotification:
+ Collaboration diagram for ilForumCronNotification:

Public Member Functions

 __construct (\ilDBInterface $database=null, \ilForumNotificationCache $notificationCache=null)
 
 getId ()
 Get id. More...
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 hasCustomSettings ()
 
 keepAlive ()
 
 run ()
 
 sendCronForumNotification ($res, $notification_type)
 
 existsProviderObject ($post_id)
 
 addToExternalSettingsForm ($a_form_id, array &$a_fields, $a_is_active)
 
 activationWasToggled ($a_currently_active)
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 
- Public Member Functions inherited from ilCronJob
 isActive ($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual=false)
 Is job currently active? More...
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule ($a_type, $a_value)
 Update current schedule (if flexible) More...
 
 getAllScheduleTypes ()
 Get all available schedule types. More...
 
 getScheduleTypesWithValues ()
 
 getValidScheduleTypes ()
 Returns a collection of all valid schedule types for a specific job. More...
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. More...
 
 isManuallyExecutable ()
 Defines whether or not a cron job can be started manually. More...
 
 hasCustomSettings ()
 Has cron job any custom setting which can be edited? More...
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 Add custom settings to form. More...
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 Save custom settings. More...
 
 addToExternalSettingsForm ($a_form_id, array &$a_fields, $a_is_active)
 Add external settings to form. More...
 
 activationWasToggled ($a_currently_active)
 Cron job status was changed. More...
 
 getId ()
 Get id. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 run ()
 Run job. More...
 

Data Fields

const KEEP_ALIVE_CHUNK_SIZE = 25
 
- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 
const SCHEDULE_TYPE_IN_HOURS = 3
 
const SCHEDULE_TYPE_IN_DAYS = 4
 
const SCHEDULE_TYPE_WEEKLY = 5
 
const SCHEDULE_TYPE_MONTHLY = 6
 
const SCHEDULE_TYPE_QUARTERLY = 7
 
const SCHEDULE_TYPE_YEARLY = 8
 

Static Public Attributes

static $providerObject = array()
 

Protected Member Functions

 getRefIdsByObjId ($a_obj_id)
 
 getFirstAccessibleRefIdBUserAndObjId ($a_user_id, $a_obj_id)
 
- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)
 

Protected Attributes

 $settings
 
 $logger
 
 $num_sent_messages = 0
 

Static Protected Attributes

static $deleted_ids_cache = array()
 
static $ref_ids_by_obj_id = array()
 
static $accessible_ref_ids_by_user = array()
 

Private Member Functions

 addProviderObject ($row)
 
 resetProviderCache ()
 
 sendNotificationForNewPosts (string $threshold_date)
 
 sendNotificationForUpdatedPosts (string $threshold_date)
 
 sendNotificationForCensoredPosts (string $threshold_date)
 
 sendNotificationForUncensoredPosts (string $threshold_date)
 
 sendNotificationForDeletedThreads ()
 
 sendNotifcationForDeletedPosts ()
 
 sendNotification (\ilPDOStatement $res, string $actionName, int $notificationType)
 
 sendDeleteNotifcations (\ilPDOStatement $res, string $action, string $actionDescription, int $notificationType)
 
 createForumPostSql ($condition)
 
 createSelectOfDeletionNotificationsSql ()
 

Private Attributes

 $ilDB
 
 $notificationCache
 

Detailed Description

Forum notifications.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Nadia Matuschek nmatu.nosp@m.sche.nosp@m.k@dat.nosp@m.abay.nosp@m..de

Definition at line 10 of file class.ilForumCronNotification.php.

Constructor & Destructor Documentation

◆ __construct()

ilForumCronNotification::__construct ( \ilDBInterface  $database = null,
\ilForumNotificationCache  $notificationCache = null 
)
Parameters
ilDBInterface | null$database
ilForumNotificationCache | null$notificationCache

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

60 {
61 $this->settings = new ilSetting('frma');
62
63 if ($database === null) {
64 global $DIC;
65 $ilDB = $DIC->database();
66 }
67 $this->ilDB = $ilDB;
68
69 if ($notificationCache === null) {
70 $notificationCache = new \ilForumNotificationCache();
71 }
72 $this->notificationCache = $notificationCache;
73 }
ILIAS Setting Class.
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2

References $DIC, $ilDB, $notificationCache, and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ activationWasToggled()

ilForumCronNotification::activationWasToggled (   $a_currently_active)
Parameters
bool$a_currently_active

Reimplemented from ilCronJob.

Definition at line 371 of file class.ilForumCronNotification.php.

372 {
373 global $DIC;
374
375 $value = 1;
376 // propagate cron-job setting to object setting
377 if ((bool) $a_currently_active) {
378 $value = 2;
379 }
380 $DIC->settings()->set('forum_notification', $value);
381 }

References $DIC.

◆ addCustomSettingsToForm()

ilForumCronNotification::addCustomSettingsToForm ( ilPropertyFormGUI  $a_form)
Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilCronJob.

Definition at line 386 of file class.ilForumCronNotification.php.

387 {
388 global $DIC;
389 $lng = $DIC->language();
390
391 $lng->loadLanguageModule('forum');
392
393 $max_notification_age = new ilNumberInputGUI($lng->txt('frm_max_notification_age'), 'max_notification_age');
394 $max_notification_age->setSize(5);
395 $max_notification_age->setSuffix($lng->txt('frm_max_notification_age_unit'));
396 $max_notification_age->setRequired(true);
397 $max_notification_age->allowDecimals(false);
398 $max_notification_age->setMinValue(1);
399 $max_notification_age->setInfo($lng->txt('frm_max_notification_age_info'));
400 $max_notification_age->setValue($this->settings->get('max_notification_age', 30));
401
402 $a_form->addItem($max_notification_age);
403 }
This class represents a number property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
$lng

References $DIC, $lng, ilPropertyFormGUI\addItem(), and settings().

+ Here is the call graph for this function:

◆ addProviderObject()

ilForumCronNotification::addProviderObject (   $row)
private
Parameters
$row

Definition at line 333 of file class.ilForumCronNotification.php.

334 {
335 $tmp_provider = new ilForumCronNotificationDataProvider($row, $this->notificationCache);
336
337 self::$providerObject[$row['pos_pk']] = $tmp_provider;
338 self::$providerObject[$row['pos_pk']]->addRecipient($row['user_id']);
339 }
$row

References $row.

Referenced by sendCronForumNotification().

+ Here is the caller graph for this function:

◆ addToExternalSettingsForm()

ilForumCronNotification::addToExternalSettingsForm (   $a_form_id,
array &  $a_fields,
  $a_is_active 
)
Parameters
int$a_form_id
array$a_fields
bool$a_is_active

Reimplemented from ilCronJob.

Definition at line 354 of file class.ilForumCronNotification.php.

355 {
356 global $DIC;
357 $lng = $DIC->language();
358
359 switch ($a_form_id) {
361 $a_fields['cron_forum_notification'] = $a_is_active ?
362 $lng->txt('enabled') :
363 $lng->txt('disabled');
364 break;
365 }
366 }

References $DIC, $lng, and ilAdministrationSettingsFormHandler\FORM_FORUM.

◆ createForumPostSql()

ilForumCronNotification::createForumPostSql (   $condition)
private
Parameters
$condition
Returns
string

Definition at line 588 of file class.ilForumCronNotification.php.

588 : string
589 {
590 return '
591 SELECT frm_threads.thr_subject thr_subject,
592 frm_data.top_name top_name,
593 frm_data.top_frm_fk obj_id,
594 frm_notification.user_id user_id,
595 frm_threads.thr_pk thread_id,
596 frm_posts.*
597 FROM frm_notification, frm_posts, frm_threads, frm_data, frm_posts_tree
598 WHERE frm_posts.pos_thr_fk = frm_threads.thr_pk AND ' . $condition . '
599 AND ((frm_threads.thr_top_fk = frm_data.top_pk AND frm_data.top_frm_fk = frm_notification.frm_id)
600 OR (frm_threads.thr_pk = frm_notification.thread_id
601 AND frm_data.top_pk = frm_threads.thr_top_fk) )
602 AND frm_posts.pos_display_user_id != frm_notification.user_id
603 AND frm_posts_tree.pos_fk = frm_posts.pos_pk AND frm_posts_tree.parent_pos != 0
604 ORDER BY frm_posts.pos_date ASC';
605 }

Referenced by sendNotificationForCensoredPosts(), sendNotificationForNewPosts(), sendNotificationForUncensoredPosts(), and sendNotificationForUpdatedPosts().

+ Here is the caller graph for this function:

◆ createSelectOfDeletionNotificationsSql()

ilForumCronNotification::createSelectOfDeletionNotificationsSql ( )
private
Returns
string

Definition at line 610 of file class.ilForumCronNotification.php.

610 : string
611 {
612 return '
613 SELECT frm_posts_deleted.thread_title thr_subject,
614 frm_posts_deleted.forum_title top_name,
615 frm_posts_deleted.obj_id obj_id,
616 frm_notification.user_id user_id,
617 frm_posts_deleted.pos_display_user_id,
618 frm_posts_deleted.pos_usr_alias,
619 frm_posts_deleted.deleted_id,
620 frm_posts_deleted.post_date pos_date,
621 frm_posts_deleted.post_title pos_subject,
622 frm_posts_deleted.post_message pos_message,
623 frm_posts_deleted.deleted_by
624
625 FROM frm_notification, frm_posts_deleted
626
627 WHERE ( frm_posts_deleted.obj_id = frm_notification.frm_id
628 OR frm_posts_deleted.thread_id = frm_notification.thread_id)
629 AND frm_posts_deleted.pos_display_user_id != frm_notification.user_id
630 AND frm_posts_deleted.is_thread_deleted = %s
631 ORDER BY frm_posts_deleted.post_date ASC';
632 }

Referenced by sendNotifcationForDeletedPosts(), and sendNotificationForDeletedThreads().

+ Here is the caller graph for this function:

◆ existsProviderObject()

ilForumCronNotification::existsProviderObject (   $post_id)
Parameters
$post_id
Returns
bool

Definition at line 322 of file class.ilForumCronNotification.php.

323 {
324 if (isset(self::$providerObject[$post_id])) {
325 return true;
326 }
327 return false;
328 }

Referenced by sendCronForumNotification().

+ Here is the caller graph for this function:

◆ getDefaultScheduleType()

ilForumCronNotification::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

Definition at line 94 of file class.ilForumCronNotification.php.

95 {
97 }
const SCHEDULE_TYPE_IN_HOURS

References ilCronJob\SCHEDULE_TYPE_IN_HOURS.

◆ getDefaultScheduleValue()

ilForumCronNotification::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

Definition at line 99 of file class.ilForumCronNotification.php.

100 {
101 return 1;
102 }

◆ getDescription()

ilForumCronNotification::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

Definition at line 87 of file class.ilForumCronNotification.php.

88 {
89 global $DIC;
90
91 return $DIC->language()->txt("cron_forum_notification_crob_desc");
92 }

References $DIC.

◆ getFirstAccessibleRefIdBUserAndObjId()

ilForumCronNotification::getFirstAccessibleRefIdBUserAndObjId (   $a_user_id,
  $a_obj_id 
)
protected
Parameters
int$a_user_id
int$a_obj_id
Returns
int

Definition at line 214 of file class.ilForumCronNotification.php.

215 {
216 global $DIC;
217 $ilAccess = $DIC->access();
218
219 if (!array_key_exists($a_user_id, self::$accessible_ref_ids_by_user)) {
220 self::$accessible_ref_ids_by_user[$a_user_id] = array();
221 }
222
223 if (!array_key_exists($a_obj_id, self::$accessible_ref_ids_by_user[$a_user_id])) {
224 $accessible_ref_id = 0;
225 foreach ($this->getRefIdsByObjId($a_obj_id) as $ref_id) {
226 if ($ilAccess->checkAccessOfUser($a_user_id, 'read', '', $ref_id)) {
227 $accessible_ref_id = $ref_id;
228 break;
229 }
230 }
231 self::$accessible_ref_ids_by_user[$a_user_id][$a_obj_id] = $accessible_ref_id;
232 }
233
234 return (int) self::$accessible_ref_ids_by_user[$a_user_id][$a_obj_id];
235 }

References $DIC, and getRefIdsByObjId().

Referenced by sendCronForumNotification().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getId()

ilForumCronNotification::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

Definition at line 75 of file class.ilForumCronNotification.php.

76 {
77 return "frm_notification";
78 }

Referenced by keepAlive().

+ Here is the caller graph for this function:

◆ getRefIdsByObjId()

ilForumCronNotification::getRefIdsByObjId (   $a_obj_id)
protected
Parameters
int$a_obj_id
Returns
array

Definition at line 200 of file class.ilForumCronNotification.php.

201 {
202 if (!array_key_exists($a_obj_id, self::$ref_ids_by_obj_id)) {
203 self::$ref_ids_by_obj_id[$a_obj_id] = ilObject::_getAllReferences($a_obj_id);
204 }
205
206 return (array) self::$ref_ids_by_obj_id[$a_obj_id];
207 }
static _getAllReferences($a_id)
get all reference ids of object

References ilObject\_getAllReferences().

Referenced by getFirstAccessibleRefIdBUserAndObjId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilForumCronNotification::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

Definition at line 80 of file class.ilForumCronNotification.php.

81 {
82 global $DIC;
83
84 return $DIC->language()->txt("cron_forum_notification");
85 }

References $DIC.

◆ hasAutoActivation()

ilForumCronNotification::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 104 of file class.ilForumCronNotification.php.

105 {
106 return false;
107 }

◆ hasCustomSettings()

ilForumCronNotification::hasCustomSettings ( )
Returns
bool

Reimplemented from ilCronJob.

Definition at line 117 of file class.ilForumCronNotification.php.

118 {
119 return true;
120 }

◆ hasFlexibleSchedule()

ilForumCronNotification::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 109 of file class.ilForumCronNotification.php.

110 {
111 return true;
112 }

◆ keepAlive()

ilForumCronNotification::keepAlive ( )

Definition at line 125 of file class.ilForumCronNotification.php.

126 {
127 $this->logger->debug('Sending ping to cron manager ...');
128 \ilCronManager::ping($this->getId());
129 $this->logger->debug(sprintf('Current memory usage: %s', memory_get_usage(true)));
130 }
static ping($a_job_id)
Keep cron job alive.

References getId(), and ilCronManager\ping().

Referenced by sendCronForumNotification(), sendDeleteNotifcations(), and sendNotification().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetProviderCache()

ilForumCronNotification::resetProviderCache ( )
private

Definition at line 344 of file class.ilForumCronNotification.php.

345 {
346 self::$providerObject = array();
347 }

Referenced by sendCronForumNotification().

+ Here is the caller graph for this function:

◆ run()

ilForumCronNotification::run ( )
Returns
ilCronJobResult

Reimplemented from ilCronJob.

Definition at line 135 of file class.ilForumCronNotification.php.

136 {
137 global $DIC;
138
139 $ilSetting = $DIC->settings();
140 $lng = $DIC->language();
141
142 $this->logger = $DIC->logger()->frm();
143
145
146 $lng->loadLanguageModule('forum');
147
148 $this->logger->info('Started forum notification job ...');
149
150 if (!($last_run_datetime = $ilSetting->get('cron_forum_notification_last_date'))) {
151 $last_run_datetime = null;
152 }
153
154 $this->num_sent_messages = 0;
155 $cj_start_date = date('Y-m-d H:i:s');
156
157 if ($last_run_datetime != null &&
158 checkDate(date('m', strtotime($last_run_datetime)), date('d', strtotime($last_run_datetime)), date('Y', strtotime($last_run_datetime)))) {
159 $threshold = max(strtotime($last_run_datetime), strtotime('-' . (int) $this->settings->get('max_notification_age', 30) . ' days', time()));
160 } else {
161 $threshold = strtotime('-' . (int) $this->settings->get('max_notification_age', 30) . ' days', time());
162 }
163
164 $this->logger->info(sprintf('Threshold for forum event determination is: %s', date('Y-m-d H:i:s', $threshold)));
165
166 $threshold_date = date('Y-m-d H:i:s', $threshold);
167
168 $this->sendNotificationForNewPosts($threshold_date);
169
170 $this->sendNotificationForUpdatedPosts($threshold_date);
171
172 $this->sendNotificationForCensoredPosts($threshold_date);
173
174 $this->sendNotificationForUncensoredPosts($threshold_date);
175
177
179
180 $ilSetting->set('cron_forum_notification_last_date', $cj_start_date);
181
182 $mess = 'Sent ' . $this->num_sent_messages . ' messages.';
183
184 $this->logger->info($mess);
185 $this->logger->info('Finished forum notification job');
186
187 $result = new ilCronJobResult();
188 if ($this->num_sent_messages) {
190 $result->setMessage($mess);
191 };
192 $result->setStatus($status);
193 return $result;
194 }
$result
Cron job result data container.
sendNotificationForUncensoredPosts(string $threshold_date)
sendNotificationForUpdatedPosts(string $threshold_date)
sendNotificationForCensoredPosts(string $threshold_date)
sendNotificationForNewPosts(string $threshold_date)
global $ilSetting
Definition: privfeed.php:17

References $DIC, $ilSetting, $lng, $result, sendNotifcationForDeletedPosts(), sendNotificationForCensoredPosts(), sendNotificationForDeletedThreads(), sendNotificationForNewPosts(), sendNotificationForUncensoredPosts(), sendNotificationForUpdatedPosts(), settings(), ilCronJobResult\STATUS_NO_ACTION, and ilCronJobResult\STATUS_OK.

+ Here is the call graph for this function:

◆ saveCustomSettings()

ilForumCronNotification::saveCustomSettings ( ilPropertyFormGUI  $a_form)
Parameters
ilPropertyFormGUI$a_form
Returns
bool

Reimplemented from ilCronJob.

Definition at line 409 of file class.ilForumCronNotification.php.

410 {
411 $this->settings->set('max_notification_age', $a_form->getInput('max_notification_age'));
412 return true;
413 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References ilPropertyFormGUI\getInput(), and settings().

+ Here is the call graph for this function:

◆ sendCronForumNotification()

ilForumCronNotification::sendCronForumNotification (   $res,
  $notification_type 
)
Parameters
$res
$notification_type

Definition at line 241 of file class.ilForumCronNotification.php.

242 {
243 global $DIC;
244 $ilDB = $DIC->database();
245
246 while ($row = $ilDB->fetchAssoc($res)) {
247 if ($notification_type == ilForumMailNotification::TYPE_POST_DELETED
248 || $notification_type == ilForumMailNotification::TYPE_THREAD_DELETED) {
249 // important! save the deleted_id to cache before proceeding getFirstAccessibleRefIdBUserAndObjId !
250 self::$deleted_ids_cache[$row['deleted_id']] = $row['deleted_id'];
251 }
252
253 $ref_id = $this->getFirstAccessibleRefIdBUserAndObjId($row['user_id'], $row['obj_id']);
254 if ($ref_id < 1) {
255 $this->logger->debug(sprintf(
256 'The recipient with id %s has no "read" permission for object with id %s',
257 $row['user_id'],
258 $row['obj_id']
259 ));
260 continue;
261 }
262
263 $row['ref_id'] = $ref_id;
264
265 if ($this->existsProviderObject($row['pos_pk'])) {
266 self::$providerObject[$row['pos_pk']]->addRecipient($row['user_id']);
267 } else {
268 $this->addProviderObject($row);
269 }
270 }
271
272 $usrIdsToPreload = array();
273 foreach (self::$providerObject as $provider) {
274 if ($provider->getPosAuthorId()) {
275 $usrIdsToPreload[$provider->getPosAuthorId()] = $provider->getPosAuthorId();
276 }
277 if ($provider->getPosDisplayUserId()) {
278 $usrIdsToPreload[$provider->getPosDisplayUserId()] = $provider->getPosDisplayUserId();
279 }
280 if ($provider->getPostUpdateUserId()) {
281 $usrIdsToPreload[$provider->getPostUpdateUserId()] = $provider->getPostUpdateUserId();
282 }
283 }
284
285 ilForumAuthorInformationCache::preloadUserObjects(array_unique($usrIdsToPreload));
286
287 $i = 0;
288 foreach (self::$providerObject as $provider) {
289 if ($i > 0 && ($i % self::KEEP_ALIVE_CHUNK_SIZE) == 0) {
290 $this->keepAlive();
291 }
292
293 $recipients = array_unique($provider->getCronRecipients());
294
295 $this->logger->info(sprintf(
296 'Trying to send forum notifications for posting id "%s", type "%s" and recipients: %s',
297 $provider->getPostId(),
298 $notification_type,
299 implode(', ', $recipients)
300 ));
301
302 $mailNotification = new ilForumMailNotification($provider, $this->logger);
303 $mailNotification->setIsCronjob(true);
304 $mailNotification->setType($notification_type);
305 $mailNotification->setRecipients($recipients);
306
307 $mailNotification->send();
308
309 $this->num_sent_messages += count($provider->getCronRecipients());
310 $this->logger->info(sprintf("Sent notifications ... "));
311
312 ++$i;
313 }
314
315 $this->resetProviderCache();
316 }
getFirstAccessibleRefIdBUserAndObjId($a_user_id, $a_obj_id)
$i
Definition: disco.tpl.php:19
foreach($_POST as $key=> $value) $res

References $DIC, $i, $ilDB, PHPMailer\PHPMailer\$provider, $res, $row, addProviderObject(), existsProviderObject(), getFirstAccessibleRefIdBUserAndObjId(), keepAlive(), ilForumAuthorInformationCache\preloadUserObjects(), resetProviderCache(), ilForumMailNotification\TYPE_POST_DELETED, and ilForumMailNotification\TYPE_THREAD_DELETED.

Referenced by sendDeleteNotifcations(), and sendNotification().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendDeleteNotifcations()

ilForumCronNotification::sendDeleteNotifcations ( \ilPDOStatement  $res,
string  $action,
string  $actionDescription,
int  $notificationType 
)
private
Parameters
$res
$action
$actionDescription
$notificationType

Definition at line 568 of file class.ilForumCronNotification.php.

569 {
570 $numRows = $this->ilDB->numRows($res);
571 if ($numRows > 0) {
572 $this->logger->info(sprintf('Sending notifications for %s "%s" events ...', $numRows, $actionDescription));
573 $this->sendCronForumNotification($res, $notificationType);
574 if (count(self::$deleted_ids_cache) > 0) {
575 $this->ilDB->manipulate('DELETE FROM frm_posts_deleted WHERE ' . $this->ilDB->in('deleted_id', self::$deleted_ids_cache, false, 'integer'));
576 $this->logger->info('Deleted obsolete entries of table "' . $action . '" ...');
577 }
578 $this->logger->info(sprintf('Sent notifications for %s ...', $actionDescription));
579 }
580
581 $this->keepAlive();
582 }
sendCronForumNotification($res, $notification_type)
$action

References $action, $res, keepAlive(), and sendCronForumNotification().

Referenced by sendNotifcationForDeletedPosts(), and sendNotificationForDeletedThreads().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendNotifcationForDeletedPosts()

ilForumCronNotification::sendNotifcationForDeletedPosts ( )
private

Definition at line 529 of file class.ilForumCronNotification.php.

530 {
531 $res = $this->ilDB->queryF(
533 array('integer'),
534 array(0)
535 );
536
538 $res,
539 'frm_posts_deleted',
540 'deleted postings',
542 );
543 }
sendDeleteNotifcations(\ilPDOStatement $res, string $action, string $actionDescription, int $notificationType)

References $res, createSelectOfDeletionNotificationsSql(), sendDeleteNotifcations(), and ilForumMailNotification\TYPE_POST_DELETED.

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendNotification()

ilForumCronNotification::sendNotification ( \ilPDOStatement  $res,
string  $actionName,
int  $notificationType 
)
private
Parameters
$res
$actionName
$notificationType

Definition at line 550 of file class.ilForumCronNotification.php.

551 {
552 $numRows = $this->ilDB->numRows($res);
553 if ($numRows > 0) {
554 $this->logger->info(sprintf('Sending notifications for %s "%s" events ...', $numRows, $actionName));
555 $this->sendCronForumNotification($res, $notificationType);
556 $this->logger->info(sprintf('Sent notifications for %s ...', $actionName));
557 }
558
559 $this->keepAlive();
560 }

References $res, keepAlive(), and sendCronForumNotification().

Referenced by sendNotificationForCensoredPosts(), sendNotificationForNewPosts(), sendNotificationForUncensoredPosts(), and sendNotificationForUpdatedPosts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendNotificationForCensoredPosts()

ilForumCronNotification::sendNotificationForCensoredPosts ( string  $threshold_date)
private
Parameters
$threshold_date

Definition at line 468 of file class.ilForumCronNotification.php.

469 {
470 $condition = '
471 frm_posts.pos_cens = %s AND frm_posts.pos_status = %s AND
472 (frm_posts.pos_cens_date >= %s AND frm_posts.pos_cens_date > frm_posts.pos_activation_date ) ';
473 $types = array('integer', 'integer', 'timestamp');
474 $values = array(1, 1, $threshold_date);
475
476 $res = $this->ilDB->queryf(
477 $this->createForumPostSql($condition),
478 $types,
479 $values
480 );
481
482 $this->sendNotification(
483 $res,
484 'censored posting',
486 );
487 }
sendNotification(\ilPDOStatement $res, string $actionName, int $notificationType)
$values

References $res, $values, createForumPostSql(), sendNotification(), and ilForumMailNotification\TYPE_POST_CENSORED.

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendNotificationForDeletedThreads()

ilForumCronNotification::sendNotificationForDeletedThreads ( )
private

Definition at line 513 of file class.ilForumCronNotification.php.

514 {
515 $res = $this->ilDB->queryF(
517 array('integer'),
518 array(1)
519 );
520
522 $res,
523 'frm_threads_deleted',
524 'deleted threads',
526 );
527 }

References $res, createSelectOfDeletionNotificationsSql(), sendDeleteNotifcations(), and ilForumMailNotification\TYPE_THREAD_DELETED.

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendNotificationForNewPosts()

ilForumCronNotification::sendNotificationForNewPosts ( string  $threshold_date)
private
Parameters
$threshold_date

Definition at line 418 of file class.ilForumCronNotification.php.

419 {
420 $condition = '
421 frm_posts.pos_status = %s AND (
422 (frm_posts.pos_date >= %s AND frm_posts.pos_date = frm_posts.pos_activation_date) OR
423 (frm_posts.pos_activation_date >= %s AND frm_posts.pos_date < frm_posts.pos_activation_date)
424 ) ';
425 $types = array('integer', 'timestamp', 'timestamp');
426 $values = array(1, $threshold_date, $threshold_date);
427
428 $res = $this->ilDB->queryf(
429 $this->createForumPostSql($condition),
430 $types,
431 $values
432 );
433
434 $this->sendNotification(
435 $res,
436 'new posting',
438 );
439 }

References $res, $values, createForumPostSql(), sendNotification(), and ilForumMailNotification\TYPE_POST_NEW.

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendNotificationForUncensoredPosts()

ilForumCronNotification::sendNotificationForUncensoredPosts ( string  $threshold_date)
private
Parameters
$threshold_date

Definition at line 492 of file class.ilForumCronNotification.php.

493 {
494 $condition = '
495 frm_posts.pos_cens = %s AND frm_posts.pos_status = %s AND
496 (frm_posts.pos_cens_date >= %s AND frm_posts.pos_cens_date > frm_posts.pos_activation_date ) ';
497 $types = array('integer', 'integer', 'timestamp');
498 $values = array(0, 1, $threshold_date);
499
500 $res = $this->ilDB->queryf(
501 $this->createForumPostSql($condition),
502 $types,
503 $values
504 );
505
506 $this->sendNotification(
507 $res,
508 'uncensored posting',
510 );
511 }

References $res, $values, createForumPostSql(), sendNotification(), and ilForumMailNotification\TYPE_POST_UNCENSORED.

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendNotificationForUpdatedPosts()

ilForumCronNotification::sendNotificationForUpdatedPosts ( string  $threshold_date)
private
Parameters
$threshold_date

Definition at line 444 of file class.ilForumCronNotification.php.

445 {
446 $condition = '
447 frm_posts.pos_cens = %s AND frm_posts.pos_status = %s AND
448 (frm_posts.pos_update > frm_posts.pos_date AND frm_posts.pos_update >= %s) ';
449 $types = array('integer', 'integer', 'timestamp');
450 $values = array(0, 1, $threshold_date);
451
452 $res = $this->ilDB->queryf(
453 $this->createForumPostSql($condition),
454 $types,
455 $values
456 );
457
458 $this->sendNotification(
459 $res,
460 'updated posting',
462 );
463 }

References $res, $values, createForumPostSql(), sendNotification(), and ilForumMailNotification\TYPE_POST_UPDATED.

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $accessible_ref_ids_by_user

ilForumCronNotification::$accessible_ref_ids_by_user = array()
staticprotected

Definition at line 42 of file class.ilForumCronNotification.php.

◆ $deleted_ids_cache

ilForumCronNotification::$deleted_ids_cache = array()
staticprotected

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

◆ $ilDB

ilForumCronNotification::$ilDB
private

Definition at line 50 of file class.ilForumCronNotification.php.

Referenced by __construct(), and sendCronForumNotification().

◆ $logger

ilForumCronNotification::$logger
protected

Definition at line 22 of file class.ilForumCronNotification.php.

◆ $notificationCache

ilForumCronNotification::$notificationCache
private

Definition at line 53 of file class.ilForumCronNotification.php.

Referenced by __construct().

◆ $num_sent_messages

ilForumCronNotification::$num_sent_messages = 0
protected

Definition at line 47 of file class.ilForumCronNotification.php.

◆ $providerObject

ilForumCronNotification::$providerObject = array()
static

Definition at line 27 of file class.ilForumCronNotification.php.

◆ $ref_ids_by_obj_id

ilForumCronNotification::$ref_ids_by_obj_id = array()
staticprotected

Definition at line 37 of file class.ilForumCronNotification.php.

◆ $settings

ilForumCronNotification::$settings
protected

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

◆ KEEP_ALIVE_CHUNK_SIZE

const ilForumCronNotification::KEEP_ALIVE_CHUNK_SIZE = 25

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


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