remove listener & add version320 migration

This commit is contained in:
raishvaria
2020-12-02 12:23:30 +05:30
parent bafda5ca46
commit c2c0e2809c
3 changed files with 36 additions and 37 deletions

View File

@ -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);
}
}

View File

@ -17,9 +17,9 @@ class Updater
$data = null;
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 {
$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]);
@ -31,7 +31,7 @@ class Updater
$data = json_decode($data);
if ($data->success && $data->version && property_exists($data->version, 'extensions')) {
$extensions = $data->version->extensions ?? [];
$extensions = $data->version->extensions;
$extensionData = [];
foreach (json_decode($extensions) as $extension) {
$extensionData[$extension] = phpversion($extension) ? true : false;
@ -49,9 +49,9 @@ class Updater
$path = null;
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 {
$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]);

View File

@ -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()
{
//
}
}