1
0
mirror of https://github.com/torrentpier/torrentpier.git synced 2025-03-12 04:35:42 -07:00

Update install.php

This commit is contained in:
Roman Kelesidis 2024-08-10 19:37:41 +07:00
parent 893e065822
commit c2000d788b

@ -20,12 +20,6 @@ if (is_file(BB_ROOT . '.env')) {
exit;
}
// Check readline extension
if (!extension_loaded('readline')) {
out('- ext-readline not found. Check out PHP instance', 'error');
exit;
}
/**
* Colored console output
*
@ -127,6 +121,44 @@ function chmod_r(string $dir, int $dirPermissions, int $filePermissions): void
// Welcoming message
out("--- TorrentPier Installer ---\n", 'info');
// Checking extensions
define('CHECK_REQUIREMENTS', [
'status' => true,
'php_min_version' => '8.1.0',
'ext_list' => [
'json',
'curl',
'readline',
'mysqli',
'bcmath',
'mbstring',
'intl',
'xml',
'xmlwriter',
'zip'
],
]);
if (CHECK_REQUIREMENTS['status']) {
out("- Checking installed extensions\n", 'info');
// [1] Check PHP Version
if (!\TorrentPier\Helpers\IsHelper::isPHP(CHECK_REQUIREMENTS['php_min_version'])) {
out("- TorrentPier requires PHP version " . CHECK_REQUIREMENTS['php_min_version'] . "+ Your PHP version " . PHP_VERSION, 'error');
}
// [2] Check installed PHP Extensions on server
$data = [];
foreach (CHECK_REQUIREMENTS['ext_list'] as $ext) {
if (!extension_loaded($ext)) {
out("- ext-$ext not installed!", 'error');
exit;
} else {
out("- ext-$ext installed!", 'success');
}
}
}
// Setting permissions
out('- Setting permissions for folders...', 'info');
chmod_r(BB_ROOT . 'data', 0755, 0644);