ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
hook_sanitycheck.php File Reference

Go to the source code of this file.

Functions

 statistics_hook_sanitycheck (&$hookinfo)
 Hook to do santity checks. More...
 

Function Documentation

◆ statistics_hook_sanitycheck()

statistics_hook_sanitycheck ( $hookinfo)

Hook to do santity checks.

Parameters
array&$hookinfohookinfo

Definition at line 7 of file hook_sanitycheck.php.

References $hookinfo, $statconfig, and SimpleSAML_Configuration\getConfig().

8 {
9  assert('is_array($hookinfo)');
10  assert('array_key_exists("errors", $hookinfo)');
11  assert('array_key_exists("info", $hookinfo)');
12 
13  try {
14  $statconfig = SimpleSAML_Configuration::getConfig('module_statistics.php');
15  } catch(Exception $e) {
16  $hookinfo['errors'][] = '[statistics] Could not get configuration: ' . $e->getMessage(); return;
17  }
18 
19  $statdir = $statconfig->getValue('statdir');
20  $inputfile = $statconfig->getValue('inputfile');
21 
22  if (file_exists($statdir)) {
23  $hookinfo['info'][] = '[statistics] Statistics dir [' . $statdir . '] exists';
24  if (is_writable($statdir)) {
25  $hookinfo['info'][] = '[statistics] Statistics dir [' . $statdir . '] is writable';
26  } else {
27  $hookinfo['errors'][] = '[statistics] Statistics dir [' . $statdir . '] is not writable';
28  }
29  } else {
30  $hookinfo['errors'][] = '[statistics] Statistics dir [' . $statdir . '] does not exists';
31  }
32 
33  if (file_exists($inputfile)) {
34  $hookinfo['info'][] = '[statistics] Input file [' . $inputfile . '] exists';
35  } else {
36  $hookinfo['errors'][] = '[statistics] Input file [' . $inputfile . '] does not exists';
37  }
38 }
$statconfig
Definition: showstats.php:4
static getConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
$hookinfo
Definition: index.php:7
+ Here is the call graph for this function: