[], 'PHP' => [], 'Apache' => []];
$version = phpversion();
$phpMinVersion = '7.3.0';
if (strnatcmp($version, $phpMinVersion) >= 0) {
$messages['PHP'][] = "PHP v{$version}";
} else {
$messages['PHP'][] = "PHP v{$version}, please upgrade to version {$phpMinVersion} or greater";
}
$extensions = array_map('strtolower', get_loaded_extensions());
//var_dump($extensions);
foreach ($phpExtensions as $value) {
if (in_array($value[0], $extensions)) {
$messages['PHP'][] = $value[0];
} else {
$messages['PHP'][] = [$value[0], 'sudo apt-get install php-' . str_replace('_', '-', $value[0]) . ' -y && sudo /etc/init.d/apache2 restart'];
}
}
if (isset($_SERVER["HTTPS"])) {
$messages['Apache'][] = "HTTPS is enabled";
} else {
$messages['Apache'][] = ["HTTPS is not enabled", 'https://github.com/WWBN/AVideo/wiki/Why-use-HTTPS'];
}
if (function_exists('apache_get_modules')) {
$mods = array_map('strtolower', apache_get_modules());
//var_dump($mods);
foreach ($apacheModules as $value) {
if (in_array($value[0], $mods)) {
$messages['Apache'][] = $value[0];
} else {
$found = false;
foreach ($mods as $value2) {
if (preg_match("/{$value[0]}/", $value2)) {
$found = $value2;
break;
}
}
if ($found) {
$messages['Apache'][] = $found;
} else {
$messages['Apache'][] = [$value[0], @$value[1]];
}
}
}
} else {
foreach ($apacheModules as $value) {
$messages['Apache'][] = [$value[0], 'We could not check your installed modules. We recommend you to use apache as a module NOT as a FPM'];
}
}
foreach ($linuxApps as $value) {
$response = _isAPPInstalled($value[0]);
if (!empty($response)) {
$messages['Server'][] = "{$value[0]} is installed here {$response}";
} else {
$messages['Server'][] = ["{$value[0]} is NOT installed", @$value[1]];
}
}
$videosDir = getVideosDir();
if (is_writable($videosDir)) {
$messages['Server'][] = "{$videosDir} is writable";
} else {
$messages['Server'][] = ["{$videosDir} is NOT writable", 'sudo chmod -R 777 ' . $videosDir];
}
if (is_writable($global['logfile'])) {
$messages['Server'][] = "Log file is writable";
} else {
$messages['Server'][] = ["{$global['logfile']} is NOT writable", 'sudo chmod -R 777 ' . $global['logfile']];
}
$cacheDir = "{$videosDir}cache/";
if (is_writable($cacheDir)) {
$messages['Server'][] = "Cache is writable";
} else {
$messages['Server'][] = ["{$cacheDir} is NOT writable", 'sudo chmod -R 777 ' . $cacheDir];
}
$_50GB = 53687091200;
$df = disk_free_space("/");
if ($df > $_50GB) {
$messages['Server'][] = "You have enough free disk space " . humanFileSize($df);
} else {
$messages['Server'][] = ["Your disk is almost full, you have only " . humanFileSize($df) . ' free'];
}
$dfVideos = disk_free_space($videosDir);
if ($dfVideos > $_50GB) {
$messages['Server'][] = "You have enough free disk space for the videos directory " . humanFileSize($dfVideos);
} else {
$messages['Server'][] = ["Your videos directory is almost full, you have only " . humanFileSize($dfVideos) . ' free'];
}
$verifyURL = "https://search.avideo.com/verify.php";
$verifyURL = addQueryStringParameter($verifyURL, 'url', $global['webSiteRootURL']);
$verifyURL = addQueryStringParameter($verifyURL, 'screenshot', 1);
$result = url_get_contents($verifyURL, '', 5);
if (empty($result)) {
$messages['Server'][] = ["We could not verify your server from outside {$global['webSiteRootURL']}"];
} else {
$verified = json_decode($result);
if (!empty($verified->verified)) {
$messages['Server'][] = "Server Checked from outside:
" . implode('
', $verified->msg);
} else {
$messages['Server'][] = ["Something is wrong: ", implode('
', $verified->msg)];
}
/*
if(!empty($verified->screenshot)){
$messages['Server'][] = "";
}
*
*/
}
?>