Update NZBImport to add missing groups, not ignore them when importing nzbs.

This commit is contained in:
Darko
2015-06-15 08:59:01 +02:00
parent e595d81308
commit f6a0b5342e
+21
View File
@@ -83,6 +83,13 @@ class NZBImport
*/
public $nzb;
/**
* Access point to add new groups.
*
* @var Groups $groups
*/
private $groups;
/**
* Construct.
*
@@ -115,6 +122,7 @@ class NZBImport
$this->crossPostt = ($this->pdo->getSetting('crossposttime') != '') ? $this->pdo->getSetting('crossposttime') : 2;
$this->browser = $options['Browser'];
$this->retVal = '';
$this->groups = new Groups(['Settings' => $this->pdo]);
}
/**
@@ -289,6 +297,19 @@ class NZBImport
if (!$groupName) {
$groupName = $group;
}
} else {
$groupID = $this->groups->add([
'name' => $group,
'description' => 'Added by NZBimport script.',
'backfill_target' => 0,
'first_record' => 0,
'last_record' => 0,
'active' => 0,
'backfill' => 0
]);
$this->allGroups[$group] = $groupID;
$this->echoOut("Adding missing group: ($group)");
}
}
// Add all the found groups to an array.