From 11c992d6476b3b264f9febdf3f84f260afb51cb5 Mon Sep 17 00:00:00 2001 From: Anders Lund <anders.lund@uninett.no> Date: Wed, 13 May 2009 08:17:10 +0000 Subject: [PATCH] Hopefully fix timout problem when parsing statistics git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1502 44740490-163a-0410-bde0-09ae8108e29a --- modules/statistics/config-templates/module_statistics.php | 8 ++++++++ modules/statistics/hooks/hook_cron.php | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/modules/statistics/config-templates/module_statistics.php b/modules/statistics/config-templates/module_statistics.php index 7b839148f..e684ccd1a 100644 --- a/modules/statistics/config-templates/module_statistics.php +++ b/modules/statistics/config-templates/module_statistics.php @@ -38,6 +38,14 @@ $config = array ( * 'cron_tag' => NULL, */ 'cron_tag' => 'daily', + + /* + * Set max running time for this script. This is also controlle by max_execution_time in php.ini + * and is defalut set to 30 sec. Your web server can have other timeout configurations that may + * also interrupt PHP execution. Apache has a Timeout directive and IIS has a + * CGI timeout function. Both default to 300 seconds. + */ + 'time_limit' => 300, 'statrules' => array( 'sso_hoursday' => array( diff --git a/modules/statistics/hooks/hook_cron.php b/modules/statistics/hooks/hook_cron.php index 1847682d6..1c4d43adc 100644 --- a/modules/statistics/hooks/hook_cron.php +++ b/modules/statistics/hooks/hook_cron.php @@ -14,6 +14,11 @@ function statistics_hook_cron(&$croninfo) { if (is_null($statconfig->getValue('cron_tag', NULL))) return; if ($statconfig->getValue('cron_tag', NULL) !== $croninfo['tag']) return; + $maxtime = $statconfig->getInteger('time_limit', NULL); + if($maxtime){ + set_time_limit($maxtime); + } + try { $aggregator = new sspmod_statistics_Aggregator(); $results = $aggregator->aggregate(); -- GitLab