Use function to delete releases with bad or missing nzbs

This commit is contained in:
DariusIII
2019-03-14 15:26:08 +01:00
parent c43a229f07
commit 4665f2fec5
2 changed files with 16 additions and 3 deletions
@@ -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
+1
View File
@@ -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