mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-18 15:50:50 +08:00
prepare beta12
This commit is contained in:
@@ -27,6 +27,7 @@ class Kernel extends ConsoleKernel
|
||||
$schedule->command('exam:assign_cronjob')->everyMinute();
|
||||
$schedule->command('exam:checkout_cronjob')->everyMinute();
|
||||
$schedule->command('backup:cronjob')->everyMinute();
|
||||
$schedule->command('hr:update_status')->everyMinute();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,10 @@ class HitAndRunRepository extends BaseRepository
|
||||
do_log("H&R mode is disabled.");
|
||||
return false;
|
||||
}
|
||||
if (empty($setting['inspect_time'])) {
|
||||
do_log("H&R inspect_time is not set.");
|
||||
return false;
|
||||
}
|
||||
$query = HitAndRun::query()
|
||||
->where('status', HitAndRun::STATUS_INSPECTING)
|
||||
->where('created_at', '<', Carbon::now()->subHours($setting['inspect_time']))
|
||||
@@ -68,7 +72,6 @@ class HitAndRunRepository extends BaseRepository
|
||||
//check seed time
|
||||
$targetSeedTime = $row->snatch->seedtime;
|
||||
$requireSeedTime = bcmul($setting['seed_time_minimum'], 3600);
|
||||
$locale = $row->user->locale;
|
||||
do_log("targetSeedTime: $targetSeedTime, requireSeedTime: $requireSeedTime");
|
||||
if ($targetSeedTime >= $requireSeedTime) {
|
||||
$result = $this->reachedBySeedTime($row);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.6.0-beta12');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2020-06-15');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2020-06-22');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', true);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
@@ -268,6 +268,7 @@ class Install
|
||||
public function gotoStep($step)
|
||||
{
|
||||
nexus_redirect(getBaseUrl() . "?step=$step");
|
||||
die(0);
|
||||
}
|
||||
|
||||
public function maxStep()
|
||||
@@ -537,4 +538,20 @@ class Install
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function runMigrate()
|
||||
{
|
||||
if (!WITH_LARAVEL) {
|
||||
throw new \RuntimeException('Laravel is not avaliable.');
|
||||
}
|
||||
$command = "php " . ROOT_PATH . "artisan migrate --force";
|
||||
$result = exec($command, $output, $result_code);
|
||||
$this->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
|
||||
$this->doLog("output: " . json_encode($output));
|
||||
if ($result_code != 0) {
|
||||
throw new \RuntimeException(json_encode($output));
|
||||
} else {
|
||||
$this->doLog("[MIGRATE] success.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ use Nexus\Database\NexusDB;
|
||||
class Update extends Install
|
||||
{
|
||||
|
||||
protected $steps = ['环境检测', '选择版本安装', '更新 .env 文件', '更新配置'];
|
||||
protected $steps = ['环境检测', '获取更新', '更新 .env 文件', '执行更新'];
|
||||
|
||||
|
||||
public function getLogFile()
|
||||
|
||||
@@ -124,18 +124,8 @@ if ($currentStep == 4) {
|
||||
while ($isPost) {
|
||||
try {
|
||||
$install->createSymbolicLinks($symbolicLinks);
|
||||
$install->runMigrate();
|
||||
$install->saveSettings($settings);
|
||||
// $install->importInitialData();
|
||||
//use seed
|
||||
$command = "php " . ROOT_PATH . "artisan db:seed";
|
||||
$result = exec($command, $output, $result_code);
|
||||
$install->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
|
||||
$install->doLog("output: " . json_encode($output));
|
||||
if ($result_code != 0) {
|
||||
throw new \RuntimeException(json_encode($output));
|
||||
} else {
|
||||
$install->doLog("[INIT DATA] success.");
|
||||
}
|
||||
$install->nextStep();
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
@@ -27,22 +27,28 @@ if ($currentStep == 2) {
|
||||
$versionTable = $versions = [];
|
||||
$cacheKkey = '__versions_' . date('Ymd_H');
|
||||
try {
|
||||
if (!empty($_SESSION[$cacheKkey])) {
|
||||
$update->doLog("get versions from session.");
|
||||
$versions = $_SESSION[$cacheKkey];
|
||||
} else {
|
||||
$versions = $update->listVersions();
|
||||
}
|
||||
$versions = $update->listVersions();
|
||||
// if (!empty($_SESSION[$cacheKkey])) {
|
||||
// $update->doLog("get versions from session.");
|
||||
// $versions = $_SESSION[$cacheKkey];
|
||||
// } else {
|
||||
// $_SESSION[$cacheKkey] = $versions;
|
||||
// }
|
||||
} catch (\Exception $exception) {
|
||||
$error = $exception->getMessage();
|
||||
}
|
||||
$_SESSION[$cacheKkey] = $versions;
|
||||
$versionHeader = [
|
||||
'checkbox' => '选择',
|
||||
'tag_name' => '版本(标签)',
|
||||
'name' => '名称',
|
||||
'published_at' => '发布时间',
|
||||
];
|
||||
$tableRows[] = [
|
||||
'checkbox' => sprintf('<input type="radio" name="version_url" value="manual"/>'),
|
||||
'tag_name' => '手动更新',
|
||||
'name' => '如若有改动不宜全量覆盖,请勾选此选项并确保已经手动更新了代码',
|
||||
'published_at' => '---',
|
||||
];
|
||||
foreach ($versions as $version) {
|
||||
if ($version['draft']) {
|
||||
continue;
|
||||
@@ -58,11 +64,15 @@ if ($currentStep == 2) {
|
||||
'published_at' => $time->format('Y-m-d H:i:s'),
|
||||
];
|
||||
}
|
||||
// dd($tableRows);
|
||||
while ($isPost) {
|
||||
try {
|
||||
if (empty($_REQUEST['version_url'])) {
|
||||
throw new \RuntimeException("没有选择版本");
|
||||
}
|
||||
if ($_REQUEST['version_url'] == 'manual') {
|
||||
$update->nextStep();
|
||||
}
|
||||
$versionUrlArr = explode('|', $_REQUEST['version_url']);
|
||||
$version = strtolower($versionUrlArr[0]);
|
||||
$downloadUrl = $versionUrlArr[1];
|
||||
@@ -129,6 +139,7 @@ if ($currentStep == 4) {
|
||||
while ($isPost) {
|
||||
try {
|
||||
$update->createSymbolicLinks($symbolicLinks);
|
||||
$update->runMigrate();
|
||||
$update->saveSettings($settings);
|
||||
$update->runExtraQueries();
|
||||
$update->nextStep();
|
||||
@@ -176,7 +187,6 @@ if (!empty($error)) {
|
||||
echo $update->renderForm($envFormControls);
|
||||
|
||||
} elseif ($currentStep == 2) {
|
||||
echo '<h1 class="mb-4 text-lg font-bold">选择目标版本(注意必须选择比当前版本(' . VERSION_NUMBER. ')高的)</h1>';
|
||||
if (empty($tableRows)) {
|
||||
echo '<div class="text-green-600 text-center">抱歉,暂无任何版可以选择!</div>';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user