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
5a42ee34c1
commit
893e065822
1 changed files with 19 additions and 19 deletions
38
install.php
38
install.php
|
@ -7,7 +7,7 @@
|
|||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
define('ROOT', __DIR__ . '/');
|
||||
define('BB_ROOT', __DIR__ . '/');
|
||||
|
||||
// Check CLI mode
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
|
@ -15,7 +15,7 @@ if (php_sapi_name() !== 'cli') {
|
|||
}
|
||||
|
||||
// Check if already installed
|
||||
if (is_file(ROOT . '.env')) {
|
||||
if (is_file(BB_ROOT . '.env')) {
|
||||
out('- TorrentPier already installed!', 'error');
|
||||
exit;
|
||||
}
|
||||
|
@ -129,27 +129,27 @@ out("--- TorrentPier Installer ---\n", 'info');
|
|||
|
||||
// Setting permissions
|
||||
out('- Setting permissions for folders...', 'info');
|
||||
chmod_r(ROOT . 'data', 0755, 0644);
|
||||
chmod_r(ROOT . 'internal_data', 0755, 0644);
|
||||
chmod_r(ROOT . 'sitemap', 0755, 0644);
|
||||
chmod_r(BB_ROOT . 'data', 0755, 0644);
|
||||
chmod_r(BB_ROOT . 'internal_data', 0755, 0644);
|
||||
chmod_r(BB_ROOT . 'sitemap', 0755, 0644);
|
||||
out("- Permissions successfully applied!\n", 'success');
|
||||
|
||||
// Check composer installation
|
||||
if (!is_file(ROOT . 'vendor/autoload.php')) {
|
||||
if (!is_file(BB_ROOT . 'vendor/autoload.php')) {
|
||||
out('- Hmm, it seems there are no Composer dependencies', 'info');
|
||||
|
||||
// Downloading composer
|
||||
if (!is_file(ROOT . 'composer.phar')) {
|
||||
if (!is_file(BB_ROOT . 'composer.phar')) {
|
||||
out('- Downloading Composer...', 'info');
|
||||
if (copy('https://getcomposer.org/installer', ROOT . 'composer-setup.php')) {
|
||||
if (copy('https://getcomposer.org/installer', BB_ROOT . 'composer-setup.php')) {
|
||||
out("- Composer successfully downloaded!\n", 'success');
|
||||
runProcess('php ' . ROOT . 'composer-setup.php');
|
||||
runProcess('php ' . BB_ROOT . 'composer-setup.php');
|
||||
} else {
|
||||
out('- Cannot download Composer', 'error');
|
||||
exit;
|
||||
}
|
||||
if (is_file(ROOT . 'composer-setup.php')) {
|
||||
if (unlink(ROOT . 'composer-setup.php')) {
|
||||
if (is_file(BB_ROOT . 'composer-setup.php')) {
|
||||
if (unlink(BB_ROOT . 'composer-setup.php')) {
|
||||
out("- Composer installation file successfully removed!\n", 'success');
|
||||
} else {
|
||||
out('- Cannot remove Composer installation file. Delete it manually', 'warning');
|
||||
|
@ -158,9 +158,9 @@ if (!is_file(ROOT . 'vendor/autoload.php')) {
|
|||
}
|
||||
|
||||
// Installing dependencies
|
||||
if (is_file(ROOT . 'composer.phar')) {
|
||||
if (is_file(BB_ROOT . 'composer.phar')) {
|
||||
out('- Installing dependencies...', 'info');
|
||||
runProcess('php ' . ROOT . 'composer.phar install --no-interaction --no-ansi');
|
||||
runProcess('php ' . BB_ROOT . 'composer.phar install --no-interaction --no-ansi');
|
||||
out("- Completed!\n", 'success');
|
||||
} else {
|
||||
out('- composer.phar not found', 'error');
|
||||
|
@ -169,8 +169,8 @@ if (!is_file(ROOT . 'vendor/autoload.php')) {
|
|||
}
|
||||
|
||||
// Preparing ENV
|
||||
if (is_file(ROOT . '.env.example') && !is_file(ROOT . '.env')) {
|
||||
if (copy(ROOT . '.env.example', ROOT . '.env')) {
|
||||
if (is_file(BB_ROOT . '.env.example') && !is_file(BB_ROOT . '.env')) {
|
||||
if (copy(BB_ROOT . '.env.example', BB_ROOT . '.env')) {
|
||||
out("- Environment file created!\n", 'success');
|
||||
} else {
|
||||
out('- Cannot create environment file', 'error');
|
||||
|
@ -185,10 +185,10 @@ $DB_DATABASE = '';
|
|||
$DB_USERNAME = '';
|
||||
$DB_PASSWORD = '';
|
||||
|
||||
if (is_file(ROOT . '.env')) {
|
||||
if (is_file(BB_ROOT . '.env')) {
|
||||
out("--- Configuring TorrentPier ---", 'info');
|
||||
|
||||
$envContent = file_get_contents(ROOT . '.env');
|
||||
$envContent = file_get_contents(BB_ROOT . '.env');
|
||||
if ($envContent === false) {
|
||||
out('- Cannot open environment file', 'error');
|
||||
exit;
|
||||
|
@ -224,7 +224,7 @@ if (is_file(ROOT . '.env')) {
|
|||
}
|
||||
|
||||
$newEnvContent = implode("\n", $editedLines);
|
||||
if (file_put_contents(ROOT . '.env', $newEnvContent)) {
|
||||
if (file_put_contents(BB_ROOT . '.env', $newEnvContent)) {
|
||||
out("- TorrentPier successfully configured!\n", 'success');
|
||||
} else {
|
||||
out('- Cannot save environment file', 'error');
|
||||
|
@ -267,7 +267,7 @@ if (!empty($DB_HOST) && !empty($DB_DATABASE) && !empty($DB_USERNAME)) {
|
|||
$conn->select_db($DB_DATABASE);
|
||||
|
||||
// Checking SQL dump
|
||||
$dumpPath = ROOT . 'install/sql/mysql.sql';
|
||||
$dumpPath = BB_ROOT . 'install/sql/mysql.sql';
|
||||
if (is_file($dumpPath) && is_readable($dumpPath)) {
|
||||
out('- SQL dump file found and readable!', 'success');
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue