message MDL-24879 added something to cron to remove read notifications

This commit is contained in:
Andrew Davis
2010-10-28 03:59:40 +00:00
parent f087953c9a
commit 212badff4d
3 changed files with 11 additions and 0 deletions
+3
View File
@@ -17,6 +17,9 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$optionalsubsystems->add(new admin_setting_configcheckbox('messaginghidereadnotifications', get_string('messaginghidereadnotifications', 'admin'), get_string('configmessaginghidereadnotifications','admin'), 0));
$options = array(DAYSECS=>get_string('secondstotime86400'), WEEKSECS=>get_string('secondstotime604800'), 2620800=>get_string('nummonths', 'moodle', 1), 15724800=>get_string('nummonths', 'moodle', 6),0=>get_string('never'));
$optionalsubsystems->add(new admin_setting_configselect('messagingdeletereadnotificationsdelay', get_string('messagingdeletereadnotificationsdelay', 'admin'), get_string('configmessagingdeletereadnotificationsdelay', 'admin'), 604800, $options));
$optionalsubsystems->add(new admin_setting_configcheckbox('enablestats', get_string('enablestats', 'admin'), get_string('configenablestats', 'admin'), 0));
$optionalsubsystems->add(new admin_setting_configcheckbox('enablerssfeeds', get_string('enablerssfeeds', 'admin'), get_string('configenablerssfeeds', 'admin'), 0));
+2
View File
@@ -259,6 +259,7 @@ $string['configmemcachedhosts'] = 'For memcached. Comma-separated list of hosts
$string['configmemcachedpconn'] = 'For memcached. Use persistent connections. Use carefully -- it can make Apache/PHP crash after a restart of the memcached daemon.';
$string['configmessaging'] = 'Should the messaging system between site users be enabled?';
$string['configmessaginghidereadnotifications'] = 'Hide read notifications of events like forum posts when viewing messaging history';
$string['configmessagingdeletereadnotificationsdelay'] = 'Read notifications can be deleted to save space. How long after a notification is read can it be deleted?';
$string['configminpassworddigits'] = 'Passwords must have at least these many digits.';
$string['configminpasswordlength'] = 'Passwords must be at least these many characters long.';
$string['configminpasswordlower'] = 'Passwords must have at least these many lower case letters.';
@@ -691,6 +692,7 @@ $string['memcachedhosts'] = 'memcached hosts';
$string['memcachedpconn'] = 'memcached use persistent connections';
$string['messaging'] = 'Enable messaging system';
$string['messaginghidereadnotifications'] = 'Hide read notifications';
$string['messagingdeletereadnotificationsdelay'] = 'Delete read notifications';
$string['minpassworddigits'] = 'Digits';
$string['minpasswordlength'] = 'Password length';
$string['minpasswordlower'] = 'Lowercase letters';
+6
View File
@@ -324,6 +324,12 @@ function cron_run() {
build_context_path();
mtrace ('Built context paths');
if (!empty($CFG->messagingdeletereadnotificationsdelay)) {
$notificationdeletetime = time() - $CFG->messagingdeletereadnotificationsdelay; //604800; //1 week ago
$DB->delete_records_select('message_read', 'notification=1 AND timeread<:notificationdeletetime', array('notificationdeletetime'=>$notificationdeletetime));
mtrace('Cleaned up read notifications');
}
mtrace("Finished clean-up tasks...");
} // End of occasional clean-up tasks