<commit_before><?php
/**
 * Hook to run a cron job.
 *
 * @param array &$croninfo  Output
 */
function statistics_hook_cron(&$croninfo) {
	assert('is_array($croninfo)');
	assert('array_key_exists("summary", $croninfo)');
	assert('array_key_exists("tag", $croninfo)');

	$config = SimpleSAML_Configuration::getInstance();
	$statconfig = $config->copyFromBase('statconfig', 'module_statistics.php');
	
	if (is_null($statconfig->getValue('cron_tag', NULL))) return;
	if ($statconfig->getValue('cron_tag', NULL) !== $croninfo['tag']) return;
	
	try {
		$aggregator = new sspmod_statistics_Aggregator();
		$results = $aggregator->aggregate();
	} catch (Exception $e) {
		$croninfo['summary'][] = 'Loganalyzer threw exception: ' . $e->getMessage();
	}
}
?><commit_msg>Storing results file in cron hook... forgot this yesterday..<commit_after><?php
/**
 * Hook to run a cron job.
 *
 * @param array &$croninfo  Output
 */
function statistics_hook_cron(&$croninfo) {
	assert('is_array($croninfo)');
	assert('array_key_exists("summary", $croninfo)');
	assert('array_key_exists("tag", $croninfo)');

	$config = SimpleSAML_Configuration::getInstance();
	$statconfig = $config->copyFromBase('statconfig', 'module_statistics.php');
	
	if (is_null($statconfig->getValue('cron_tag', NULL))) return;
	if ($statconfig->getValue('cron_tag', NULL) !== $croninfo['tag']) return;
	
	try {
		$aggregator = new sspmod_statistics_Aggregator();
		$results = $aggregator->aggregate();
		if (empty($results)) {
			$croninfo['summary'][] = 'Output from statistics aggregator was empty.';
		} else {
			$aggregator->store($results);
		}
	} catch (Exception $e) {
		$croninfo['summary'][] = 'Loganalyzer threw exception: ' . $e->getMessage();
	}
}
?>
{'fraction_non_alphanumeric': 0.18895348837209303, 'fraction_numerical': 0.0, 'mean_word_length': 5.995934959349594, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, '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': '5614025', 'n_tokens_mistral': 615, 'n_tokens_neox': 583, 'n_words': 111}