From e119ba073cea2a8fe69bee45a1699666986f63bb Mon Sep 17 00:00:00 2001 From: printempw Date: Wed, 28 Sep 2016 22:56:21 +0800 Subject: [PATCH] add update tips --- resources/views/setup/updates/success.tpl | 10 ++++++++++ setup/update.php | 14 ++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/resources/views/setup/updates/success.tpl b/resources/views/setup/updates/success.tpl index 8a1f6903..f2544754 100644 --- a/resources/views/setup/updates/success.tpl +++ b/resources/views/setup/updates/success.tpl @@ -5,6 +5,16 @@

数据库升级成功,欢迎使用 Blessing Skin Server {{ config('app.version') }}!

+{{-- if any tip is given --}} +@if (isset($tips)) +

升级提示:

+ +@endif +

首页

diff --git a/setup/update.php b/setup/update.php index eca97251..fc4e88e0 100644 --- a/setup/update.php +++ b/setup/update.php @@ -21,6 +21,9 @@ case '2': $resource = opendir(BASE_DIR."/setup/update_scripts/"); $update_script_exist = false; + + $tips = []; + while($filename = @readdir($resource)) { if ($filename != "." && $filename != "..") { preg_match('/update-(.*)-to-(.*).php/', $filename, $matches); @@ -31,7 +34,14 @@ continue; } - include BASE_DIR."/setup/update_scripts/$filename"; + $result = require BASE_DIR."/setup/update_scripts/$filename"; + + if (is_array($result)) { + // push tip to array + foreach ($result as $tip) { + $tips[] = $tip; + } + } } } closedir($resource); @@ -46,7 +56,7 @@ Option::set('version', config('app.version')); } - View::show('setup.updates.success'); + View::show('setup.updates.success', ['tips' => $tips]); break;