mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-18 00:53:10 +01:00
Use self-updater package, initial commit
This commit is contained in:
parent
6f6a475633
commit
d2d64d2a63
@ -52,5 +52,10 @@ class Kernel extends ConsoleKernel
|
||||
->sendOutputTo($logFile)
|
||||
->daily();
|
||||
}
|
||||
|
||||
$schedule
|
||||
->command('updater:check-for-update --prefixVersionWith=v')
|
||||
->sendOutputTo($logFile)
|
||||
->daily();
|
||||
}
|
||||
}
|
||||
|
63
app/Http/Controllers/SelfUpdateController.php
Normal file
63
app/Http/Controllers/SelfUpdateController.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Codedge\Updater\UpdaterManager;
|
||||
|
||||
use App\Http\Requests;
|
||||
use Redirect;
|
||||
|
||||
class SelfUpdateController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var UpdaterManager
|
||||
*/
|
||||
protected $updater;
|
||||
|
||||
/**
|
||||
* SelfUpdateController constructor.
|
||||
*
|
||||
* @param UpdaterManager $updater
|
||||
*/
|
||||
public function __construct(UpdaterManager $updater)
|
||||
{
|
||||
$this->updater = $updater;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show default update page
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$versionInstalled = $this->updater->source()->getVersionInstalled('v');
|
||||
$updateAvailable = $this->updater->source()->isNewVersionAvailable($versionInstalled);
|
||||
|
||||
return view(
|
||||
'vendor.self-update.self-update',
|
||||
[
|
||||
'versionInstalled' => $versionInstalled,
|
||||
'versionAvailable' => $this->updater->source()->getVersionAvailable(),
|
||||
'updateAvailable' => $updateAvailable
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the actual update
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$this->updater->source()->update();
|
||||
|
||||
return Redirect::to('/');
|
||||
}
|
||||
|
||||
public function download()
|
||||
{
|
||||
$this->updater->source()->fetch();
|
||||
}
|
||||
}
|
@ -265,6 +265,9 @@ Route::group([
|
||||
Route::post('bank_accounts/bulk', 'BankAccountController@bulk');
|
||||
Route::post('bank_accounts/validate', 'BankAccountController@validateAccount');
|
||||
Route::post('bank_accounts/import_expenses/{bank_id}', 'BankAccountController@importExpenses');
|
||||
Route::get('self-update', 'SelfUpdateController@index');
|
||||
Route::post('self-update', 'SelfUpdateController@update');
|
||||
Route::get('self-update/download', 'SelfUpdateController@download');
|
||||
});
|
||||
|
||||
// Route groups for API
|
||||
|
@ -159,6 +159,11 @@ class EventServiceProvider extends ServiceProvider {
|
||||
'App\Events\TaskWasUpdated' => [
|
||||
'App\Listeners\ActivityListener@updatedTask',
|
||||
],
|
||||
|
||||
// Update events
|
||||
\Codedge\Updater\Events\UpdateAvailable::class => [
|
||||
\Codedge\Updater\Listeners\SendUpdateAvailableNotification::class
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -81,7 +81,8 @@
|
||||
"barryvdh/laravel-ide-helper": "~2.2",
|
||||
"barryvdh/laravel-debugbar": "~2.2",
|
||||
"fzaninotto/faker": "^1.5",
|
||||
"jaybizzle/laravel-crawler-detect": "1.*"
|
||||
"jaybizzle/laravel-crawler-detect": "1.*",
|
||||
"codedge/laravel-selfupdater": "5.x-dev"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0",
|
||||
|
72
composer.lock
generated
72
composer.lock
generated
@ -4,8 +4,8 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "58fb4c4de809dbd2c62e2701e4c31b12",
|
||||
"content-hash": "308faa59f58a34174062714c7c9c5c48",
|
||||
"hash": "09fda381adad88df20782277ade92809",
|
||||
"content-hash": "77223af5b09a5e08bf323379fe8e3f24",
|
||||
"packages": [
|
||||
{
|
||||
"name": "agmscode/omnipay-agms",
|
||||
@ -1023,6 +1023,62 @@
|
||||
],
|
||||
"time": "2015-01-08 10:05:58"
|
||||
},
|
||||
{
|
||||
"name": "codedge/laravel-selfupdater",
|
||||
"version": "5.x-dev",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/codedge/laravel-selfupdater.git",
|
||||
"reference": "bc1272686ecaf11dd140400a072c1c98b845e44d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/codedge/laravel-selfupdater/zipball/bc1272686ecaf11dd140400a072c1c98b845e44d",
|
||||
"reference": "bc1272686ecaf11dd140400a072c1c98b845e44d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-zip": "*",
|
||||
"guzzlehttp/guzzle": "6.*",
|
||||
"illuminate/support": "5.*",
|
||||
"php": ">=5.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^0.9.5",
|
||||
"orchestra/testbench": "3.2.*",
|
||||
"phpunit/phpunit": "^4.8"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Codedge\\Updater\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Holger Lösken",
|
||||
"email": "holger.loesken@codedge.de",
|
||||
"homepage": "http://codedge.de",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Providing an auto-updating functionality for your self-hosted Laravel application.",
|
||||
"keywords": [
|
||||
"auto update",
|
||||
"auto-update",
|
||||
"laravel",
|
||||
"laravel application",
|
||||
"self update",
|
||||
"self-hosted laravel application",
|
||||
"self-update",
|
||||
"update"
|
||||
],
|
||||
"time": "2016-08-19 12:47:15"
|
||||
},
|
||||
{
|
||||
"name": "collizo4sky/omnipay-wepay",
|
||||
"version": "dev-additional-calls",
|
||||
@ -2121,8 +2177,13 @@
|
||||
"url": "https://github.com/gatepay/FedACHdir.git",
|
||||
"reference": "origin/master"
|
||||
},
|
||||
"type": "library",
|
||||
"time": "2016-06-03 12:00:26"
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/gatepay/FedACHdir/archive/master.zip",
|
||||
"reference": "origin/master",
|
||||
"shasum": null
|
||||
},
|
||||
"type": "library"
|
||||
},
|
||||
{
|
||||
"name": "google/apiclient",
|
||||
@ -10537,7 +10598,8 @@
|
||||
"jlapp/swaggervel": 20,
|
||||
"omnipay/braintree": 20,
|
||||
"gatepay/fedachdir": 20,
|
||||
"collizo4sky/omnipay-wepay": 20
|
||||
"collizo4sky/omnipay-wepay": 20,
|
||||
"codedge/laravel-selfupdater": 20
|
||||
},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
|
@ -155,6 +155,7 @@ return [
|
||||
'Maatwebsite\Excel\ExcelServiceProvider',
|
||||
Websight\GcsProvider\CloudStorageServiceProvider::class,
|
||||
'Jaybizzle\LaravelCrawlerDetect\LaravelCrawlerDetectServiceProvider',
|
||||
Codedge\Updater\UpdaterServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
@ -257,7 +258,7 @@ return [
|
||||
'Excel' => 'Maatwebsite\Excel\Facades\Excel',
|
||||
'PushNotification' => 'Davibennun\LaravelPushNotification\Facades\PushNotification',
|
||||
'Crawler' => 'Jaybizzle\LaravelCrawlerDetect\Facades\LaravelCrawlerDetect',
|
||||
|
||||
'Updater' => Codedge\Updater\UpdaterFacade::class,
|
||||
],
|
||||
|
||||
];
|
||||
|
73
config/self-update.php
Normal file
73
config/self-update.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default source repository type
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The default source repository type you want to pull your updates from.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('SELF_UPDATER_SOURCE', 'github'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Version installed
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set this to the version of your software installed on your system.
|
||||
|
|
||||
*/
|
||||
|
||||
'version_installed' => env('SELF_UPDATER_VERSION_INSTALLED', '2.6.9'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Repository types
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| A repository can be of different types, which can be specified here.
|
||||
| Current options:
|
||||
| - github
|
||||
|
|
||||
*/
|
||||
|
||||
'repository_types' => [
|
||||
'github' => [
|
||||
'type' => 'github',
|
||||
'repository_vendor' => env('SELF_UPDATER_REPO_VENDOR', 'invoiceninja'),
|
||||
'repository_name' => env('SELF_UPDATER_REPO_NAME', 'invoiceninja'),
|
||||
'repository_url' => '',
|
||||
'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'),
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Event Logging
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure if fired events should be logged
|
||||
|
|
||||
*/
|
||||
|
||||
'log_events' => env('SELF_UPDATER_LOG_EVENTS', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mail To Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure if fired events should be logged
|
||||
|
|
||||
*/
|
||||
|
||||
'mail_to' => [
|
||||
'address' => env('SELF_UPDATER_MAILTO_ADDRESS', ''),
|
||||
'name' => env('SELF_UPDATER_MAILTO_NAME', ''),
|
||||
],
|
||||
|
||||
];
|
@ -2075,7 +2075,16 @@ $LANG = array(
|
||||
|
||||
'include_item_taxes_inline' => 'Include <b>line item taxes in line total</b>',
|
||||
'created_quotes' => 'Successfully created :count quotes(s)',
|
||||
|
||||
|
||||
'warning' => 'Warning',
|
||||
'self-update' => 'Update Invoice Ninja',
|
||||
'update_invoiceninja_title' => 'Update Invoice Ninja',
|
||||
'update_invoiceninja_warning' => 'Before start upgrading Invoice Ninja create a backup of your database and files!',
|
||||
'update_invoiceninja_available' => 'A new version of Invoice Ninja is available.',
|
||||
'update_invoiceninja_unavailable' => 'No new version of Invoice Ninja available.',
|
||||
'update_invoiceninja_decide_update_download' => 'You can decide to update directly to :version or to just download the new relase and update later.',
|
||||
'update_invoiceninja_update_start' => 'Update now',
|
||||
'update_invoiceninja_download_start' => 'Download :version',
|
||||
);
|
||||
|
||||
return $LANG;
|
||||
|
@ -469,6 +469,18 @@
|
||||
|
||||
</div>
|
||||
|
||||
@if (Utils::isAdmin())
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
@section('self-updater')
|
||||
<a href="{{ URL::to('self-update') }}" class="dropdown-toggle">
|
||||
<span class="glyphicon glyphicon-cloud-download" title="{{ trans('texts.update_invoiceninja_title') }}"></span>
|
||||
</a>
|
||||
@show
|
||||
</li>
|
||||
</ul>
|
||||
@endif
|
||||
|
||||
<ul class="nav navbar-nav navbar-right navbar-settings">
|
||||
<li class="dropdown">
|
||||
@if (Utils::isAdmin())
|
||||
|
5
resources/views/vendor/self-update/mails/update-available.blade.php
vendored
Normal file
5
resources/views/vendor/self-update/mails/update-available.blade.php
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
Hello!
|
||||
|
||||
The new version {{ $newVersion }} is available.
|
||||
|
||||
Kind regards
|
58
resources/views/vendor/self-update/self-update.blade.php
vendored
Normal file
58
resources/views/vendor/self-update/self-update.blade.php
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
@extends('header')
|
||||
|
||||
@section('content')
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<strong>
|
||||
{{ trans('texts.warning') }}:
|
||||
</strong>
|
||||
{{ trans('texts.update_invoiceninja_warning') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
@if(!$updateAvailable)
|
||||
{{ trans('texts.update_invoiceninja_unavailable') }}
|
||||
@else
|
||||
<strong>
|
||||
{{ trans('texts.update_invoiceninja_available') }}
|
||||
</strong>
|
||||
<br/>
|
||||
{{ trans('texts.update_invoiceninja_decide_update_download', ['version' => $versionAvailable]) }}
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@if($updateAvailable)
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<br/>
|
||||
<form name="download-update-form" action="{{ url('self-update') }}" method="post">
|
||||
{{ csrf_field() }}
|
||||
<input type="hidden" name="action" id="update-action" value="update"/>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary" id="do-updade">
|
||||
{{ trans('texts.update_invoiceninja_update_start') }}
|
||||
</button>
|
||||
<button type="submit" class="btn btn-default" id="download-update">
|
||||
{{ trans('texts.update_invoiceninja_download_start', ['version' => $versionAvailable]) }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$('#download-update').click(function (){
|
||||
$('#update-action').val('download');
|
||||
});
|
||||
$('#do-update').click(function (){
|
||||
$('#update-action').val('update');
|
||||
});
|
||||
</script>
|
||||
@endsection
|
Loading…
Reference in New Issue
Block a user