mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Use function to delete releases with bad or missing nzbs
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user