<commit_before><?php

$config = SimpleSAML_Configuration::getInstance();
$cronconfig = SimpleSAML_Configuration::getConfig('module_cron.php');

if (!is_null($cronconfig->getValue('key'))) {
	if ($_REQUEST['key'] !== $cronconfig->getValue('key')) {
		SimpleSAML_Logger::error('Cron - Wrong key provided. Cron will not run.');
		exit;
	}
}
if (!is_null($cronconfig->getValue('allowed_tags'))) {
	if (!in_array($_REQUEST['tag'], $cronconfig->getValue('allowed_tags'))) {
		SimpleSAML_Logger::error('Cron - Illegal tag [' . $_REQUEST['tag'] . '].');
		exit;
	}
}


$summary = array(); 
$croninfo = array(
	'summary' => &$summary,
	'tag' => $_REQUEST['tag'],
);
$url = SimpleSAML_Utilities::selfURL();
$time = date(DATE_RFC822);

SimpleSAML_Module::callHooks('cron', $croninfo);

foreach ($summary AS $s) {
	SimpleSAML_Logger::debug('Cron - Summary: ' . $s);
}

if ($cronconfig->getValue('sendemail', TRUE) && count($summary) > 0) {

	$message = '<h1>Cron report</h1><p>Cron ran at ' . $time . '</p>' .
		'<p>URL: <tt>' . $url . '</tt></p>' .
		'<p>Tag: ' . $croninfo['tag'] . "</p>\n\n" .
		'<ul><li>' . join('</li><li>', $summary) . '</li></ul>';

	$toaddress = $config->getString('technicalcontact_email', '<EMAIL>');
	if($toaddress == '<EMAIL>') {
		SimpleSAML_Logger::error('Cron - Could not send email. [technicalcontact_email] not set in config.');
	} else {
		$email = new SimpleSAML_XHTML_EMail($toaddress, 'simpleSAMLphp cron report', '<EMAIL>');
		$email->setBody($message);
		$email->send();
	}
	<commit_msg>cron: Set the From-address to be the technical contact email address.<commit_after><?php

$config = SimpleSAML_Configuration::getInstance();
$cronconfig = SimpleSAML_Configuration::getConfig('module_cron.php');

if (!is_null($cronconfig->getValue('key'))) {
	if ($_REQUEST['key'] !== $cronconfig->getValue('key')) {
		SimpleSAML_Logger::error('Cron - Wrong key provided. Cron will not run.');
		exit;
	}
}
if (!is_null($cronconfig->getValue('allowed_tags'))) {
	if (!in_array($_REQUEST['tag'], $cronconfig->getValue('allowed_tags'))) {
		SimpleSAML_Logger::error('Cron - Illegal tag [' . $_REQUEST['tag'] . '].');
		exit;
	}
}


$summary = array(); 
$croninfo = array(
	'summary' => &$summary,
	'tag' => $_REQUEST['tag'],
);
$url = SimpleSAML_Utilities::selfURL();
$time = date(DATE_RFC822);

SimpleSAML_Module::callHooks('cron', $croninfo);

foreach ($summary AS $s) {
	SimpleSAML_Logger::debug('Cron - Summary: ' . $s);
}

if ($cronconfig->getValue('sendemail', TRUE) && count($summary) > 0) {

	$message = '<h1>Cron report</h1><p>Cron ran at ' . $time . '</p>' .
		'<p>URL: <tt>' . $url . '</tt></p>' .
		'<p>Tag: ' . $croninfo['tag'] . "</p>\n\n" .
		'<ul><li>' . join('</li><li>', $summary) . '</li></ul>';

	$toaddress = $config->getString('technicalcontact_email', '<EMAIL>');
	if($toaddress == '<EMAIL>') {
		SimpleSAML_Logger::error('Cron - Could not send email. [technicalcontact_email] not set in config.');
	} else {
		// Use $toaddress for both TO and FROM
		$email = new SimpleSAML_XHTML_EMail($toaddress, 'SimpleSAMLphp cron report', $toaddress);
		$email->setBody($message);
		$email->send();
	}
	
{'fraction_non_alphanumeric': 0.22921994884910485, 'fraction_numerical': 0.0038363171355498722, 'mean_word_length': 5.220675944333996, 'pattern_counts': {'":': 0, '<': 42, '<?xml version=': 0, '>': 62, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5799367', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1150, 'n_words': 213}