Fix getCBPTableNames function calls

This commit is contained in:
DariusIII
2018-01-16 14:23:19 +01:00
parent 542dc6d225
commit dcfb090053
5 changed files with 25 additions and 11 deletions
+1
View File
@@ -1,4 +1,5 @@
2018-01-16 DariusIII
* Fix: Fix getCBPTableNames function calls
* Fix: Fix call to Releases
* Chg: Use Group model and remove nntmux\Groups class
* Chg: Update Books class processBookReleases function
+17 -3
View File
@@ -41,8 +41,22 @@ class Group extends Model
/**
* @var bool
*/
protected static $allasmgr = (int) Settings::settingValue('..allasmgr') === 1;
protected $allasmgr;
/**
* Group constructor.
*
* @throws \Exception
*/
public function __construct()
{
parent::__construct();
$this->allasmgr = (int) Settings::settingValue('..allasmgr') === 1;
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function release()
{
return $this->hasMany(Release::class, 'groups_id');
@@ -486,7 +500,7 @@ class Group extends Model
* @return array The table names.
* @throws \Exception
*/
public static function getCBPTableNames($groupID): array
public function getCBPTableNames($groupID): array
{
$groupKey = $groupID;
@@ -495,7 +509,7 @@ class Group extends Model
return self::$cbppTableNames[$groupKey];
}
if (NN_ECHOCLI && self::$allasmgr === false && self::createNewTPGTables($groupID) === false) {
if (NN_ECHOCLI && $this->allasmgr === false && self::createNewTPGTables($groupID) === false) {
exit('There is a problem creating new TPG tables for this group ID: '.$groupID.PHP_EOL);
}
+4 -4
View File
@@ -593,7 +593,7 @@ class Binaries
$this->notYEnc = $this->headersBlackListed = 0;
// Check if MySQL tables exist, create if they do not, get their names at the same time.
$this->tableNames = Group::getCBPTableNames($this->groupMySQL['id']);
$this->tableNames = (new Group())->getCBPTableNames($this->groupMySQL['id']);
$mgrPosters = $this->getMultiGroupPosters();
@@ -761,7 +761,7 @@ class Binaries
// Standard headers go second so we can switch tableNames back and do part repair to standard group tables
if (! empty($stdHeaders)) {
$this->tableNames = Group::getCBPTableNames($this->groupMySQL['id']);
$this->tableNames = (new Group())->getCBPTableNames($this->groupMySQL['id']);
$this->storeHeaders($stdHeaders, false);
}
unset($stdHeaders);
@@ -1126,7 +1126,7 @@ class Binaries
$tableNames = $tables;
if ($tableNames === '') {
$tableNames = Group::getCBPTableNames($groupArr['id']);
$tableNames = (new Group())->getCBPTableNames($groupArr['id']);
}
// Get all parts in partrepair table.
$missingParts = $this->_pdo->query(
@@ -1267,7 +1267,7 @@ class Binaries
$groupID = Group::getIDByName($groupData['group']);
$group = [];
if ($groupID !== '') {
$group = Group::getCBPTableNames($groupID);
$group = (new Group())->getCBPTableNames($groupID);
}
$currentPost = $post;
+1 -1
View File
@@ -183,7 +183,7 @@ class Regexes
return [];
}
$tableNames = Group::getCBPTableNames($groupID);
$tableNames = (new Group())->getCBPTableNames($groupID);
$rows = $this->pdo->query(
sprintf(
+2 -3
View File
@@ -493,12 +493,11 @@ class ProcessReleases
/**
* @param $groupID
*
* @void
* @throws \Exception
*/
protected function initiateTableNames($groupID): void
{
$this->tables = Group::getCBPTableNames($groupID);
$this->tables = (new Group())->getCBPTableNames($groupID);
}
/**