ILIAS  release_7 Revision v7.30-3-g800a261c036
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
 
 $tree
 
 $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
 

Static Private Attributes

static $container_by_frm_ref_id = []
 

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 67 of file class.ilForumCronNotification.php.

68 {
69 $this->settings = new ilSetting('frma');
70
71 global $DIC;
72 if ($database === null) {
73 $ilDB = $DIC->database();
74 }
75 $this->ilDB = $ilDB;
76
77 if ($notificationCache === null) {
78 $notificationCache = new \ilForumNotificationCache();
79 }
80 $this->notificationCache = $notificationCache;
81 }
ILIAS Setting Class.
global $DIC
Definition: goto.php:24
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 410 of file class.ilForumCronNotification.php.

411 {
412 global $DIC;
413
414 $value = 1;
415 // propagate cron-job setting to object setting
416 if ((bool) $a_currently_active) {
417 $value = 2;
418 }
419 $DIC->settings()->set('forum_notification', $value);
420 }

References $DIC.

◆ addCustomSettingsToForm()

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

Reimplemented from ilCronJob.

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

426 {
427 global $DIC;
428 $lng = $DIC->language();
429
430 $lng->loadLanguageModule('forum');
431
432 $max_notification_age = new ilNumberInputGUI($lng->txt('frm_max_notification_age'), 'max_notification_age');
433 $max_notification_age->setSize(5);
434 $max_notification_age->setSuffix($lng->txt('frm_max_notification_age_unit'));
435 $max_notification_age->setRequired(true);
436 $max_notification_age->allowDecimals(false);
437 $max_notification_age->setMinValue(1);
438 $max_notification_age->setInfo($lng->txt('frm_max_notification_age_info'));
439 $max_notification_age->setValue($this->settings->get('max_notification_age', 30));
440
441 $a_form->addItem($max_notification_age);
442 }
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 372 of file class.ilForumCronNotification.php.

373 {
374 $tmp_provider = new ilForumCronNotificationDataProvider($row, $this->notificationCache);
375
376 self::$providerObject[$row['pos_pk']] = $tmp_provider;
377 self::$providerObject[$row['pos_pk']]->addRecipient($row['user_id']);
378 }

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 393 of file class.ilForumCronNotification.php.

394 {
395 global $DIC;
396 $lng = $DIC->language();
397
398 switch ($a_form_id) {
400 $a_fields['cron_forum_notification'] = $a_is_active ?
401 $lng->txt('enabled') :
402 $lng->txt('disabled');
403 break;
404 }
405 }

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

◆ createForumPostSql()

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

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

627 : string
628 {
629 return '
630 SELECT frm_threads.thr_subject thr_subject,
631 frm_data.top_name top_name,
632 frm_data.top_frm_fk obj_id,
633 frm_notification.user_id user_id,
634 frm_threads.thr_pk thread_id,
635 frm_posts.*
636 FROM frm_notification, frm_posts, frm_threads, frm_data, frm_posts_tree
637 WHERE frm_posts.pos_thr_fk = frm_threads.thr_pk AND ' . $condition . '
638 AND ((frm_threads.thr_top_fk = frm_data.top_pk AND frm_data.top_frm_fk = frm_notification.frm_id)
639 OR (frm_threads.thr_pk = frm_notification.thread_id
640 AND frm_data.top_pk = frm_threads.thr_top_fk) )
641 AND frm_posts.pos_display_user_id != frm_notification.user_id
642 AND frm_posts_tree.pos_fk = frm_posts.pos_pk AND frm_posts_tree.parent_pos != 0
643 ORDER BY frm_posts.pos_date ASC';
644 }

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

+ Here is the caller graph for this function:

◆ createSelectOfDeletionNotificationsSql()

ilForumCronNotification::createSelectOfDeletionNotificationsSql ( )
private
Returns
string

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

649 : string
650 {
651 return '
652 SELECT frm_posts_deleted.thread_title thr_subject,
653 frm_posts_deleted.forum_title top_name,
654 frm_posts_deleted.obj_id obj_id,
655 frm_notification.user_id user_id,
656 frm_posts_deleted.pos_display_user_id,
657 frm_posts_deleted.pos_usr_alias,
658 frm_posts_deleted.deleted_id,
659 frm_posts_deleted.post_date pos_date,
660 frm_posts_deleted.post_title pos_subject,
661 frm_posts_deleted.post_message pos_message,
662 frm_posts_deleted.deleted_by
663
664 FROM frm_notification, frm_posts_deleted
665
666 WHERE ( frm_posts_deleted.obj_id = frm_notification.frm_id
667 OR frm_posts_deleted.thread_id = frm_notification.thread_id)
668 AND frm_posts_deleted.pos_display_user_id != frm_notification.user_id
669 AND frm_posts_deleted.is_thread_deleted = %s
670 ORDER BY frm_posts_deleted.post_date ASC';
671 }

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 361 of file class.ilForumCronNotification.php.

362 {
363 if (isset(self::$providerObject[$post_id])) {
364 return true;
365 }
366 return false;
367 }

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 102 of file class.ilForumCronNotification.php.

103 {
105 }
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 107 of file class.ilForumCronNotification.php.

108 {
109 return 1;
110 }

◆ getDescription()

ilForumCronNotification::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

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

96 {
97 global $DIC;
98
99 return $DIC->language()->txt("cron_forum_notification_crob_desc");
100 }

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 223 of file class.ilForumCronNotification.php.

224 {
225 global $DIC;
226 $ilAccess = $DIC->access();
227
228 if (!array_key_exists($a_user_id, self::$accessible_ref_ids_by_user)) {
229 self::$accessible_ref_ids_by_user[$a_user_id] = array();
230 }
231
232 if (!array_key_exists($a_obj_id, self::$accessible_ref_ids_by_user[$a_user_id])) {
233 $accessible_ref_id = 0;
234 foreach ($this->getRefIdsByObjId($a_obj_id) as $ref_id) {
235 if ($ilAccess->checkAccessOfUser($a_user_id, 'read', '', $ref_id)) {
236 $accessible_ref_id = $ref_id;
237 break;
238 }
239 }
240 self::$accessible_ref_ids_by_user[$a_user_id][$a_obj_id] = $accessible_ref_id;
241 }
242
243 return (int) self::$accessible_ref_ids_by_user[$a_user_id][$a_obj_id];
244 }

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 83 of file class.ilForumCronNotification.php.

84 {
85 return "frm_notification";
86 }

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 209 of file class.ilForumCronNotification.php.

210 {
211 if (!array_key_exists($a_obj_id, self::$ref_ids_by_obj_id)) {
212 self::$ref_ids_by_obj_id[$a_obj_id] = ilObject::_getAllReferences($a_obj_id);
213 }
214
215 return (array) self::$ref_ids_by_obj_id[$a_obj_id];
216 }
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 88 of file class.ilForumCronNotification.php.

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

References $DIC.

◆ hasAutoActivation()

ilForumCronNotification::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

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

113 {
114 return false;
115 }

◆ hasCustomSettings()

ilForumCronNotification::hasCustomSettings ( )
Returns
bool

Reimplemented from ilCronJob.

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

126 {
127 return true;
128 }

◆ hasFlexibleSchedule()

ilForumCronNotification::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

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

118 {
119 return true;
120 }

◆ keepAlive()

ilForumCronNotification::keepAlive ( )

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

134 {
135 $this->logger->debug('Sending ping to cron manager ...');
136 \ilCronManager::ping($this->getId());
137 $this->logger->debug(sprintf('Current memory usage: %s', memory_get_usage(true)));
138 }
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 383 of file class.ilForumCronNotification.php.

384 {
385 self::$providerObject = array();
386 }

Referenced by sendCronForumNotification().

+ Here is the caller graph for this function:

◆ run()

ilForumCronNotification::run ( )
Returns
ilCronJobResult

Reimplemented from ilCronJob.

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

144 {
145 global $DIC;
146
147 $ilSetting = $DIC->settings();
148 $lng = $DIC->language();
149 $this->tree = $DIC->repositoryTree();
150
151 $this->logger = $DIC->logger()->frm();
152
154
155 $lng->loadLanguageModule('forum');
156
157 $this->logger->info('Started forum notification job ...');
158
159 if (!($last_run_datetime = $ilSetting->get('cron_forum_notification_last_date'))) {
160 $last_run_datetime = null;
161 }
162
163 $this->num_sent_messages = 0;
164 $cj_start_date = date('Y-m-d H:i:s');
165
166 if ($last_run_datetime != null &&
167 checkDate(date('m', strtotime($last_run_datetime)), date('d', strtotime($last_run_datetime)), date('Y', strtotime($last_run_datetime)))) {
168 $threshold = max(strtotime($last_run_datetime), strtotime('-' . (int) $this->settings->get('max_notification_age', 30) . ' days', time()));
169 } else {
170 $threshold = strtotime('-' . (int) $this->settings->get('max_notification_age', 30) . ' days', time());
171 }
172
173 $this->logger->info(sprintf('Threshold for forum event determination is: %s', date('Y-m-d H:i:s', $threshold)));
174
175 $threshold_date = date('Y-m-d H:i:s', $threshold);
176
177 $this->sendNotificationForNewPosts($threshold_date);
178
179 $this->sendNotificationForUpdatedPosts($threshold_date);
180
181 $this->sendNotificationForCensoredPosts($threshold_date);
182
183 $this->sendNotificationForUncensoredPosts($threshold_date);
184
186
188
189 $ilSetting->set('cron_forum_notification_last_date', $cj_start_date);
190
191 $mess = 'Sent ' . $this->num_sent_messages . ' messages.';
192
193 $this->logger->info($mess);
194 $this->logger->info('Finished forum notification job');
195
196 $result = new ilCronJobResult();
197 if ($this->num_sent_messages) {
199 $result->setMessage($mess);
200 };
201 $result->setStatus($status);
202 return $result;
203 }
$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 448 of file class.ilForumCronNotification.php.

449 {
450 $this->settings->set('max_notification_age', $a_form->getInput('max_notification_age'));
451 return true;
452 }
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 250 of file class.ilForumCronNotification.php.

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

References $container, $DIC, $i, $ilDB, $res, 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 607 of file class.ilForumCronNotification.php.

608 {
609 $numRows = $this->ilDB->numRows($res);
610 if ($numRows > 0) {
611 $this->logger->info(sprintf('Sending notifications for %s "%s" events ...', $numRows, $actionDescription));
612 $this->sendCronForumNotification($res, $notificationType);
613 if (count(self::$deleted_ids_cache) > 0) {
614 $this->ilDB->manipulate('DELETE FROM frm_posts_deleted WHERE ' . $this->ilDB->in('deleted_id', self::$deleted_ids_cache, false, 'integer'));
615 $this->logger->info('Deleted obsolete entries of table "' . $action . '" ...');
616 }
617 $this->logger->info(sprintf('Sent notifications for %s ...', $actionDescription));
618 }
619
620 $this->keepAlive();
621 }
sendCronForumNotification($res, $notification_type)

References $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 568 of file class.ilForumCronNotification.php.

569 {
570 $res = $this->ilDB->queryF(
572 array('integer'),
573 array(0)
574 );
575
577 $res,
578 'frm_posts_deleted',
579 'deleted postings',
581 );
582 }
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 589 of file class.ilForumCronNotification.php.

590 {
591 $numRows = $this->ilDB->numRows($res);
592 if ($numRows > 0) {
593 $this->logger->info(sprintf('Sending notifications for %s "%s" events ...', $numRows, $actionName));
594 $this->sendCronForumNotification($res, $notificationType);
595 $this->logger->info(sprintf('Sent notifications for %s ...', $actionName));
596 }
597
598 $this->keepAlive();
599 }

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 507 of file class.ilForumCronNotification.php.

508 {
509 $condition = '
510 frm_posts.pos_cens = %s AND frm_posts.pos_status = %s AND
511 (frm_posts.pos_cens_date >= %s AND frm_posts.pos_cens_date > frm_posts.pos_activation_date ) ';
512 $types = array('integer', 'integer', 'timestamp');
513 $values = array(1, 1, $threshold_date);
514
515 $res = $this->ilDB->queryf(
516 $this->createForumPostSql($condition),
517 $types,
518 $values
519 );
520
521 $this->sendNotification(
522 $res,
523 'censored posting',
525 );
526 }
sendNotification(\ilPDOStatement $res, string $actionName, int $notificationType)

References $res, 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 552 of file class.ilForumCronNotification.php.

553 {
554 $res = $this->ilDB->queryF(
556 array('integer'),
557 array(1)
558 );
559
561 $res,
562 'frm_threads_deleted',
563 'deleted threads',
565 );
566 }

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 457 of file class.ilForumCronNotification.php.

458 {
459 $condition = '
460 frm_posts.pos_status = %s AND (
461 (frm_posts.pos_date >= %s AND frm_posts.pos_date = frm_posts.pos_activation_date) OR
462 (frm_posts.pos_activation_date >= %s AND frm_posts.pos_date < frm_posts.pos_activation_date)
463 ) ';
464 $types = array('integer', 'timestamp', 'timestamp');
465 $values = array(1, $threshold_date, $threshold_date);
466
467 $res = $this->ilDB->queryf(
468 $this->createForumPostSql($condition),
469 $types,
470 $values
471 );
472
473 $this->sendNotification(
474 $res,
475 'new posting',
477 );
478 }

References $res, 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 531 of file class.ilForumCronNotification.php.

532 {
533 $condition = '
534 frm_posts.pos_cens = %s AND frm_posts.pos_status = %s AND
535 (frm_posts.pos_cens_date >= %s AND frm_posts.pos_cens_date > frm_posts.pos_activation_date ) ';
536 $types = array('integer', 'integer', 'timestamp');
537 $values = array(0, 1, $threshold_date);
538
539 $res = $this->ilDB->queryf(
540 $this->createForumPostSql($condition),
541 $types,
542 $values
543 );
544
545 $this->sendNotification(
546 $res,
547 'uncensored posting',
549 );
550 }

References $res, 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 483 of file class.ilForumCronNotification.php.

484 {
485 $condition = '
486 frm_posts.pos_cens = %s AND frm_posts.pos_status = %s AND
487 (frm_posts.pos_update > frm_posts.pos_date AND frm_posts.pos_update >= %s) ';
488 $types = array('integer', 'integer', 'timestamp');
489 $values = array(0, 1, $threshold_date);
490
491 $res = $this->ilDB->queryf(
492 $this->createForumPostSql($condition),
493 $types,
494 $values
495 );
496
497 $this->sendNotification(
498 $res,
499 'updated posting',
501 );
502 }

References $res, 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 47 of file class.ilForumCronNotification.php.

◆ $container_by_frm_ref_id

ilForumCronNotification::$container_by_frm_ref_id = []
staticprivate

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

◆ $deleted_ids_cache

ilForumCronNotification::$deleted_ids_cache = array()
staticprotected

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

◆ $ilDB

ilForumCronNotification::$ilDB
private

Definition at line 58 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 61 of file class.ilForumCronNotification.php.

Referenced by __construct().

◆ $num_sent_messages

ilForumCronNotification::$num_sent_messages = 0
protected

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

◆ $providerObject

ilForumCronNotification::$providerObject = array()
static

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

◆ $ref_ids_by_obj_id

ilForumCronNotification::$ref_ids_by_obj_id = array()
staticprotected

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

◆ $settings

ilForumCronNotification::$settings
protected

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

◆ $tree

ilForumCronNotification::$tree
protected

Definition at line 27 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: