|
@@ -173,7 +173,7 @@ class Install extends Command
|
|
throw new Exception(__('Please input correct website'));
|
|
throw new Exception(__('Please input correct website'));
|
|
}
|
|
}
|
|
|
|
|
|
- $sql = file_get_contents(INSTALL_PATH . 'fastadmin.sql');
|
|
|
|
|
|
+ $sql = file_get_contents(INSTALL_PATH . 'shequ.sql');
|
|
|
|
|
|
$sql = str_replace("`fa_", "`{$mysqlPrefix}", $sql);
|
|
$sql = str_replace("`fa_", "`{$mysqlPrefix}", $sql);
|
|
|
|
|
|
@@ -204,10 +204,10 @@ class Install extends Command
|
|
throw new Exception($e->getMessage());
|
|
throw new Exception($e->getMessage());
|
|
}
|
|
}
|
|
// 后台入口文件
|
|
// 后台入口文件
|
|
- $adminFile = ROOT_PATH . 'public' . DS . 'admin.php';
|
|
|
|
|
|
+// $adminFile = ROOT_PATH . 'public' . DS . 'admin.php';
|
|
|
|
|
|
// 数据库配置文件
|
|
// 数据库配置文件
|
|
- $dbConfigFile = APP_PATH . 'database.php';
|
|
|
|
|
|
+ /*$dbConfigFile = APP_PATH . 'database.php';
|
|
$dbConfigText = @file_get_contents($dbConfigFile);
|
|
$dbConfigText = @file_get_contents($dbConfigFile);
|
|
$callback = function ($matches) use ($mysqlHostname, $mysqlHostport, $mysqlUsername, $mysqlPassword, $mysqlDatabase, $mysqlPrefix) {
|
|
$callback = function ($matches) use ($mysqlHostname, $mysqlHostport, $mysqlUsername, $mysqlPassword, $mysqlDatabase, $mysqlPrefix) {
|
|
$field = "mysql" . ucfirst($matches[1]);
|
|
$field = "mysql" . ucfirst($matches[1]);
|
|
@@ -217,16 +217,16 @@ class Install extends Command
|
|
}
|
|
}
|
|
return "'{$matches[1]}'{$matches[2]}=>{$matches[3]}Env::get('database.{$matches[1]}', '{$replace}'),";
|
|
return "'{$matches[1]}'{$matches[2]}=>{$matches[3]}Env::get('database.{$matches[1]}', '{$replace}'),";
|
|
};
|
|
};
|
|
- $dbConfigText = preg_replace_callback("/'(hostname|database|username|password|hostport|prefix)'(\s+)=>(\s+)Env::get\((.*)\)\,/", $callback, $dbConfigText);
|
|
|
|
|
|
+ $dbConfigText = preg_replace_callback("/'(hostname|database|username|password|hostport|prefix)'(\s+)=>(\s+)Env::get\((.*)\)\,/", $callback, $dbConfigText);*/
|
|
|
|
|
|
// 检测能否成功写入数据库配置
|
|
// 检测能否成功写入数据库配置
|
|
- $result = @file_put_contents($dbConfigFile, $dbConfigText);
|
|
|
|
|
|
+ /*$result = @file_put_contents($dbConfigFile, $dbConfigText);
|
|
if (!$result) {
|
|
if (!$result) {
|
|
throw new Exception(__('The current permissions are insufficient to write the file %s', 'application/database.php'));
|
|
throw new Exception(__('The current permissions are insufficient to write the file %s', 'application/database.php'));
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
// 设置新的Token随机密钥key
|
|
// 设置新的Token随机密钥key
|
|
- $oldTokenKey = config('token.key');
|
|
|
|
|
|
+ /*$oldTokenKey = config('token.key');
|
|
$newTokenKey = \fast\Random::alnum(32);
|
|
$newTokenKey = \fast\Random::alnum(32);
|
|
$coreConfigFile = CONF_PATH . 'config.php';
|
|
$coreConfigFile = CONF_PATH . 'config.php';
|
|
$coreConfigText = @file_get_contents($coreConfigFile);
|
|
$coreConfigText = @file_get_contents($coreConfigFile);
|
|
@@ -237,29 +237,29 @@ class Install extends Command
|
|
throw new Exception(__('The current permissions are insufficient to write the file %s', 'application/config.php'));
|
|
throw new Exception(__('The current permissions are insufficient to write the file %s', 'application/config.php'));
|
|
}
|
|
}
|
|
|
|
|
|
- $avatar = request()->domain() . '/assets/img/avatar.png';
|
|
|
|
|
|
+ $avatar = request()->domain() . '/assets/img/avatar.png';*/
|
|
// 变更默认管理员密码
|
|
// 变更默认管理员密码
|
|
- $adminPassword = $adminPassword ? $adminPassword : Random::alnum(8);
|
|
|
|
|
|
+ /*$adminPassword = $adminPassword ? $adminPassword : Random::alnum(8);
|
|
$adminEmail = $adminEmail ? $adminEmail : "admin@admin.com";
|
|
$adminEmail = $adminEmail ? $adminEmail : "admin@admin.com";
|
|
$newSalt = substr(md5(uniqid(true)), 0, 6);
|
|
$newSalt = substr(md5(uniqid(true)), 0, 6);
|
|
$newPassword = md5(md5($adminPassword) . $newSalt);
|
|
$newPassword = md5(md5($adminPassword) . $newSalt);
|
|
$data = ['username' => $adminUsername, 'email' => $adminEmail, 'avatar' => $avatar, 'password' => $newPassword, 'salt' => $newSalt];
|
|
$data = ['username' => $adminUsername, 'email' => $adminEmail, 'avatar' => $avatar, 'password' => $newPassword, 'salt' => $newSalt];
|
|
- $instance->name('admin')->where('username', 'admin')->update($data);
|
|
|
|
|
|
+ $instance->name('admin')->where('username', 'admin')->update($data);*/
|
|
|
|
|
|
// 变更前台默认用户的密码,随机生成
|
|
// 变更前台默认用户的密码,随机生成
|
|
- $newSalt = substr(md5(uniqid(true)), 0, 6);
|
|
|
|
|
|
+ /*$newSalt = substr(md5(uniqid(true)), 0, 6);
|
|
$newPassword = md5(md5(Random::alnum(8)) . $newSalt);
|
|
$newPassword = md5(md5(Random::alnum(8)) . $newSalt);
|
|
- $instance->name('user')->where('username', 'admin')->update(['avatar' => $avatar, 'password' => $newPassword, 'salt' => $newSalt]);
|
|
|
|
|
|
+ $instance->name('user')->where('username', 'admin')->update(['avatar' => $avatar, 'password' => $newPassword, 'salt' => $newSalt]);*/
|
|
|
|
|
|
// 修改后台入口
|
|
// 修改后台入口
|
|
- $adminName = '';
|
|
|
|
|
|
+ /*$adminName = '';
|
|
if (is_file($adminFile)) {
|
|
if (is_file($adminFile)) {
|
|
$adminName = Random::alpha(10) . '.php';
|
|
$adminName = Random::alpha(10) . '.php';
|
|
rename($adminFile, ROOT_PATH . 'public' . DS . $adminName);
|
|
rename($adminFile, ROOT_PATH . 'public' . DS . $adminName);
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
//修改站点名称
|
|
//修改站点名称
|
|
- if ($siteName != config('site.name')) {
|
|
|
|
|
|
+ /*if ($siteName != config('site.name')) {
|
|
$instance->name('config')->where('name', 'name')->update(['value' => $siteName]);
|
|
$instance->name('config')->where('name', 'name')->update(['value' => $siteName]);
|
|
$siteConfigFile = CONF_PATH . 'extra' . DS . 'site.php';
|
|
$siteConfigFile = CONF_PATH . 'extra' . DS . 'site.php';
|
|
$siteConfig = include $siteConfigFile;
|
|
$siteConfig = include $siteConfigFile;
|
|
@@ -275,23 +275,23 @@ class Install extends Command
|
|
}
|
|
}
|
|
$siteConfig['name'] = $siteName;
|
|
$siteConfig['name'] = $siteName;
|
|
file_put_contents($siteConfigFile, '<?php' . "\n\nreturn " . var_export_short($siteConfig) . ";\n");
|
|
file_put_contents($siteConfigFile, '<?php' . "\n\nreturn " . var_export_short($siteConfig) . ";\n");
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
- $installLockFile = INSTALL_PATH . "install.lock";
|
|
|
|
|
|
+ /*$installLockFile = INSTALL_PATH . "install.lock";
|
|
//检测能否成功写入lock文件
|
|
//检测能否成功写入lock文件
|
|
$result = @file_put_contents($installLockFile, 1);
|
|
$result = @file_put_contents($installLockFile, 1);
|
|
if (!$result) {
|
|
if (!$result) {
|
|
throw new Exception(__('The current permissions are insufficient to write the file %s', 'application/admin/command/Install/install.lock'));
|
|
throw new Exception(__('The current permissions are insufficient to write the file %s', 'application/admin/command/Install/install.lock'));
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
- try {
|
|
|
|
|
|
+ /*try {
|
|
//删除安装脚本
|
|
//删除安装脚本
|
|
@unlink(ROOT_PATH . 'public' . DS . 'install.php');
|
|
@unlink(ROOT_PATH . 'public' . DS . 'install.php');
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
- return $adminName;
|
|
|
|
|
|
+ return 'admin.php';
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|