/**
  * Checks on the status of the required configuration and auxiliary files
  * and directories.
  *
  * @access  public
  * @param   array $required_files An array of files that should be checked on.
  */
 function checkConfiguration($required_files)
 {
     foreach ($required_files as $file_path => $options) {
         // check if file exists
         if (!file_exists($file_path)) {
             echo "ERROR: File could not be found (path: {$file_path})\n";
             continue;
         }
         // check the owner and group for these files
         list($owner, $group) = Monitor::_getOwnerAndGroup($file_path);
         if (@$options['check_owner'] && $options['owner'] != $owner) {
             echo "ERROR: File owner mismatch (path: {$file_path}; current owner: {$owner}; correct owner: " . $options['owner'] . ")\n";
         }
         if (@$options['check_group'] && $options['group'] != $group) {
             echo "ERROR: File group mismatch (path: {$file_path}; current group: {$group}; correct group: " . $options['group'] . ")\n";
         }
         // check permission bits
         $perm = Monitor::_getOctalPerms($file_path);
         if (@$options['check_permission'] && $options['permission'] != $perm) {
             echo "ERROR: File permission mismatch (path: {$file_path}; current perm: {$perm}; correct perm: " . $options['permission'] . ")\n";
         }
         // check filesize
         if (@$options['check_filesize'] && filesize($file_path) < $options['filesize']) {
             echo "ERROR: File size mismatch (path: {$file_path}; current filesize: " . filesize($file_path) . ")\n";
         }
     }
     $required_directories = array(APP_PATH . 'misc/routed_emails' => array('check_permission' => true, 'permission' => 770), APP_PATH . 'misc/routed_notes' => array('check_permission' => true, 'permission' => 770), APP_PATH . 'setup' => array('check_permission' => true, 'permission' => 100));
     foreach ($required_directories as $dir_path => $options) {
         // check if directory exists
         if (!file_exists($dir_path)) {
             echo "ERROR: Directory could not be found (path: {$dir_path})\n";
             continue;
         }
         // check permission bits
         $perm = Monitor::_getOctalPerms($dir_path);
         if (@$options['check_permission'] && $options['permission'] != $perm) {
             echo "ERROR: Directory permission mismatch (path: {$dir_path}; current perm: {$perm}; correct perm: " . $options['permission'] . ")\n";
         }
     }
 }