Skip to content
This repository has been archived by the owner on Jan 11, 2020. It is now read-only.

Commit

Permalink
add update tips
Browse files Browse the repository at this point in the history
  • Loading branch information
prinsss committed Sep 28, 2016
1 parent 6a8cbc9 commit e119ba0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
10 changes: 10 additions & 0 deletions resources/views/setup/updates/success.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
14 changes: 12 additions & 2 deletions setup/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -46,7 +56,7 @@
Option::set('version', config('app.version'));
}

View::show('setup.updates.success');
View::show('setup.updates.success', ['tips' => $tips]);

break;

Expand Down

0 comments on commit e119ba0

Please sign in to comment.