add update tips

This commit is contained in:
printempw 2016-09-28 22:56:21 +08:00
parent 6a8cbc97e2
commit e119ba073c
2 changed files with 22 additions and 2 deletions

View File

@ -5,6 +5,16 @@
<p>数据库升级成功,欢迎使用 Blessing Skin Server {{ config('app.version') }}</p>
{{-- if any tip is given --}}
@if (isset($tips))
<p><b>升级提示:</b></p>
<ul>
@foreach ($tips as $tip)
<li><p>{{ $tip }}</p></li>
@endforeach
</ul>
@endif
<p class="step">
<a href="../" class="button button-large">首页</a>
</p>

View File

@ -21,6 +21,9 @@ switch ($step) {
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 @@ switch ($step) {
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 @@ switch ($step) {
Option::set('version', config('app.version'));
}
View::show('setup.updates.success');
View::show('setup.updates.success', ['tips' => $tips]);
break;