1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #5390 from turbo124/v5-develop

minor fixes
This commit is contained in:
David Bomba 2021-04-09 10:34:40 +10:00 committed by GitHub
commit 4822d787f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 276 additions and 27 deletions

View File

@ -16,7 +16,6 @@ use Cz\Git\GitException;
use Cz\Git\GitRepository;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Artisan;
class SelfUpdateController extends BaseController
{
@ -69,34 +68,53 @@ class SelfUpdateController extends BaseController
nlog('Are there changes to pull? '.$repo->hasChanges());
$output = '';
try {
$cacheCompiled = base_path('bootstrap/cache/compiled.php');
if (file_exists($cacheCompiled)) { unlink ($cacheCompiled); }
$cacheServices = base_path('bootstrap/cache/services.php');
if (file_exists($cacheServices)) { unlink ($cacheServices); }
$updater = new \Codedge\Updater\UpdaterManager()
Artisan::call('clear-compiled');
Artisan::call('cache:clear');
Artisan::call('debugbar:clear');
Artisan::call('route:clear');
Artisan::call('view:clear');
Artisan::call('config:clear');
// Check if new version is available
if($updater->source()->isNewVersionAvailable()) {
$output = $repo->execute('stash');
$output = $repo->execute('reset hard origin/v5-stable');
$output = $repo->execute('pull origin');
// Get the current installed version
echo $updater->source()->getVersionInstalled();
} catch (GitException $e) {
// Get the new version available
$versionAvailable = $updater->source()->getVersionAvailable();
nlog($output);
nlog($e->getMessage());
return response()->json(['message'=>$e->getMessage()], 500);
// Create a release
$release = $updater->source()->fetch($versionAvailable);
// Run the update process
$updater->source()->update($release);
}
dispatch(function () {
Artisan::call('ninja:post-update');
});
// try {
// $cacheCompiled = base_path('bootstrap/cache/compiled.php');
// if (file_exists($cacheCompiled)) { unlink ($cacheCompiled); }
// $cacheServices = base_path('bootstrap/cache/services.php');
// if (file_exists($cacheServices)) { unlink ($cacheServices); }
// Artisan::call('clear-compiled');
// Artisan::call('cache:clear');
// Artisan::call('debugbar:clear');
// Artisan::call('route:clear');
// Artisan::call('view:clear');
// Artisan::call('config:clear');
// // $output = $repo->execute('stash');
// // $output = $repo->execute('reset --hard origin/v5-stable');
// $output = $repo->execute('pull origin');
// } catch (GitException $e) {
// nlog($output);
// nlog($e->getMessage());
// return response()->json(['message'=>$e->getMessage()], 500);
// }
// dispatch(function () {
// Artisan::call('ninja:post-update');
// });
return response()->json(['message' => $output], 200);
}

View File

@ -36,12 +36,12 @@
"checkout/checkout-sdk-php": "^1.0",
"cleverit/ubl_invoice": "^1.3",
"coconutcraig/laravel-postmark": "^2.10",
"codedge/laravel-selfupdater": "^3.2",
"composer/composer": "^2",
"czproject/git-php": "^3.17",
"turbo124/laravel-gmail": "^5",
"doctrine/dbal": "^2.10",
"fideloper/proxy": "^4.2",
"fakerphp/faker": "^1.14",
"fideloper/proxy": "^4.2",
"google/apiclient": "^2.7",
"guzzlehttp/guzzle": "^7.0.1",
"hashids/hashids": "^4.0",
@ -67,6 +67,7 @@
"stripe/stripe-php": "^7.50",
"symfony/http-client": "^5.2",
"turbo124/beacon": "^1.0",
"turbo124/laravel-gmail": "^5",
"webpatser/laravel-countries": "dev-master#75992ad",
"wildbit/swiftmailer-postmark": "^3.3"
},

84
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "64a35682f0e808b80b4784d812271f0b",
"content-hash": "c7966839cf1cb74e25348aff4acadb1c",
"packages": [
{
"name": "authorizenet/authorizenet",
@ -563,6 +563,88 @@
],
"time": "2021-02-24T13:45:30+00:00"
},
{
"name": "codedge/laravel-selfupdater",
"version": "3.2.2",
"source": {
"type": "git",
"url": "https://github.com/codedge/laravel-selfupdater.git",
"reference": "ade06363a1a8175adcf070f392f1fd25eef5c214"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/codedge/laravel-selfupdater/zipball/ade06363a1a8175adcf070f392f1fd25eef5c214",
"reference": "ade06363a1a8175adcf070f392f1fd25eef5c214",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-zip": "*",
"guzzlehttp/guzzle": "6.* || 7.*",
"laravel/framework": "^8.33.1",
"php": "^7.3 || ^7.4 || ^8.0"
},
"require-dev": {
"dg/bypass-finals": "^1.3",
"mikey179/vfsstream": "^1.6",
"mockery/mockery": "^1.4",
"orchestra/testbench": "^6.14.0",
"phpunit/phpunit": "^9.5.3"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"Updater": "Codedge\\Updater\\UpdaterFacade"
},
"providers": [
"Codedge\\Updater\\UpdaterServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Codedge\\Updater\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"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"
],
"support": {
"issues": "https://github.com/codedge/laravel-selfupdater/issues",
"source": "https://github.com/codedge/laravel-selfupdater"
},
"funding": [
{
"url": "https://github.com/codedge",
"type": "github"
}
],
"time": "2021-03-20T09:31:26+00:00"
},
{
"name": "composer/ca-bundle",
"version": "1.2.9",

View File

@ -15,6 +15,7 @@ return [
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', ''),
'app_version' => '5.1.42',
'app_tag' => 'v5.1.42',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false),

147
config/self-update.php Normal file
View File

@ -0,0 +1,147 @@
<?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', config('ninja.app_tag')),
/*
|--------------------------------------------------------------------------
| Repository types
|--------------------------------------------------------------------------
|
| A repository can be of different types, which can be specified here.
| Current options:
| - github
| - http
|
*/
'repository_types' => [
'github' => [
'type' => 'github',
'repository_vendor' => env('SELF_UPDATER_REPO_VENDOR', 'invoiceninja'),
'repository_name' => env('SELF_UPDATER_REPO_NAME', 'invoiceninja'),
'repository_url' => 'https://github.com/',
'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'),
'private_access_token' => env('SELF_UPDATER_GITHUB_PRIVATE_ACCESS_TOKEN', ''),
'use_branch' => env('SELF_UPDATER_USE_BRANCH', 'v5-stable'),
],
'http' => [
'type' => 'http',
'repository_url' => env('SELF_UPDATER_REPO_URL', ''),
'pkg_filename_format' => env('SELF_UPDATER_PKG_FILENAME_FORMAT', 'v_VERSION_'),
'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'),
'private_access_token' => env('SELF_UPDATER_HTTP_PRIVATE_ACCESS_TOKEN', ''),
],
],
/*
|--------------------------------------------------------------------------
| Exclude folders from update
|--------------------------------------------------------------------------
|
| Specific folders which should not be updated and will be skipped during the
| update process.
|
| Here's already a list of good examples to skip. You may want to keep those.
|
*/
'exclude_folders' => [
'__MACOSX',
'node_modules',
'bootstrap/cache',
'bower',
'storage/app',
'storage/framework',
'storage/logs',
'storage/self-update',
'public/storage',
'vendor',
],
/*
|--------------------------------------------------------------------------
| Event Logging
|--------------------------------------------------------------------------
|
| Configure if fired events should be logged
|
*/
'log_events' => env('SELF_UPDATER_LOG_EVENTS', false),
/*
|--------------------------------------------------------------------------
| Notifications
|--------------------------------------------------------------------------
|
| Specify for which events you want to get notifications. Out of the box you can use 'mail'.
|
*/
'notifications' => [
'notifications' => [
\Codedge\Updater\Notifications\Notifications\UpdateSucceeded::class => ['mail'],
\Codedge\Updater\Notifications\Notifications\UpdateFailed::class => ['mail'],
\Codedge\Updater\Notifications\Notifications\UpdateAvailable::class => ['mail'],
],
/*
* Here you can specify the notifiable to which the notifications should be sent. The default
* notifiable will use the variables specified in this config file.
*/
'notifiable' => \Codedge\Updater\Notifications\Notifiable::class,
'mail' => [
'to' => [
'address' => env('SELF_UPDATER_MAILTO_ADDRESS', 'notifications@example.com'),
'name' => env('SELF_UPDATER_MAILTO_NAME', ''),
],
'from' => [
'address' => env('SELF_UPDATER_MAIL_FROM_ADDRESS', 'updater@example.com'),
'name' => env('SELF_UPDATER_MAIL_FROM_NAME', 'Update'),
],
],
],
/*
|---------------------------------------------------------------------------
| Register custom artisan commands
|---------------------------------------------------------------------------
*/
'artisan_commands' => [
'pre_update' => [
//'command:signature' => [
// 'class' => Command class
// 'params' => []
//]
],
'post_update' => [
'class' => \App\Console\Commands\PostUpdate::class
],
],
];