function get_directory_list_recursive($path) { $directories = array(); foreach (get_directory_content_list($path) as $filename) { if (is_dir($path . $filename)) { $directory = $path . $filename . '/'; $directories[] = $directory; $directories = array_merge($directories, get_directory_list_recursive($directory)); } } return $directories; }
function check_server_configuration() { // check for DB and PHP time mismatch $dbInfo = db_query_fetch_one('SELECT UNIX_TIMESTAMP() AS timestamp'); $time = time(); $error = abs($time - $dbInfo['timestamp']); if ($error >= 5) { message_inline_red('Database and PHP times are out of sync. This will likely cause problems. DB time: ' . date_time($dbInfo['timestamp']) . ', PHP time: ' . date_time($time) . ' (' . $error . ' seconds off). Maybe you have different time zones set?'); } // check that our writable dirs are writable foreach (get_directory_list_recursive(CONST_PATH_FILE_WRITABLE) as $dir) { if (!is_writable($dir)) { message_inline_red('Directory (' . $dir . ') must be writable by Apache.'); } } if (version_compare(PHP_VERSION, CONST_MIN_REQUIRED_PHP_VERSION, '<')) { message_inline_red('Your version of PHP is too old. You need at least ' . CONST_MIN_REQUIRED_PHP_VERSION . '. You are running: ' . PHP_VERSION); } }