mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Hosted Migration Filtering
This commit is contained in:
parent
76c4cc982f
commit
76631a7f59
@ -99,6 +99,7 @@ class ExportMigrations extends Command
|
|||||||
private function export($user)
|
private function export($user)
|
||||||
{
|
{
|
||||||
$this->account = $user->account;
|
$this->account = $user->account;
|
||||||
|
Auth::login($user);
|
||||||
|
|
||||||
$date = date('Y-m-d');
|
$date = date('Y-m-d');
|
||||||
$accountKey = $this->account->account_key;
|
$accountKey = $this->account->account_key;
|
||||||
|
@ -345,7 +345,12 @@ class AppController extends BaseController
|
|||||||
FROM information_schema.TABLES
|
FROM information_schema.TABLES
|
||||||
WHERE TABLE_NAME='clients' AND TABLE_SCHEMA='ninja'");
|
WHERE TABLE_NAME='clients' AND TABLE_SCHEMA='ninja'");
|
||||||
|
|
||||||
if (count($result) && $result[0]->engine == 'InnoDB') {
|
if(property_exists($result[0], 'engine'))
|
||||||
|
$engine = $result[0]->engine;
|
||||||
|
else
|
||||||
|
$engine = $result[0]->ENGINE;
|
||||||
|
|
||||||
|
if (count($result) && $engine == 'InnoDB') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ use App\Models\LookupProposalInvitation;
|
|||||||
use App\Models\LookupAccountToken;
|
use App\Models\LookupAccountToken;
|
||||||
use App\Models\LookupUser;
|
use App\Models\LookupUser;
|
||||||
use Auth;
|
use Auth;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
use Utils;
|
use Utils;
|
||||||
|
|
||||||
class MigrationLookup
|
class MigrationLookup
|
||||||
@ -21,9 +22,11 @@ class MigrationLookup
|
|||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//need to wrap an additional block over this to funnel users in a particular range
|
//need to wrap an additional block over this to funnel users in a particular range
|
||||||
|
if(auth()->user()->id >= config('ninja.migration_user_start') &&
|
||||||
|
auth()->user()->id <= config('ninja.migration_user_end') &&
|
||||||
|
(!auth()->user()->account->company->plan_expires || Carbon::parse(auth()->user()->account->company->plan_expires)->lt(now())))
|
||||||
|
{
|
||||||
if ($guard == 'user') {
|
if ($guard == 'user') {
|
||||||
|
|
||||||
if(request()->is('migration/*') || request()->is('settings/*')) {
|
if(request()->is('migration/*') || request()->is('settings/*')) {
|
||||||
@ -32,10 +35,14 @@ class MigrationLookup
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect('/settings/account_management');
|
return redirect('/settings/account_management')->with('warning','V4 is now disabled for your account. Please migrate.');
|
||||||
|
}
|
||||||
|
elseif(!auth()->user()->account->company->plan_expires || Carbon::parse(auth()->user()->account->company->plan_expires)->lt(now())){
|
||||||
|
session()->flash('warning','Please consider migrating to V5, V4 has entered end of life.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ class HostedMigration extends Job
|
|||||||
$localMigrationData['force'] = array_key_exists('force', $company);
|
$localMigrationData['force'] = array_key_exists('force', $company);
|
||||||
|
|
||||||
Storage::makeDirectory('migrations');
|
Storage::makeDirectory('migrations');
|
||||||
$file = Storage::path("migrations/{$fileName}.zip");
|
$file = Storage::path("app/migrations/{$fileName}.zip");
|
||||||
|
|
||||||
//$file = storage_path("migrations/{$fileName}.zip");
|
//$file = storage_path("migrations/{$fileName}.zip");
|
||||||
|
|
||||||
|
@ -48,5 +48,8 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
'ninja_hosted_secret' => env('NINJA_HOSTED_SECRET', false),
|
'ninja_hosted_secret' => env('NINJA_HOSTED_SECRET', false),
|
||||||
|
'migration_db' => env('MIGRATION_DB', DB_NINJA_1),
|
||||||
|
'migration_user_start' => env('MIGRATION_USER_START', 1),
|
||||||
|
'migration_user_end' => env('MIGRATION_USER_END', 1000),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user