mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 04:04:47 -04:00
Refactor for self updater
This commit is contained in:
parent
51371674fc
commit
8e6772ef75
@ -54,7 +54,7 @@ class PostUpdate extends Command
|
|||||||
|
|
||||||
$output = [];
|
$output = [];
|
||||||
|
|
||||||
exec('vendor/bin/composer install --no-dev -o', $output);
|
// exec('vendor/bin/composer install --no-dev -o', $output);
|
||||||
|
|
||||||
info(print_r($output,1));
|
info(print_r($output,1));
|
||||||
info("finished running composer install ");
|
info("finished running composer install ");
|
||||||
|
@ -53,8 +53,43 @@ class SelfUpdateController extends BaseController
|
|||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function update(\Codedge\Updater\UpdaterManager $updater)
|
// public function old_update(\Codedge\Updater\UpdaterManager $updater)
|
||||||
|
// {
|
||||||
|
// set_time_limit(0);
|
||||||
|
// define('STDIN', fopen('php://stdin', 'r'));
|
||||||
|
|
||||||
|
// if (Ninja::isHosted()) {
|
||||||
|
// return response()->json(['message' => ctrans('texts.self_update_not_available')], 403);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $this->testWritable();
|
||||||
|
|
||||||
|
// // Get the new version available
|
||||||
|
// $versionAvailable = $updater->source()->getVersionAvailable();
|
||||||
|
|
||||||
|
// // Create a release
|
||||||
|
// $release = $updater->source()->fetch($versionAvailable);
|
||||||
|
|
||||||
|
// $updater->source()->update($release);
|
||||||
|
|
||||||
|
|
||||||
|
// $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('route:clear');
|
||||||
|
// Artisan::call('view:clear');
|
||||||
|
// Artisan::call('optimize');
|
||||||
|
|
||||||
|
// return response()->json(['message' => 'Update completed'], 200);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
public function update()
|
||||||
{
|
{
|
||||||
|
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
define('STDIN', fopen('php://stdin', 'r'));
|
define('STDIN', fopen('php://stdin', 'r'));
|
||||||
|
|
||||||
@ -64,32 +99,6 @@ class SelfUpdateController extends BaseController
|
|||||||
|
|
||||||
$this->testWritable();
|
$this->testWritable();
|
||||||
|
|
||||||
// Get the new version available
|
|
||||||
$versionAvailable = $updater->source()->getVersionAvailable();
|
|
||||||
|
|
||||||
// Create a release
|
|
||||||
$release = $updater->source()->fetch($versionAvailable);
|
|
||||||
|
|
||||||
$updater->source()->update($release);
|
|
||||||
|
|
||||||
|
|
||||||
$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('route:clear');
|
|
||||||
Artisan::call('view:clear');
|
|
||||||
Artisan::call('optimize');
|
|
||||||
|
|
||||||
return response()->json(['message' => 'Update completed'], 200);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function new_update()
|
|
||||||
{
|
|
||||||
|
|
||||||
$contents = file_get_contents($this->getDownloadUrl());
|
$contents = file_get_contents($this->getDownloadUrl());
|
||||||
|
|
||||||
Storage::disk('local')->put('invoiceninja.zip', $contents);
|
Storage::disk('local')->put('invoiceninja.zip', $contents);
|
||||||
@ -106,6 +115,19 @@ class SelfUpdateController extends BaseController
|
|||||||
|
|
||||||
unlink($file);
|
unlink($file);
|
||||||
|
|
||||||
|
$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('route:clear');
|
||||||
|
Artisan::call('view:clear');
|
||||||
|
Artisan::call('migrate', ['--force' => true]);
|
||||||
|
Artisan::call('optimize');
|
||||||
|
|
||||||
|
return response()->json(['message' => 'Update completed'], 200);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +40,6 @@
|
|||||||
"checkout/checkout-sdk-php": "^1.0",
|
"checkout/checkout-sdk-php": "^1.0",
|
||||||
"cleverit/ubl_invoice": "^1.3",
|
"cleverit/ubl_invoice": "^1.3",
|
||||||
"coconutcraig/laravel-postmark": "^2.10",
|
"coconutcraig/laravel-postmark": "^2.10",
|
||||||
"codedge/laravel-selfupdater": "^3.2",
|
|
||||||
"composer/composer": "^2",
|
|
||||||
"doctrine/dbal": "^3.0",
|
"doctrine/dbal": "^3.0",
|
||||||
"eway/eway-rapid-php": "^1.3",
|
"eway/eway-rapid-php": "^1.3",
|
||||||
"fakerphp/faker": "^1.14",
|
"fakerphp/faker": "^1.14",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user