mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -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\Models\Backup;
|
||||
use App\Models\Company;
|
||||
use App\Models\Design;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
@ -25,14 +26,14 @@ class BackupUpdate extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'ninja:backup-update';
|
||||
protected $signature = 'ninja:backup-files {--disk=}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Shift backups from DB to storage';
|
||||
protected $description = 'Shift files between object storage locations';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
@ -74,17 +75,30 @@ class BackupUpdate extends Command
|
||||
{
|
||||
set_time_limit(0);
|
||||
|
||||
Backup::whereHas('activity')->whereRaw('html_backup IS NOT NULL')->cursor()->each(function ($backup) {
|
||||
if (strlen($backup->html_backup) > 1 && $backup->activity->invoice->exists()) {
|
||||
$client = $backup->activity->invoice->client;
|
||||
$backup->storeRemotely($backup->html_backup, $client);
|
||||
} elseif (strlen($backup->html_backup) > 1 && $backup->activity->quote->exists()) {
|
||||
$client = $backup->activity->quote->client;
|
||||
$backup->storeRemotely($backup->html_backup, $client);
|
||||
} elseif (strlen($backup->html_backup) > 1 && $backup->activity->credit->exists()) {
|
||||
$client = $backup->activity->credit->client;
|
||||
$backup->storeRemotely($backup->html_backup, $client);
|
||||
}
|
||||
});
|
||||
//logos
|
||||
|
||||
Company::query()
|
||||
->cursor()
|
||||
->each(function ($company){
|
||||
|
||||
$logo = @file_get_contents($company->present()->logo());
|
||||
|
||||
if($logo){
|
||||
|
||||
$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']))
|
||||
$this->phone_has_changed = true;
|
||||
|
||||
if(array_key_exists('oauth_provider_id', $input) && $input['oauth_provider_id'] == '')
|
||||
$input['oauth_user_id'] = '';
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
|
||||
|
@ -56,8 +56,8 @@ class UserRepository extends BaseRepository
|
||||
$company = auth()->user()->company();
|
||||
$account = $company->account;
|
||||
|
||||
if(array_key_exists('oauth_provider_id', $details))
|
||||
unset($details['oauth_provider_id']);
|
||||
// if(array_key_exists('oauth_provider_id', $details))
|
||||
// unset($details['oauth_provider_id']);
|
||||
|
||||
if (request()->has('validated_phone'))
|
||||
$details['phone'] = request()->input('validated_phone');
|
||||
|
Loading…
x
Reference in New Issue
Block a user