/** * Main driver for running system check * @since 1.2.4 * @param $registry * @param $mode ('log', 'return') * @return array * * Note: This is English text only. Can be call before database and languges are loaded */ function run_system_check($registry, $mode = 'log') { $mlog = $counts = array(); $mlog[] = check_install_directory($registry); $mlog = array_merge($mlog, check_file_permissions($registry)); $mlog = array_merge($mlog, check_php_configuraion($registry)); $mlog = array_merge($mlog, check_server_configuration($registry)); $counts['error_count'] = $counts['warning_count'] = $counts['notice_count'] = 0; foreach ($mlog as $message) { if ($message['type'] == 'E') { if ($mode == 'log') { //only save errors to the log $error = new AError($message['body']); $error->toLog()->toDebug(); $registry->get('messages')->saveError($message['title'], $message['body']); } $counts['error_count']++; } else { if ($message['type'] == 'W') { if ($mode == 'log') { $registry->get('messages')->saveWarning($message['title'], $message['body']); } $counts['warning_count']++; } else { if ($message['type'] == 'N') { if ($mode == 'log') { $registry->get('messages')->saveNotice($message['title'], $message['body']); } $counts['notice_count']++; } } } } return array($mlog, $counts); }
/** * Main driver for running system check * @since 1.2.4 * @param Registry $registry * @param string $mode ('log', 'return') * @return array * * Note: This is English text only. Can be call before database and languages are loaded */ function run_system_check($registry, $mode = 'log') { $mlog = $counts = array(); //run anyway $mlog[] = check_install_directory(); if (IS_ADMIN === true && (!$registry->get('config')->get('config_system_check') || $registry->get('config')->get('config_system_check') == 1) || IS_ADMIN !== true && (!$registry->get('config')->get('config_system_check') || $registry->get('config')->get('config_system_check') == 2)) { $mlog = array_merge($mlog, check_file_permissions($registry)); $mlog = array_merge($mlog, check_php_configuraion()); $mlog = array_merge($mlog, check_server_configuration($registry)); $mlog = array_merge($mlog, check_order_statuses($registry)); $mlog = array_merge($mlog, check_web_access()); } $counts['error_count'] = $counts['warning_count'] = $counts['notice_count'] = 0; foreach ($mlog as $message) { if ($message['type'] == 'E') { if ($mode == 'log') { //only save errors to the log $error = new AError($message['body']); $error->toLog()->toDebug(); $registry->get('messages')->saveError($message['title'], $message['body']); } $counts['error_count']++; } else { if ($message['type'] == 'W') { if ($mode == 'log') { $registry->get('messages')->saveWarning($message['title'], $message['body']); } $counts['warning_count']++; } else { if ($message['type'] == 'N') { if ($mode == 'log') { $registry->get('messages')->saveNotice($message['title'], $message['body']); } $counts['notice_count']++; } } } } return array($mlog, $counts); }
/** * print table with system checking results * * @param integer &$errCounter pointer to error counter * @param string installationType: useful when this function is used on installer * * @author Martin Havlat **/ function reportCheckingPermissions(&$errCounter, $installationType = 'none') { echo '<h2>Read/write permissions</h2><table class="common" style="width: 100%;">'; echo check_dir_permissions($errCounter); // for $installationType='upgrade' existence of config_db.inc.php is not needed $blockingCheck = $installationType == 'upgrade' ? FALSE : TRUE; if ($installationType == 'new') { echo check_file_permissions($errCounter, $installationType, 'config_db.inc.php', $blockingCheck); } echo '</table>'; }
//print 'BASE = "'.BASE.'"<br>'; //print 'DOCUMENT_ROOT = "'.DOCUMENT_ROOT.'"<br>'; //print 'BASE_RELATIVE = "'.BASE_RELATIVE.'"<br>'; //print 'DIRECTORY_SEPARATOR = "'.DIRECTORY_SEPARATOR.'"<br>'; //exit; /******************************************************************************** * * make some checks * *********************************************************************************/ $messages = check_requirements(); if (count($messages) > 0) { print_messages_without_template('Part-DB', 'Mindestanforderungen von Part-DB nicht erfüllt!', '<font color="red"><strong>•' . implode('<br>•', $messages) . '</strong></font><br><br>' . 'Nähere Informationen gibt es in der <a target="_blank" href="' . BASE_RELATIVE . '/documentation/dokuwiki/doku.php?id=anforderungen">Dokumentation</a>.'); exit; } $messages = check_file_permissions(); if (count($messages) > 0) { $message = '<strong><font color="red">'; foreach ($messages as $msg) { $message .= '•' . $msg . '<br>'; } $message .= '</font></strong><br><br>'; $message .= 'Nähere Informationen zu den Dateirechten gibt es in der <a target="_blank" href="' . BASE_RELATIVE . '/documentation/dokuwiki/doku.php?id=installation">Dokumentation</a>.<br><br>'; $message .= '<form action="" method="post"><input type="submit" value="Seite neu laden"></form>'; print_messages_without_template('Part-DB', 'Anpassung der Rechte von Verzeichnissen und Dateien', $message); exit; // please note: the messages and the "exit;" here are very important, we mustn't continue the script! // the reasen is: if the config.php is not readable, the array $config is now not loaded successfully. } $message = check_if_config_is_valid(); if (is_string($message)) {