Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

send_integrity_failure_notices()

Description

Send notifications about file integrity failures

Parameters

ColumnTypeDefaultDescription
$failures: array get_sysvar'last_integrity_check_notify'
'1970-01-01';
$failures array Array of resources that have failed integrity check

Location

include/message_functions.php lines 1180 to 1220

Definition

 
function send_integrity_failure_notices( array $failures): void
{
    
$last_integrity_check_notify get_sysvar('last_integrity_check_notify''1970-01-01');
    if (
time()-strtotime($last_integrity_check_notify) < 24*60*60) {
        if(
'cli' == PHP_SAPI) {
            echo 
" - Skipping sending of integrity failure notifications - last sent: " $last_integrity_check_notify PHP_EOL;
        }
    } else {
        if(
'cli' == PHP_SAPI) {
            echo 
" - Sending summary messages to administrators" PHP_EOL;
        }

    
# Send notification
    
$message = new ResourceSpaceUserNotification();
    
$message->set_subject("lang_file_integrity_summary");
    
$message->set_text("lang_file_integrity_summary_failed");
    
$message->append_text("<br><br>");
    if (
count($failures) < 1000) {
        
// Show links to the resources that have failed this time.
        // If too many have failed it will still include a link to the general search for all failed resources.
        
$message->append_text("<table class='ListviewStyle'");
        
$n 1;
        foreach (
array_chunk($failures,200) as $arr_failed) {
            
$message->append_text("<tr><td class='SingleLine'><a href='");
            
$message->append_text($GLOBALS["baseurl"] . "/pages/search.php?search=!list" implode(":"$arr_failed));
            
$message->append_text("'>");
            
$message->append_text("lang_file_integrity_fail_search");
            
$message->append_text(" ({$n})");
            
$message->append_text("</a></td></tr>");
            
$n++;
            }
        
$message->append_text("</table>");
    }

    
$message->url $GLOBALS["baseurl"] . "/pages/search.php?search=!integrityfail";

    
$notify_users get_notification_users("SYSTEM_ADMIN");
    
send_user_notification($notify_users,$message);
    
set_sysvar("last_integrity_check_notify",date("Y-m-d H:i:s"));
    }
}

This article was last updated 4th December 2024 09:05 Europe/London time based on the source file dated 27th November 2024 15:30 Europe/London time.