remove html_backup column from backups tables

This commit is contained in:
David Bomba 2022-11-07 08:52:06 +11:00
parent 18ce82ceed
commit 9c16c12ee9
4 changed files with 5 additions and 12 deletions

View File

@ -182,9 +182,7 @@ class ActivityController extends BaseController
} else {
$html_backup = file_get_contents(Storage::disk(config('filesystems.default'))->path($backup->filename));
}
} elseif ($backup && $backup->html_backup) { //db
$html_backup = $backup->html_backup;
} elseif (! $backup || ! $backup->html_backup) { //failed
} else { //failed
return response()->json(['message'=> ctrans('texts.no_backup_exists'), 'errors' => new stdClass], 404);
}

View File

@ -36,15 +36,11 @@ class Backup extends BaseModel
$filename = now()->format('Y_m_d').'_'.md5(time()).'.html';
$file_path = $path.$filename;
// Storage::disk(config('filesystems.default'))->makeDirectory($path, 0775);
Storage::disk(config('filesystems.default'))->put($file_path, $html);
// if (Storage::disk(config('filesystems.default'))->exists($file_path)) {
$this->html_backup = '';
$this->filename = $file_path;
$this->save();
// }
}
public function deleteFile()

View File

@ -60,7 +60,7 @@ class ActivityRepository extends BaseRepository
$activity->save();
//rate limiter
$this->createBackup($entity, $activity);
// $this->createBackup($entity, $activity);
}
/**
@ -83,7 +83,6 @@ class ActivityRepository extends BaseRepository
$backup = new Backup();
$entity->load('client');
$contact = $entity->client->primary_contact()->first();
$backup->html_backup = '';
$backup->amount = $entity->amount;
$backup->activity_id = $activity->id;
$backup->json_backup = '';

View File

@ -34,7 +34,7 @@ class InvoiceHistoryTransformer extends EntityTransformer
'id' => '',
'activity_id' => '',
'json_backup' => (string) '',
'html_backup' => (string) '',
'html_backup' => (string) '', //deprecated
'amount' => (float) 0,
'created_at' => (int) 0,
'updated_at' => (int) 0,
@ -45,7 +45,7 @@ class InvoiceHistoryTransformer extends EntityTransformer
'id' => $this->encodePrimaryKey($backup->id),
'activity_id' => $this->encodePrimaryKey($backup->activity_id),
'json_backup' => (string) '',
'html_backup' => (string) '',
'html_backup' => (string) '', //deprecated
'amount' => (float) $backup->amount,
'created_at' => (int) $backup->created_at,
'updated_at' => (int) $backup->updated_at,