From 2bc0acbe6d968c8a7349fbe63777b4e216634b0f Mon Sep 17 00:00:00 2001 From: DariusIII Date: Thu, 29 Dec 2016 09:18:54 +0100 Subject: [PATCH] Add mgr switch --- nntmux/NZB.php | 21 +++++++++++++++------ nntmux/ReleasesMultiGroup.php | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/nntmux/NZB.php b/nntmux/NZB.php index 3857334e2..376ba4cc8 100755 --- a/nntmux/NZB.php +++ b/nntmux/NZB.php @@ -222,7 +222,7 @@ class NZB * * @access public */ - public function writeNZBforReleaseId($relID, $relGuid, $name, $cTitle) + public function writeNZBforReleaseId($relID, $relGuid, $name, $cTitle, $multigroup = false) { $collections = $this->pdo->queryDirect($this->_collectionsQuery . $relID); @@ -320,12 +320,21 @@ class NZB ) ); // Delete CBP for release that has its NZB created. - $this->pdo->queryExec( - sprintf(' + if ($multigroup === true) { + $this->pdo->queryExec( + sprintf(' DELETE c, b, p FROM %s c JOIN %s b ON(c.id=b.collection_id) STRAIGHT_JOIN %s p ON(b.id=p.binaryid) WHERE c.releaseid = %d', - $this->_tableNames['cName'], $this->_tableNames['bName'], $this->_tableNames['pName'], $relID - ) - ); + $this->_tableNames['mgrcName'], $this->_tableNames['mgrbName'], $this->_tableNames['mgrpName'], $relID + ) + ); + } else { + $this->pdo->queryExec( + sprintf(' + DELETE c, b, p FROM %s c JOIN %s b ON(c.id=b.collection_id) STRAIGHT_JOIN %s p ON(b.id=p.binaryid) WHERE c.releaseid = %d', + $this->_tableNames['cName'], $this->_tableNames['bName'], $this->_tableNames['pName'], $relID + ) + ); + } // Chmod to fix issues some users have with file permissions. chmod($path, 0777); diff --git a/nntmux/ReleasesMultiGroup.php b/nntmux/ReleasesMultiGroup.php index 2b443558c..41b63c660 100644 --- a/nntmux/ReleasesMultiGroup.php +++ b/nntmux/ReleasesMultiGroup.php @@ -305,7 +305,7 @@ class ReleasesMultiGroup $this->nzb->initiateForWrite('', true); foreach ($releases as $release) { - if ($this->nzb->writeNZBforReleaseId($release['id'], $release['guid'], $release['name'], $release['title']) === true) { + if ($this->nzb->writeNZBforReleaseId($release['id'], $release['guid'], $release['name'], $release['title'], true) === true) { $nzbCount++; if ($this->echoCLI) { echo $this->_pdo->log->primaryOver("Creating NZBs and deleting Collections:\t" . $nzbCount . '/' . $total . "\r");