fix installing failed when already installed incompletely
This commit is contained in:
parent
d622e455c7
commit
47b0b17c15
|
|
@ -131,21 +131,30 @@ class SetupController extends Controller
|
|||
/**
|
||||
* Check if the given tables exist in current database.
|
||||
*
|
||||
* @param array $tables [description]
|
||||
* @param array $tables
|
||||
* @return bool
|
||||
*/
|
||||
public static function checkTablesExist($tables = [
|
||||
'users', 'closets', 'players', 'textures', 'options'
|
||||
])
|
||||
{
|
||||
foreach ($tables as $table_name) {
|
||||
]) {
|
||||
$totalTables = 0;
|
||||
|
||||
foreach ($tables as $tableName) {
|
||||
// prefix will be added automatically
|
||||
if (!Schema::hasTable($table_name)) {
|
||||
return false;
|
||||
if (Schema::hasTable($tableName)) {
|
||||
$totalTables++;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
if ($totalTables == count($tables)) {
|
||||
return true;
|
||||
} else {
|
||||
// not installed completely
|
||||
foreach (array_merge($tables, ['migrations']) as $tableName) {
|
||||
Schema::dropIfExists($tableName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function checkTextureDirectory()
|
||||
|
|
|
|||
|
|
@ -54,4 +54,4 @@ wizard:
|
|||
|
||||
finish:
|
||||
title: 安装成功!
|
||||
success: Blessing Skin Server 安装完成。您是否还沉浸在愉悦的安装过程中?很遗憾,一切皆已完成! :)
|
||||
text: Blessing Skin Server 安装完成。您是否还沉浸在愉悦的安装过程中?很遗憾,一切皆已完成! :)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user