mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-14 08:44:06 +00:00
Set app version on install and updates
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\V1\Installation;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\DatabaseEnvironmentRequest;
|
||||
use App\Space\EnvironmentManager;
|
||||
use App\Space\InstallUtils;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
@@ -34,6 +35,8 @@ class DatabaseConfigurationController extends Controller
|
||||
Artisan::call('cache:clear');
|
||||
Artisan::call('storage:link');
|
||||
Artisan::call('migrate --seed --force');
|
||||
// Set version.
|
||||
InstallUtils::setCurrentVersion();
|
||||
}
|
||||
|
||||
return response()->json($results);
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Space;
|
||||
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use League\Flysystem\FilesystemException;
|
||||
|
||||
@@ -89,4 +91,18 @@ class InstallUtils
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the app version
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function setCurrentVersion()
|
||||
{
|
||||
$version = preg_replace('~[\r\n]+~', '', File::get(base_path('version.md')));
|
||||
if (! $version) {
|
||||
return;
|
||||
}
|
||||
Setting::setSetting('version', $version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Space;
|
||||
|
||||
use App\Events\UpdateFinished;
|
||||
use App\Models\Setting;
|
||||
use Artisan;
|
||||
use File;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
@@ -138,6 +139,7 @@ class Updater
|
||||
|
||||
public static function finishUpdate($installed, $version)
|
||||
{
|
||||
Setting::setSetting('version', $version);
|
||||
event(new UpdateFinished($installed, $version));
|
||||
|
||||
return [
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Database\Seeders;
|
||||
use App\Models\Company;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use App\Space\InstallUtils;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Silber\Bouncer\BouncerFacade;
|
||||
use Vinkla\Hashids\Facades\Hashids;
|
||||
@@ -38,5 +39,7 @@ class UsersTableSeeder extends Seeder
|
||||
$user->assign('super admin');
|
||||
|
||||
Setting::setSetting('profile_complete', 0);
|
||||
// Set version.
|
||||
InstallUtils::setCurrentVersion();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user