Push changes that support creations of service packs and basic listing
This commit is contained in:
parent
1f47eda3b3
commit
a1bc6fa2d3
15 changed files with 654 additions and 49 deletions
|
@ -101,6 +101,8 @@ class Service
|
|||
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
Storage::deleteDirectory('services/' . $service->file);
|
||||
|
||||
Models\ServiceVariables::whereIn('option_id', $options->get()->toArray())->delete();
|
||||
$options->delete();
|
||||
$service->delete();
|
||||
|
@ -128,23 +130,10 @@ class Service
|
|||
$filepath = 'services/' . $service->file . '/' . $filename;
|
||||
$backup = 'services/.bak/' . str_random(12) . '.bak';
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
Storage::move($filepath, $backup);
|
||||
Storage::put($filepath, $data['contents']);
|
||||
|
||||
$checksum = Models\Checksum::firstOrNew([
|
||||
'service' => $service->id,
|
||||
'filename' => $filename
|
||||
]);
|
||||
|
||||
$checksum->checksum = sha1_file(storage_path('app/' . $filepath));
|
||||
$checksum->save();
|
||||
|
||||
DB::commit();
|
||||
} catch(\Exception $ex) {
|
||||
DB::rollback();
|
||||
Storage::move($backup, $filepath);
|
||||
throw $ex;
|
||||
}
|
||||
|
|
Reference in a new issue