This commit is contained in:
denisdulici 2017-09-21 17:01:51 +03:00
parent 8a49a5809f
commit fef02a3bbb
6 changed files with 42 additions and 1 deletions

View File

@ -6,10 +6,26 @@ use App\Http\Controllers\Controller;
use App\Models\Module\Module as Model;
use App\Utilities\Updater;
use App\Utilities\Versions;
use Illuminate\Routing\Route;
use Module;
class Updates extends Controller
{
/**
* Instantiate a new controller instance.
*
* @param Route $route
*/
public function __construct(Route $route)
{
if (!setting('general.api_token')) {
return redirect('modules/token/create')->send();
}
parent::__construct($route);
}
/**
* Show the form for creating a new resource.
*
@ -56,6 +72,24 @@ class Updates extends Controller
return Versions::changelog();
}
/**
* Check for updates.
*
* @return Response
*/
public function check()
{
// Clear cache in order to check for updates
Updater::clear();
return redirect()->back();
}
/**
* Update the core or modules.
*
* @return Response
*/
public function update($alias, $version)
{
set_time_limit(600); // 10 minutes

View File

@ -92,6 +92,7 @@ return [
'help' => 'Help',
'all' => 'All',
'upcoming' => 'Upcoming',
'created' => 'Created',
'title' => [
'new' => 'New :type',

View File

@ -6,6 +6,7 @@ return [
'latest_version' => 'Latest Version',
'update' => 'Update Akaunting to :version version',
'changelog' => 'Changelog',
'check' => 'Check',
'new_core' => 'An updated version of Akaunting is available.',
'latest_core' => 'Congratulations! You have the latest version of Akaunting. Future security updates will be applied automatically.',

View File

@ -35,7 +35,7 @@
<th class="col-md-4">@sortablelink('name', trans('general.name'))</th>
<th class="col-md-2">@sortablelink('domain', trans('companies.domain'))</th>
<th class="col-md-2">@sortablelink('email', trans('general.email'))</th>
<th class="col-md-1">@sortablelink('created_at', trans('general.date'))</th>
<th class="col-md-1">@sortablelink('created_at', trans('general.created'))</th>
<th class="col-md-3">{{ trans('general.actions') }}</th>
</tr>
</thead>

View File

@ -2,6 +2,10 @@
@section('title', trans_choice('general.updates', 2))
@section('new_button')
<span class="new-button"><a href="{{ url('install/updates/check') }}" class="btn btn-warning btn-sm"><span class="fa fa-history"></span> &nbsp;{{ trans('updates.check') }}</a></span>
@endsection
@section('content')
<!-- Default box -->
<div class="box box-success">

View File

@ -98,6 +98,7 @@ Route::group(['middleware' => ['auth', 'language', 'adminmenu', 'permission:read
Route::group(['prefix' => 'install'], function () {
Route::get('updates/changelog', 'Install\Updates@changelog');
Route::get('updates/check', 'Install\Updates@check');
Route::get('updates/update/{id}/{version}', 'Install\Updates@update');
Route::resource('updates', 'Install\Updates');
});