diff --git a/Blacklight/processing/post/ProcessAdditional.php b/Blacklight/processing/post/ProcessAdditional.php index 15028c5ad..2f4f12f96 100755 --- a/Blacklight/processing/post/ProcessAdditional.php +++ b/Blacklight/processing/post/ProcessAdditional.php @@ -804,6 +804,7 @@ class ProcessAdditional * Get list of contents inside a release's NZB file. * * @return bool + * @throws \Exception */ protected function _getNZBContents(): bool { @@ -811,14 +812,14 @@ class ProcessAdditional if ($nzbPath === false) { $this->_echo('NZB not found for GUID: '.$this->_release->guid.', deleting the release.', 'warning'); - Release::query()->where('guid', $this->_release->guid)->delete(); + $this->_deleteRelease(); } $nzbContents = Utility::unzipGzipFile($nzbPath); if (! $nzbContents) { $this->_echo('NZB is empty or broken for GUID: '.$this->_release->guid.', deleting the release.', 'warning'); - Release::query()->where('guid', $this->_release->guid)->delete(); + $this->_deleteRelease(); } // Get a list of files in the nzb. @@ -826,7 +827,7 @@ class ProcessAdditional if (\count($this->_nzbContents) === 0) { $this->_echo('NZB is potentially broken for GUID: '.$this->_release->guid.', deleting the release.', 'warning'); - Release::query()->where('guid', $this->_release->guid)->delete(); + $this->_deleteRelease(); } // Sort keys. ksort($this->_nzbContents, SORT_NATURAL); @@ -846,6 +847,17 @@ class ProcessAdditional return false; } + /** + * @return bool + * @throws \Exception + */ + protected function _deleteRelease(): bool + { + Release::whereId($this->_release->id)->delete(); + + return false; + } + /** * Current file we are working on inside a NZB. * @var array diff --git a/Changelog b/Changelog index 4ff5371a5..04cd602bb 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2019-03-14 DariusIII + * Chg: Use function to delete releases with bad or missing nzbs * Chg: Delete releases that report missing, broken or empty nzbs on PPA stage * Fix: Fix resetting groups in admin area * Chg: Update package.json