mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Update installer, remove debug
This commit is contained in:
+51
-51
@@ -33,18 +33,18 @@ if (env('DB_SYSTEM') !== 'mysql') {
|
|||||||
try {
|
try {
|
||||||
// HAS to be DB because settings table does not exist yet.
|
// HAS to be DB because settings table does not exist yet.
|
||||||
$pdo = new DB(
|
$pdo = new DB(
|
||||||
[
|
[
|
||||||
'checkVersion' => true,
|
'checkVersion' => true,
|
||||||
'createDb' => true,
|
'createDb' => true,
|
||||||
'dbhost' => env('DB_HOST'),
|
'dbhost' => env('DB_HOST'),
|
||||||
'dbname' => env('DB_NAME'),
|
'dbname' => env('DB_NAME'),
|
||||||
'dbpass' => env('DB_PASSWORD'),
|
'dbpass' => env('DB_PASSWORD'),
|
||||||
'dbport' => env('PORT'),
|
'dbport' => env('PORT'),
|
||||||
'dbsock' => env('DB_SOCKET'),
|
'dbsock' => env('DB_SOCKET'),
|
||||||
'dbtype' => env('DB_SYSTEM'),
|
'dbtype' => env('DB_SYSTEM'),
|
||||||
'dbuser' => env('DB_USER'),
|
'dbuser' => env('DB_USER'),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$dbConnCheck = true;
|
$dbConnCheck = true;
|
||||||
} catch (\PDOException $e) {
|
} catch (\PDOException $e) {
|
||||||
ColorCLI::doEcho(ColorCLI::error('Unable to connect to MySQL server.'));
|
ColorCLI::doEcho(ColorCLI::error('Unable to connect to MySQL server.'));
|
||||||
@@ -52,16 +52,15 @@ if (env('DB_SYSTEM') !== 'mysql') {
|
|||||||
$dbConnCheck = false;
|
$dbConnCheck = false;
|
||||||
} catch (\RuntimeException $e) {
|
} catch (\RuntimeException $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
$error = true;
|
$error = true;
|
||||||
ColorCLI::doEcho(ColorCLI::alternate($e->getMessage()));
|
ColorCLI::doEcho(ColorCLI::alternate($e->getMessage()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
var_dump($e);
|
throw new \RuntimeException($e->getMessage(), $e->getCode(), $e);
|
||||||
throw new \RuntimeException($e->getMessage(), $e->getCode(), $e);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the MySQL version is correct.
|
// Check if the MySQL version is correct.
|
||||||
@@ -77,13 +76,14 @@ if (env('DB_SYSTEM') !== 'mysql') {
|
|||||||
|
|
||||||
if ($goodVersion === false) {
|
if ($goodVersion === false) {
|
||||||
$error = true;
|
$error = true;
|
||||||
ColorCLI::doEcho(ColorCLI::error(
|
ColorCLI::doEcho(
|
||||||
'You are using an unsupported version of '.
|
ColorCLI::error(
|
||||||
env('DB_SYSTEM').
|
'You are using an unsupported version of '.
|
||||||
' the minimum allowed version is '.
|
env('DB_SYSTEM').
|
||||||
NN_MINIMUM_MYSQL_VERSION
|
' the minimum allowed version is '.
|
||||||
)
|
NN_MINIMUM_MYSQL_VERSION
|
||||||
);
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,15 +91,15 @@ if (env('DB_SYSTEM') !== 'mysql') {
|
|||||||
// Start inserting data into the DB.
|
// Start inserting data into the DB.
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
$DbSetup = new DbUpdate(
|
$DbSetup = new DbUpdate(
|
||||||
[
|
[
|
||||||
'backup' => false,
|
'backup' => false,
|
||||||
'db' => $pdo,
|
'db' => $pdo,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$DbSetup->processSQLFile(); // Setup default schema
|
$DbSetup->processSQLFile(); // Setup default schema
|
||||||
$DbSetup->loadTables(); // Load default data files
|
$DbSetup->loadTables(); // Load default data files
|
||||||
} catch (\PDOException $err) {
|
} catch (\PDOException $err) {
|
||||||
$error = true;
|
$error = true;
|
||||||
ColorCLI::doEcho(ColorCLI::error('Error inserting: ('.$err->getMessage().')'));
|
ColorCLI::doEcho(ColorCLI::error('Error inserting: ('.$err->getMessage().')'));
|
||||||
@@ -127,8 +127,8 @@ if (! $error) {
|
|||||||
$updateSettings = false;
|
$updateSettings = false;
|
||||||
if ($patch > 0) {
|
if ($patch > 0) {
|
||||||
$updateSettings = $pdo->exec(
|
$updateSettings = $pdo->exec(
|
||||||
"UPDATE settings SET value = '$patch' WHERE section = '' AND subsection = '' AND name = 'sqlpatch'"
|
"UPDATE settings SET value = '$patch' WHERE section = '' AND subsection = '' AND name = 'sqlpatch'"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// If it all worked, continue the install process.
|
// If it all worked, continue the install process.
|
||||||
if ($updateSettings) {
|
if ($updateSettings) {
|
||||||
@@ -151,20 +151,20 @@ if (env('ADMIN_USER') === '' || env('ADMIN_PASS') === '' || env('ADMIN_EMAIL') =
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$capsule = new Capsule;
|
$capsule = new Capsule;
|
||||||
// Same as database configuration file of Laravel.
|
// Same as database configuration file of Laravel.
|
||||||
$capsule->addConnection([
|
$capsule->addConnection([
|
||||||
'driver' => env('DB_SYSTEM'),
|
'driver' => env('DB_SYSTEM'),
|
||||||
'host' => env('DB_HOST', '127.0.0.1'),
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
'port' => env('DB_PORT', '3306'),
|
'port' => env('DB_PORT', '3306'),
|
||||||
'database' => env('DB_NAME', 'nntmux'),
|
'database' => env('DB_NAME', 'nntmux'),
|
||||||
'username' => env('DB_USER', 'root'),
|
'username' => env('DB_USER', 'root'),
|
||||||
'password' => env('DB_PASSWORD', ''),
|
'password' => env('DB_PASSWORD', ''),
|
||||||
'unix_socket' => env('DB_SOCKET', ''),
|
'unix_socket' => env('DB_SOCKET', ''),
|
||||||
'charset' => 'utf8',
|
'charset' => 'utf8',
|
||||||
'collation' => 'utf8_unicode_ci',
|
'collation' => 'utf8_unicode_ci',
|
||||||
'strict' => false,
|
'strict' => false,
|
||||||
]);
|
]);
|
||||||
$capsule->bootEloquent();
|
$capsule->bootEloquent();
|
||||||
|
|
||||||
$user = new Users();
|
$user = new Users();
|
||||||
|
|||||||
Reference in New Issue
Block a user