ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
hook_sanitycheck.php
Go to the documentation of this file.
1 <?php
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.
statistics_hook_sanitycheck(&$hookinfo)
Hook to do santity checks.
$hookinfo
Definition: index.php:7