| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 16 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 15 | function delete_weekly_cron_handler($hook, $entity_type, $return_value, $params) { | 
            ||
| 16 | echo "<p>Starting up the cron job for the delete old notification (delete_old_notif plugin)</p>";  | 
            ||
| 17 | 	elgg_load_library('elgg:old_notification:functions'); | 
            ||
| 18 | |||
| 19 | 	$cutoff_timestamp = time() - ( elgg_get_plugin_setting('delete_old_notif_cutoff', 'delete_old_notif', 90) * 24 * 60 * 60 ); | 
            ||
| 20 | echo "initializing guid list";  | 
            ||
| 21 | $err = initialize_list( $cutoff_timestamp );  | 
            ||
| 22 | |||
| 23 | 	if (!$err){ | 
            ||
| 24 | echo "Deleting notifications older than $cutoff_timestamp";  | 
            ||
| 25 | delete_notifications();  | 
            ||
| 26 | echo "done";  | 
            ||
| 27 | }  | 
            ||
| 28 | else  | 
            ||
| 29 | echo "Error, not leader: $err";  | 
            ||
| 30 | }  |