mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-09-01 10:48:53 +00:00
Move error message to disableIfNotExist function.
This commit is contained in:
@@ -259,12 +259,7 @@ class Binaries
|
||||
if ($this->_nntp->isError($groupNNTP)) {
|
||||
$groupNNTP = $this->_nntp->dataError($this->_nntp, $groupMySQL['name']);
|
||||
if ($groupNNTP->code == 411) {
|
||||
$this->_groups->disableIfNotExist($groupMySQL['name']);
|
||||
$this->_colorCLI->doEcho(
|
||||
$this->_colorCLI->error(
|
||||
'Group ' . $groupMySQL['name'] . ' does not exist on server, disabling'
|
||||
)
|
||||
);
|
||||
$this->_groups->disableIfNotExist($groupMySQL['id']);
|
||||
}
|
||||
if ($this->_nntp->isError($groupNNTP)) {
|
||||
return;
|
||||
|
||||
@@ -21,11 +21,13 @@ class Groups
|
||||
public function __construct(array $options = [])
|
||||
{
|
||||
$defaults = [
|
||||
'Settings' => null
|
||||
'Settings' => null,
|
||||
'ColorCLI' => null
|
||||
];
|
||||
$options += $defaults;
|
||||
|
||||
$this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings());
|
||||
$this->colorCLI = ($options['ColorCLI'] instanceof \ColorCLI ? $options['ColorCLI'] : new \ColorCLI());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -682,13 +684,17 @@ class Groups
|
||||
|
||||
/**
|
||||
* @note Disable group that does not exist on USP server
|
||||
* @param string $groupname
|
||||
* @param $id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function disableIfNotExist($groupname)
|
||||
public function disableIfNotExist($id)
|
||||
{
|
||||
$id = $this->getIDByName($groupname);
|
||||
$this->pdo->queryExec(sprintf("UPDATE groups SET active = 0 WHERE id = %d", $id));
|
||||
$this->colorCLI->doEcho(
|
||||
$this->colorCLI->error(
|
||||
'Group does not exist on server, disabling'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user