mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 05:04:35 -04:00
clean up for user
This commit is contained in:
parent
f1682ca122
commit
18ce82ceed
@ -13,6 +13,7 @@ namespace App\Console\Commands;
|
|||||||
|
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
use App\Models\Backup;
|
use App\Models\Backup;
|
||||||
|
use App\Models\Company;
|
||||||
use App\Models\Design;
|
use App\Models\Design;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
@ -25,14 +26,14 @@ class BackupUpdate extends Command
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'ninja:backup-update';
|
protected $signature = 'ninja:backup-files {--disk=}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $description = 'Shift backups from DB to storage';
|
protected $description = 'Shift files between object storage locations';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
@ -74,17 +75,30 @@ class BackupUpdate extends Command
|
|||||||
{
|
{
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
Backup::whereHas('activity')->whereRaw('html_backup IS NOT NULL')->cursor()->each(function ($backup) {
|
//logos
|
||||||
if (strlen($backup->html_backup) > 1 && $backup->activity->invoice->exists()) {
|
|
||||||
$client = $backup->activity->invoice->client;
|
Company::query()
|
||||||
$backup->storeRemotely($backup->html_backup, $client);
|
->cursor()
|
||||||
} elseif (strlen($backup->html_backup) > 1 && $backup->activity->quote->exists()) {
|
->each(function ($company){
|
||||||
$client = $backup->activity->quote->client;
|
|
||||||
$backup->storeRemotely($backup->html_backup, $client);
|
$logo = @file_get_contents($company->present()->logo());
|
||||||
} elseif (strlen($backup->html_backup) > 1 && $backup->activity->credit->exists()) {
|
|
||||||
$client = $backup->activity->credit->client;
|
if($logo){
|
||||||
$backup->storeRemotely($backup->html_backup, $client);
|
|
||||||
}
|
$path = str_replace("https://object.invoicing.co/", "", $company->present()->logo());
|
||||||
});
|
$path = str_replace("https://v5-at-backup.us-southeast-1.linodeobjects.com/", "", $path);
|
||||||
|
|
||||||
|
Storage::disk($this->option('disk'))->put($path, $logo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//documents
|
||||||
|
|
||||||
|
|
||||||
|
//backups
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,9 @@ class UpdateUserRequest extends Request
|
|||||||
if(array_key_exists('phone', $input) && strlen($input['phone']) > 1 && ($this->user->phone != $input['phone']))
|
if(array_key_exists('phone', $input) && strlen($input['phone']) > 1 && ($this->user->phone != $input['phone']))
|
||||||
$this->phone_has_changed = true;
|
$this->phone_has_changed = true;
|
||||||
|
|
||||||
|
if(array_key_exists('oauth_provider_id', $input) && $input['oauth_provider_id'] == '')
|
||||||
|
$input['oauth_user_id'] = '';
|
||||||
|
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ class UserRepository extends BaseRepository
|
|||||||
$company = auth()->user()->company();
|
$company = auth()->user()->company();
|
||||||
$account = $company->account;
|
$account = $company->account;
|
||||||
|
|
||||||
if(array_key_exists('oauth_provider_id', $details))
|
// if(array_key_exists('oauth_provider_id', $details))
|
||||||
unset($details['oauth_provider_id']);
|
// unset($details['oauth_provider_id']);
|
||||||
|
|
||||||
if (request()->has('validated_phone'))
|
if (request()->has('validated_phone'))
|
||||||
$details['phone'] = request()->input('validated_phone');
|
$details['phone'] = request()->input('validated_phone');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user