mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
Merge branch 'version-320' into 'master'
Version 320 See merge request mohit.panjvani/crater-web!623
This commit is contained in:
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Crater\Listeners\Updates\v3;
|
|
||||||
|
|
||||||
use Crater\Listeners\Updates\Listener;
|
|
||||||
use Crater\Events\UpdateFinished;
|
|
||||||
use Crater\Setting;
|
|
||||||
use Crater\Currency;
|
|
||||||
use Artisan;
|
|
||||||
|
|
||||||
class Version320 extends Listener
|
|
||||||
{
|
|
||||||
const VERSION = '3.2.0';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle the event.
|
|
||||||
*
|
|
||||||
* @param UpdateFinished $event
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function handle(UpdateFinished $event)
|
|
||||||
{
|
|
||||||
if ($this->isListenerFired($event)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Artisan::call('migrate', ['--force' => true]);
|
|
||||||
|
|
||||||
// Update Crater app version
|
|
||||||
Setting::setSetting('version', static::VERSION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -14,7 +14,6 @@ use Crater\Listeners\Updates\v2\Version210;
|
|||||||
use Crater\Listeners\Updates\v3\Version300;
|
use Crater\Listeners\Updates\v3\Version300;
|
||||||
use Crater\Listeners\Updates\v3\Version310;
|
use Crater\Listeners\Updates\v3\Version310;
|
||||||
use Crater\Listeners\Updates\v3\Version311;
|
use Crater\Listeners\Updates\v3\Version311;
|
||||||
use Crater\Listeners\Updates\v3\Version320;
|
|
||||||
|
|
||||||
class EventServiceProvider extends ServiceProvider
|
class EventServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
@ -33,7 +32,6 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
Version300::class,
|
Version300::class,
|
||||||
Version310::class,
|
Version310::class,
|
||||||
Version311::class,
|
Version311::class,
|
||||||
Version320::class
|
|
||||||
],
|
],
|
||||||
Registered::class => [
|
Registered::class => [
|
||||||
SendEmailVerificationNotification::class,
|
SendEmailVerificationNotification::class,
|
||||||
|
|||||||
@ -17,9 +17,9 @@ class Updater
|
|||||||
$data = null;
|
$data = null;
|
||||||
if(env('APP_ENV') === 'development')
|
if(env('APP_ENV') === 'development')
|
||||||
{
|
{
|
||||||
$url = 'https://craterapp.com/downloads/check/latest/'. $installed_version . '?type=update&is_dev=1';
|
$url = 'downloads/check/latest/'. $installed_version . '?type=update&is_dev=1';
|
||||||
} else {
|
} else {
|
||||||
$url = 'https://craterapp.com/downloads/check/latest/'. $installed_version . '?type=update';
|
$url = 'downloads/check/latest/'. $installed_version . '?type=update';
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = static::getRemote($url, ['timeout' => 100, 'track_redirects' => true]);
|
$response = static::getRemote($url, ['timeout' => 100, 'track_redirects' => true]);
|
||||||
@ -30,7 +30,7 @@ class Updater
|
|||||||
|
|
||||||
$data = json_decode($data);
|
$data = json_decode($data);
|
||||||
|
|
||||||
if ($data->success && $data->version && $data->version->extensions) {
|
if ($data->success && $data->version && property_exists($data->version, 'extensions')) {
|
||||||
$extensions = $data->version->extensions;
|
$extensions = $data->version->extensions;
|
||||||
$extensionData = [];
|
$extensionData = [];
|
||||||
foreach (json_decode($extensions) as $extension) {
|
foreach (json_decode($extensions) as $extension) {
|
||||||
@ -49,9 +49,9 @@ class Updater
|
|||||||
$path = null;
|
$path = null;
|
||||||
|
|
||||||
if (env('APP_ENV') === 'development') {
|
if (env('APP_ENV') === 'development') {
|
||||||
$url = 'https://craterapp.com/downloads/file/' . $new_version . '?type=update&is_dev=1';
|
$url = 'downloads/file/' . $new_version . '?type=update&is_dev=1';
|
||||||
} else {
|
} else {
|
||||||
$url = 'https://craterapp.com/downloads/file/' . $new_version . '?type=update';
|
$url = 'downloads/file/' . $new_version . '?type=update';
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = static::getRemote($url, ['timeout' => 100, 'track_redirects' => true]);
|
$response = static::getRemote($url, ['timeout' => 100, 'track_redirects' => true]);
|
||||||
@ -118,7 +118,6 @@ class Updater
|
|||||||
|
|
||||||
public static function copyFiles($temp_extract_dir)
|
public static function copyFiles($temp_extract_dir)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!File::copyDirectory($temp_extract_dir . '/Crater', base_path())) {
|
if (!File::copyDirectory($temp_extract_dir . '/Crater', base_path())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -146,5 +145,4 @@ class Updater
|
|||||||
'data' => []
|
'data' => []
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Crater\Setting;
|
||||||
|
|
||||||
|
class UpdateCraterVersion320 extends Migration
|
||||||
|
{
|
||||||
|
const VERSION = '3.2.0';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Setting::setSetting('version', static::VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user