refactor self updating

This commit is contained in:
David Bomba 2021-04-09 11:22:11 +10:00
parent 4822d787f8
commit c77faa746d
4 changed files with 35 additions and 30 deletions

View File

@ -54,7 +54,7 @@ class SelfUpdateController extends BaseController
* ), * ),
* ) * )
*/ */
public function update() public function update(\Codedge\Updater\UpdaterManager $updater)
{ {
define('STDIN', fopen('php://stdin', 'r')); define('STDIN', fopen('php://stdin', 'r'));
@ -62,14 +62,14 @@ class SelfUpdateController extends BaseController
return response()->json(['message' => ctrans('texts.self_update_not_available')], 403); return response()->json(['message' => ctrans('texts.self_update_not_available')], 403);
} }
/* .git MUST be owned/writable by the webserver user */ // /* .git MUST be owned/writable by the webserver user */
$repo = new GitRepository(base_path()); // $repo = new GitRepository(base_path());
nlog('Are there changes to pull? '.$repo->hasChanges()); // nlog('Are there changes to pull? '.$repo->hasChanges());
$output = ''; // $output = '';
$updater = new \Codedge\Updater\UpdaterManager() // $updater = new \Codedge\Updater\UpdaterManager();
// Check if new version is available // Check if new version is available
if($updater->source()->isNewVersionAvailable()) { if($updater->source()->isNewVersionAvailable()) {

46
composer.lock generated
View File

@ -51,16 +51,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.176.9", "version": "3.178.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "17dc67514b148979994758fbfb54088a8a3393bf" "reference": "214e3d98c54277cd8965f1cf307dce39631407bf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/17dc67514b148979994758fbfb54088a8a3393bf", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/214e3d98c54277cd8965f1cf307dce39631407bf",
"reference": "17dc67514b148979994758fbfb54088a8a3393bf", "reference": "214e3d98c54277cd8965f1cf307dce39631407bf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -135,9 +135,9 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.176.9" "source": "https://github.com/aws/aws-sdk-php/tree/3.178.0"
}, },
"time": "2021-04-06T18:13:47+00:00" "time": "2021-04-08T18:13:16+00:00"
}, },
{ {
"name": "bacon/bacon-qr-code", "name": "bacon/bacon-qr-code",
@ -2841,16 +2841,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v8.36.1", "version": "v8.36.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "91c454715b81b9a39f718651d4e2f8104d45e7c2" "reference": "0debd8ad6b5aa1f61ccc73910adf049af4ca0444"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/91c454715b81b9a39f718651d4e2f8104d45e7c2", "url": "https://api.github.com/repos/laravel/framework/zipball/0debd8ad6b5aa1f61ccc73910adf049af4ca0444",
"reference": "91c454715b81b9a39f718651d4e2f8104d45e7c2", "reference": "0debd8ad6b5aa1f61ccc73910adf049af4ca0444",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3005,7 +3005,7 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2021-04-06T21:14:06+00:00" "time": "2021-04-07T12:37:22+00:00"
}, },
{ {
"name": "laravel/slack-notification-channel", "name": "laravel/slack-notification-channel",
@ -10910,16 +10910,16 @@
}, },
{ {
"name": "facade/flare-client-php", "name": "facade/flare-client-php",
"version": "1.5.0", "version": "1.6.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/facade/flare-client-php.git", "url": "https://github.com/facade/flare-client-php.git",
"reference": "9dd6f2b56486d939c4467b3f35475d44af57cf17" "reference": "f2b0969f2d9594704be74dbeb25b201570a98098"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/facade/flare-client-php/zipball/9dd6f2b56486d939c4467b3f35475d44af57cf17", "url": "https://api.github.com/repos/facade/flare-client-php/zipball/f2b0969f2d9594704be74dbeb25b201570a98098",
"reference": "9dd6f2b56486d939c4467b3f35475d44af57cf17", "reference": "f2b0969f2d9594704be74dbeb25b201570a98098",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -10963,7 +10963,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/facade/flare-client-php/issues", "issues": "https://github.com/facade/flare-client-php/issues",
"source": "https://github.com/facade/flare-client-php/tree/1.5.0" "source": "https://github.com/facade/flare-client-php/tree/1.6.1"
}, },
"funding": [ "funding": [
{ {
@ -10971,26 +10971,26 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-03-31T07:32:54+00:00" "time": "2021-04-08T08:50:01+00:00"
}, },
{ {
"name": "facade/ignition", "name": "facade/ignition",
"version": "2.7.0", "version": "2.8.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/facade/ignition.git", "url": "https://github.com/facade/ignition.git",
"reference": "bdc8b0b32c888f6edc838ca641358322b3d9506d" "reference": "cb7f790e6306caeb4a9ffe21e59942b7128cc630"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/facade/ignition/zipball/bdc8b0b32c888f6edc838ca641358322b3d9506d", "url": "https://api.github.com/repos/facade/ignition/zipball/cb7f790e6306caeb4a9ffe21e59942b7128cc630",
"reference": "bdc8b0b32c888f6edc838ca641358322b3d9506d", "reference": "cb7f790e6306caeb4a9ffe21e59942b7128cc630",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*", "ext-json": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"facade/flare-client-php": "^1.3.7", "facade/flare-client-php": "^1.6",
"facade/ignition-contracts": "^1.0.2", "facade/ignition-contracts": "^1.0.2",
"filp/whoops": "^2.4", "filp/whoops": "^2.4",
"illuminate/support": "^7.0|^8.0", "illuminate/support": "^7.0|^8.0",
@ -11048,7 +11048,7 @@
"issues": "https://github.com/facade/ignition/issues", "issues": "https://github.com/facade/ignition/issues",
"source": "https://github.com/facade/ignition" "source": "https://github.com/facade/ignition"
}, },
"time": "2021-03-30T15:55:38+00:00" "time": "2021-04-08T10:42:53+00:00"
}, },
{ {
"name": "facade/ignition-contracts", "name": "facade/ignition-contracts",

View File

@ -140,8 +140,10 @@ return [
//] //]
], ],
'post_update' => [ 'post_update' => [
'class' => \App\Console\Commands\PostUpdate::class 'postupdate:cleanup' => [
'class' => \App\Console\Commands\PostUpdate::class,
], ],
]
], ],
]; ];

View File

@ -6,6 +6,9 @@ use Illuminate\Support\Facades\Route;
Route::get('/', 'BaseController@flutterRoute')->middleware('guest'); Route::get('/', 'BaseController@flutterRoute')->middleware('guest');
Route::get('self-update', 'SelfUpdateController@update')->middleware('guest');
Route::get('setup', 'SetupController@index')->middleware('guest'); Route::get('setup', 'SetupController@index')->middleware('guest');
Route::post('setup', 'SetupController@doSetup')->middleware('guest'); Route::post('setup', 'SetupController@doSetup')->middleware('guest');
Route::get('update', 'SetupController@update')->middleware('guest'); Route::get('update', 'SetupController@update')->middleware('guest');