mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Export 'company_key' with migrations (#3600)
- Removed 'Hosted' option for migrating - Passing companyKey property when sending request
This commit is contained in:
parent
0c7620a381
commit
602a15f648
@ -155,11 +155,12 @@ class StepsController extends BaseController
|
||||
return redirect($this->access['companies']['redirect']);
|
||||
|
||||
foreach ($request->companies as $company) {
|
||||
$completeService = (new CompleteService(session('MIGRATION_ACCOUNT_TOKEN')))
|
||||
(new CompleteService(session('MIGRATION_ACCOUNT_TOKEN')))
|
||||
->file($this->getMigrationFile())
|
||||
->force(array_key_exists('force', $company))
|
||||
->company($company['id'])
|
||||
->endpoint(session('MIGRATION_ENDPOINT'))
|
||||
->companyKey($company['key'])
|
||||
->start();
|
||||
}
|
||||
|
||||
@ -223,7 +224,7 @@ class StepsController extends BaseController
|
||||
'client_gateway_tokens' => $this->getClientGatewayTokens(),
|
||||
];
|
||||
|
||||
$file = storage_path("{$fileName}.zip");
|
||||
$file = storage_path("migrations/{$fileName}.zip");
|
||||
|
||||
$zip = new \ZipArchive();
|
||||
$zip->open($file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
|
||||
|
@ -16,7 +16,7 @@ class CompleteService
|
||||
protected $errors = [];
|
||||
protected $isSuccessful;
|
||||
protected $force = false;
|
||||
|
||||
protected $companyKey;
|
||||
|
||||
public function __construct(string $token)
|
||||
{
|
||||
@ -51,11 +51,19 @@ class CompleteService
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function companyKey(string $key)
|
||||
{
|
||||
$this->companyKey = $key;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function start()
|
||||
{
|
||||
$body = [
|
||||
'migration' => \Unirest\Request\Body::file($this->file, 'application/zip'),
|
||||
'force' => $this->force,
|
||||
'company_key' => $this->companyKey,
|
||||
];
|
||||
|
||||
$response = Request::post($this->getUrl(), $this->getHeaders(), $body);
|
||||
|
@ -24,6 +24,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="checkbox" name="companies[{{ $company->id }}][force]">
|
||||
<input type="hidden" name="companies[{{ $company->id }}][key]" value="{{ $company->company_key }}">
|
||||
<label for="force">Force migration</label>
|
||||
<small>* All current company data will be wiped.</small>
|
||||
</div>
|
||||
|
@ -12,15 +12,15 @@
|
||||
<h4>In order to start the migration, we need to know where do you want to migrate.</h4><br/>
|
||||
<form action="/migration/type" method="post" id="select-type-form">
|
||||
{{ csrf_field() }}
|
||||
<div class="form-check">
|
||||
<!-- <div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="option" id="option1" value="0" checked>
|
||||
<label class="form-check-label" for="option1">
|
||||
Hosted
|
||||
</label>
|
||||
<p>If you chose 'hosted', we will migrate your data to official Invoice Ninja servers & take care of server handling.</p>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="option" id="option2" value="1">
|
||||
<input class="form-check-input" type="radio" name="option" id="option2" value="1" checked">
|
||||
<label class="form-check-label" for="option2">
|
||||
Self-hosted
|
||||
</label>
|
||||
|
Loading…
x
Reference in New Issue
Block a user