Fix possible error on update page

This commit is contained in:
Pig Fang 2019-05-03 15:04:02 +08:00
parent 69de61aedd
commit 9197b8b095
5 changed files with 15 additions and 10 deletions

View File

@ -0,0 +1,3 @@
## Fixed
- Fixed possible error on update page.

View File

@ -0,0 +1,3 @@
## 修复
- 修复升级页面可能的出错

View File

@ -8,10 +8,9 @@
<p>{!! nl2br(trans('setup.updates.welcome.text', ['version' => config('app.version')])) !!}</p>
<form method="post" action="{{ url('/setup/update') }}" novalidate="novalidate">
@csrf
<p class="step">
<input type="submit" name="submit" class="button button-large" value="@lang('setup.updates.welcome.button')" />
</p>
</form>
<p class="step">
<a href="{{ url('/setup/exec-update') }}" class="button button-large">
@lang('setup.updates.welcome.button')
</a>
</p>
@endsection

View File

@ -21,6 +21,6 @@ Route::group(['middleware' => 'setup'], function () {
Route::post('/finish', 'SetupController@finish');
});
Route::get('/update', 'SetupController@update');
Route::post('/update', 'SetupController@doUpdate');
Route::any('/update', 'SetupController@update');
Route::any('/exec-update', 'SetupController@doUpdate');
Route::view('/changelog', 'setup.updates.changelog');

View File

@ -221,13 +221,13 @@ class SetupControllerTest extends TestCase
); // Just a fixture
config(['options.new_option' => 'value']);
$this->post('/setup/update')->assertViewHas('tips');
$this->get('/setup/exec-update')->assertViewHas('tips');
$this->assertEquals('value', option('new_option'));
$this->assertEquals('100.0.0', option('version'));
unlink(database_path("update_scripts/update-$current_version-to-100.0.0.php"));
option(['version' => '3.0.0']); // Fake old version
$this->post('/setup/update');
$this->get('/setup/exec-update');
$this->assertEquals('100.0.0', option('version'));
}