Add mgr switch

This commit is contained in:
DariusIII
2016-12-29 09:18:54 +01:00
parent 8c6e0d53fc
commit 2bc0acbe6d
2 changed files with 16 additions and 7 deletions
+15 -6
View File
@@ -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);
+1 -1
View File
@@ -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");