From 10a3f959dba5a72290a4d960efca940e04aa4a17 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Mon, 14 Feb 2022 01:42:24 +0800 Subject: [PATCH] update readme & fix update download latest code --- README-EN.md | 3 ++- README.md | 3 ++- nexus/Install/Install.php | 3 ++- nexus/Install/Update.php | 7 ++++--- nexus/Install/update/update.php | 9 +++++---- public/offers.php | 2 +- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README-EN.md b/README-EN.md index abc53960..4dfbb769 100644 --- a/README-EN.md +++ b/README-EN.md @@ -11,6 +11,7 @@ Complete PT website building solution. Based on NexusPHP + Laravel Framework + E - Exam - H&R - Attendance +- Medal - Forum - Multi-language - Automatic backup @@ -19,7 +20,7 @@ Complete PT website building solution. Based on NexusPHP + Laravel Framework + E - .... ## System Requirements -- PHP: 7.3|8.0, must have extensions: bcmath, ctype, fileinfo, json, mbstring, openssl, pdo_mysql, tokenizer, xml, mysqli, gd +- PHP: 8.0, must have extensions: bcmath, ctype, fileinfo, json, mbstring, openssl, pdo_mysql, tokenizer, xml, mysqli, gd - Mysql: 5.7 latest version or above - Redis:optional diff --git a/README.md b/README.md index c84e7291..be4700fc 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ - 考核 - H&R - 签到 +- 勋章 - 论坛 - 多语言 - 自动备份 @@ -18,7 +19,7 @@ - .... ## 系统要求 -- PHP: 7.3|8.0,必须扩展:bcmath, ctype, fileinfo, json, mbstring, openssl, pdo_mysql, tokenizer, xml, mysqli, gd +- PHP: 8.0,必须扩展:bcmath, ctype, fileinfo, json, mbstring, openssl, pdo_mysql, tokenizer, xml, mysqli, gd - Mysql: 5.7最新版或以上版本 - Redis:可选 diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php index b640e68f..57d10064 100644 --- a/nexus/Install/Install.php +++ b/nexus/Install/Install.php @@ -556,8 +556,9 @@ class Install public function executeCommand($command) { + $this->doLog("command: $command"); $result = exec($command, $output, $result_code); - $this->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result)); + $this->doLog(sprintf('result_code: %s, result: %s', $result_code, $result)); $this->doLog("output: " . json_encode($output)); if ($result_code != 0) { throw new \RuntimeException(json_encode($output)); diff --git a/nexus/Install/Update.php b/nexus/Install/Update.php index 63da18fe..c92e5d0a 100644 --- a/nexus/Install/Update.php +++ b/nexus/Install/Update.php @@ -129,7 +129,7 @@ class Update extends Install * attendance change, do migrate */ if (WITH_LARAVEL && !NexusDB::schema()->hasColumn('attendance', 'total_days')) { - $this->runMigrate(database_path('migrations/2021_06_13_215440_add_total_days_to_attendance_table.php')); + $this->runMigrate('database/migrations/2021_06_13_215440_add_total_days_to_attendance_table.php'); $this->migrateAttendance(); } @@ -139,7 +139,7 @@ class Update extends Install * add seed points to user */ if (WITH_LARAVEL && !NexusDB::schema()->hasColumn('users', 'seed_points')) { - $this->runMigrate(database_path('migrations/2021_06_24_013107_add_seed_points_to_users_table.php')); + $this->runMigrate('database/migrations/2021_06_24_013107_add_seed_points_to_users_table.php'); $result = $this->initSeedPoints(); $this->doLog("[INIT SEED POINTS], $result"); } @@ -226,6 +226,7 @@ class Update extends Install $suffix = '.tar.gz'; } $filename = sprintf('%s/nexusphp-%s-%s%s', sys_get_temp_dir(), $basename, date('YmdHis'), $suffix); + $this->doLog("download from: $url, save to filename: $filename"); $client = new Client(); $response = $client->request('GET', $url, ['sink' => $filename]); if (($statusCode = $response->getStatusCode()) != 200) { @@ -273,7 +274,7 @@ class Update extends Install ->whereNull('seed_points') ->limit($size) ->update([ - 'seed_points' => NexusDB::raw('seed_points = seedbonus') + 'seed_points' => NexusDB::raw('seedbonus') ]); $result += $affectedRows; $this->doLog("affectedRows: $affectedRows, query: " . last_query()); diff --git a/nexus/Install/update/update.php b/nexus/Install/update/update.php index 7bc3c83a..79a623ad 100644 --- a/nexus/Install/update/update.php +++ b/nexus/Install/update/update.php @@ -54,7 +54,7 @@ if ($currentStep == 2) { $time = \Carbon\Carbon::parse($latestCommit['committer']['date']); $time->tz = nexus_env('TIMEZONE'); $tableRows[] = [ - 'checkbox' => sprintf(''), + 'checkbox' => sprintf('', $latestCommit['sha']), 'tag_name' => '最新开发代码', 'name' => "仅限开发测试!最新提交:" . $latestCommit['commit']['message'], 'published_at' => $time->format('Y-m-d H:i:s'), @@ -85,8 +85,9 @@ if ($currentStep == 2) { $downloadUrl = ''; if ($_REQUEST['version_url'] == 'manual') { $update->nextStep(); - } elseif ($_REQUEST['version_url'] == 'development') { - $downloadUrl = 'https://github.com/xiaomlove/nexusphp/archive/refs/heads/php8.zip'; + } elseif (\Illuminate\Support\Str::startsWith($_REQUEST['version_url'], 'development')) { + $downloadUrlArr = explode('|', $_REQUEST['version_url']); + $downloadUrl = sprintf('https://github.com/xiaomlove/nexusphp/archive/%s.zip', $downloadUrlArr[1]); } else { $versionUrlArr = explode('|', $_REQUEST['version_url']); $version = strtolower($versionUrlArr[0]); @@ -191,7 +192,7 @@ if (!empty($error)) { echo'
'; $header = [ 'label' => '项目', - 'require' => '要求', + 'required' => '要求', 'current'=> '当前', 'result'=> '结果' ]; diff --git a/public/offers.php b/public/offers.php index f68e5bcf..a59d5632 100644 --- a/public/offers.php +++ b/public/offers.php @@ -207,7 +207,7 @@ if (isset($_GET['off_details']) && $_GET["off_details"]){ } else { - list($pagertop, $pagerbottom, $limit) = pager(10, $count, "offers.php?id=$id&off_details=1&", array(lastpagedefault => 1)); + list($pagertop, $pagerbottom, $limit) = pager(10, $count, "offers.php?id=$id&off_details=1&", array('lastpagedefault' => 1)); $subres = sql_query("SELECT id, text, user, added, editedby, editdate FROM comments WHERE offer = " . sqlesc($id) . " ORDER BY id $limit") or sqlerr(__FILE__, __LINE__); $allrows = array();