From fdfac50423f465f8a8c53ed43d1f41f6ec61270d Mon Sep 17 00:00:00 2001 From: Gerhard Jungwirth Date: Tue, 29 Sep 2015 10:36:48 +0200 Subject: [PATCH] MT#15425 audio_cache reload on soundfile delete Change-Id: I1634c0de4a4e13c52b54e04b9177962591d862d0 --- lib/NGCP/Panel/Controller/API/SoundFilesItem.pm | 8 ++++++++ lib/NGCP/Panel/Controller/Sound.pm | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/NGCP/Panel/Controller/API/SoundFilesItem.pm b/lib/NGCP/Panel/Controller/API/SoundFilesItem.pm index 63bd30906e..e5f7389b0b 100644 --- a/lib/NGCP/Panel/Controller/API/SoundFilesItem.pm +++ b/lib/NGCP/Panel/Controller/API/SoundFilesItem.pm @@ -135,6 +135,14 @@ sub DELETE :Allow { $guard->commit; + # clear audio caches + my $group_name = $item->handle->group->name; + try { + NGCP::Panel::Utils::Sems::clear_audio_cache($c, $item->set_id, $item->handle->name, $group_name); + } catch ($e) { + $c->log->warn("Failed to clear audio cache for group " . $group_name); + } + $c->response->status(HTTP_NO_CONTENT); $c->response->body(q()); } diff --git a/lib/NGCP/Panel/Controller/Sound.pm b/lib/NGCP/Panel/Controller/Sound.pm index 6b3d5aa1b4..4dac355791 100644 --- a/lib/NGCP/Panel/Controller/Sound.pm +++ b/lib/NGCP/Panel/Controller/Sound.pm @@ -670,6 +670,16 @@ sub handles_delete :Chained('handles_base') :PathPart('delete') { desc => $c->loc('Failed to delete sound handle'), ); }; + + # clear audio caches + my $handle = $c->stash->{file_result}->handle; + my $group_name = $handle->group->name; + try { + NGCP::Panel::Utils::Sems::clear_audio_cache($c, $c->stash->{file_result}->set_id, $handle->name, $group_name); + } catch ($e) { + $c->log->warn("Failed to clear audio cache for group " . $group_name); + } + NGCP::Panel::Utils::Navigation::back_or($c, $c->stash->{handles_base_uri}); return; }