mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
Update install.php
This commit is contained in:
parent
c2000d788b
commit
2c82373401
1 changed files with 37 additions and 36 deletions
73
install.php
73
install.php
|
@ -16,10 +16,30 @@ if (php_sapi_name() !== 'cli') {
|
||||||
|
|
||||||
// Check if already installed
|
// Check if already installed
|
||||||
if (is_file(BB_ROOT . '.env')) {
|
if (is_file(BB_ROOT . '.env')) {
|
||||||
out('- TorrentPier already installed!', 'error');
|
out('- TorrentPier already installed', 'error');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* System requirements
|
||||||
|
*/
|
||||||
|
define('CHECK_REQUIREMENTS', [
|
||||||
|
'status' => true,
|
||||||
|
'php_min_version' => '8.1.0',
|
||||||
|
'ext_list' => [
|
||||||
|
'json',
|
||||||
|
'curl',
|
||||||
|
'readline',
|
||||||
|
'mysqli',
|
||||||
|
'bcmath',
|
||||||
|
'mbstring',
|
||||||
|
'intl',
|
||||||
|
'xml',
|
||||||
|
'xmlwriter',
|
||||||
|
'zip'
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Colored console output
|
* Colored console output
|
||||||
*
|
*
|
||||||
|
@ -122,45 +142,26 @@ function chmod_r(string $dir, int $dirPermissions, int $filePermissions): void
|
||||||
out("--- TorrentPier Installer ---\n", 'info');
|
out("--- TorrentPier Installer ---\n", 'info');
|
||||||
|
|
||||||
// Checking extensions
|
// Checking extensions
|
||||||
define('CHECK_REQUIREMENTS', [
|
out("- Checking installed extensions...", 'info');
|
||||||
'status' => true,
|
|
||||||
'php_min_version' => '8.1.0',
|
|
||||||
'ext_list' => [
|
|
||||||
'json',
|
|
||||||
'curl',
|
|
||||||
'readline',
|
|
||||||
'mysqli',
|
|
||||||
'bcmath',
|
|
||||||
'mbstring',
|
|
||||||
'intl',
|
|
||||||
'xml',
|
|
||||||
'xmlwriter',
|
|
||||||
'zip'
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (CHECK_REQUIREMENTS['status']) {
|
// [1] Check PHP Version
|
||||||
out("- Checking installed extensions\n", 'info');
|
if (!version_compare(PHP_VERSION, CHECK_REQUIREMENTS['php_min_version'], '>=')) {
|
||||||
|
out("- TorrentPier requires PHP version " . CHECK_REQUIREMENTS['php_min_version'] . "+ Your PHP version " . PHP_VERSION, 'error');
|
||||||
// [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');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [2] Check installed PHP Extensions on server
|
||||||
|
foreach (CHECK_REQUIREMENTS['ext_list'] as $ext) {
|
||||||
|
if (!extension_loaded($ext)) {
|
||||||
|
out("- ext-$ext not installed", 'error');
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
out("- ext-$ext installed!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out("- All extensions are installed!\n", 'success');
|
||||||
|
|
||||||
// Setting permissions
|
// Setting permissions
|
||||||
out('- Setting permissions for folders...', 'info');
|
out("\n- Setting permissions for folders...", 'info');
|
||||||
chmod_r(BB_ROOT . 'data', 0755, 0644);
|
chmod_r(BB_ROOT . 'data', 0755, 0644);
|
||||||
chmod_r(BB_ROOT . 'internal_data', 0755, 0644);
|
chmod_r(BB_ROOT . 'internal_data', 0755, 0644);
|
||||||
chmod_r(BB_ROOT . 'sitemap', 0755, 0644);
|
chmod_r(BB_ROOT . 'sitemap', 0755, 0644);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue