tableMain} (title, nfo, size, files, filename, nuked, nukereason, category, predate, SOURCE, requestid, groupid)
- SELECT pi.title, pi.nfo, pi.size, pi.files, pi.filename, pi.nuked, pi.nukereason, pi.category, pi.predate, pi.source, pi.requestid, groupid
+INSERT INTO {$this->tableMain} (title, nfo, size, files, filename, nuked, nukereason, category, predate, SOURCE, requestid, groups_id)
+ SELECT pi.title, pi.nfo, pi.size, pi.files, pi.filename, pi.nuked, pi.nukereason, pi.category, pi.predate, pi.source, pi.requestid, groups_id
FROM predb_imports AS pi
ON DUPLICATE KEY UPDATE predb.nfo = IF(predb.nfo IS NULL, pi.nfo, predb.nfo),
predb.size = IF(predb.size IS NULL, pi.size, predb.size),
@@ -251,7 +251,7 @@ INSERT INTO {$this->tableMain} (title, nfo, size, files, filename, nuked, nukere
predb.nukereason = IF(pi.nuked > 0, pi.nukereason, predb.nukereason),
predb.category = IF(predb.category IS NULL, pi.category, predb.category),
predb.requestid = IF(predb.requestid = 0, pi.requestid, predb.requestid),
- predb.groupid = IF(predb.groupid = 0, pi.groupid, predb.groupid);
+ predb.groups_id = IF(predb.groups_id = 0, pi.groups_id, predb.groups_id);
SQL_INSERT;
$this->prepareSQLStatement($sql, 'Insert');
@@ -295,7 +295,7 @@ SQL_LOAD_DATA;
protected function prepareSQLUpdateGroupIDs()
{
- $sql = "UPDATE predb_imports AS pi SET groupid = (SELECT id FROM groups WHERE name = pi.groupname) WHERE groupname IS NOT NULL";
+ $sql = "UPDATE predb_imports AS pi SET groups_id = (SELECT id FROM groups WHERE name = pi.groupname) WHERE groupname IS NOT NULL";
$this->prepareSQLStatement($sql, 'UpdateGroupID');
}
}
diff --git a/newznab/libraries/Forking.php b/newznab/libraries/Forking.php
index fcf2621f9..a8f4d6be7 100644
--- a/newznab/libraries/Forking.php
+++ b/newznab/libraries/Forking.php
@@ -928,7 +928,7 @@ class Forking extends \fork_daemon
sprintf('
SELECT DISTINCT(g.id)
FROM groups g
- INNER JOIN releases r ON r.groupid = g.id
+ INNER JOIN releases r ON r.groups_id = g.id
WHERE g.active = 1
AND r.nzbstatus = %d
AND r.predb_id = 0
diff --git a/newznab/processing/PostProcess.php b/newznab/processing/PostProcess.php
index e37637a79..439554d0b 100755
--- a/newznab/processing/PostProcess.php
+++ b/newznab/processing/PostProcess.php
@@ -339,7 +339,7 @@ class PostProcess
$query = $this->pdo->queryOneRow(
sprintf('
- SELECT id, groupid, categories_id, name, searchname, UNIX_TIMESTAMP(postdate) AS post_date, id AS releases_id
+ SELECT id, groups_id, categories_id, name, searchname, UNIX_TIMESTAMP(postdate) AS post_date, id AS releases_id
FROM releases
WHERE isrenamed = 0
AND id = %d',
@@ -470,12 +470,12 @@ class PostProcess
$query = $this->pdo->queryOneRow(
sprintf('
SELECT
- r.id, r.groupid, r.categories_id, r.name, r.searchname,
+ r.id, r.groups_id, r.categories_id, r.name, r.searchname,
UNIX_TIMESTAMP(r.postdate) AS post_date,
r.id AS releases_id,
g.name AS groupname
FROM releases r
- LEFT JOIN groups g ON r.groupid = g.id
+ LEFT JOIN groups g ON r.groups_id = g.id
WHERE r.isrenamed = 0
AND r.predb_id = 0
AND r.id = %d',
diff --git a/newznab/processing/ProcessReleases.php b/newznab/processing/ProcessReleases.php
index fed8c311e..d6ed48716 100644
--- a/newznab/processing/ProcessReleases.php
+++ b/newznab/processing/ProcessReleases.php
@@ -271,11 +271,11 @@ class ProcessReleases
{
$cat = new Categorize(['Settings' => $this->pdo]);
$categorized = $total = 0;
- $releases = $this->pdo->queryDirect(sprintf('SELECT id, %s, groupid FROM releases %s', $type, $where));
+ $releases = $this->pdo->queryDirect(sprintf('SELECT id, %s, groups_id FROM releases %s', $type, $where));
if ($releases && $releases->rowCount()) {
$total = $releases->rowCount();
foreach ($releases as $release) {
- $catId = $cat->determineCategory($release['groupid'], $release[$type]);
+ $catId = $cat->determineCategory($release['groups_id'], $release[$type]);
$this->pdo->queryExec(
sprintf('UPDATE releases SET categories_id = %d, iscategorized = 1 WHERE id = %d', $catId, $release['id'])
);
@@ -611,7 +611,7 @@ class ProcessReleases
'name' => $cleanRelName,
'searchname' => $this->pdo->escapeString(utf8_encode($cleanedName)),
'totalpart' => $collection['totalfiles'],
- 'groupid' => $collection['group_id'],
+ 'groups_id' => $collection['group_id'],
'guid' => $this->pdo->escapeString($this->releases->createGUID()),
'postdate' => $this->pdo->escapeString($collection['date']),
'fromname' => $fromName,
@@ -701,7 +701,7 @@ class ProcessReleases
INNER JOIN categories c ON r.categories_id = c.id
INNER JOIN categories cp ON cp.id = c.parentid
WHERE %s nzbstatus = 0",
- (!empty($groupID) ? ' r.groupid = ' . $groupID . ' AND ' : ' ')
+ (!empty($groupID) ? ' r.groups_id = ' . $groupID . ' AND ' : ' ')
)
);
@@ -820,7 +820,7 @@ class ProcessReleases
$this->categorizeRelease(
$type,
(!empty($groupID)
- ? 'WHERE categories_id = ' . Category::OTHER_MISC . ' AND iscategorized = 0 AND groupid = ' . $groupID
+ ? 'WHERE categories_id = ' . Category::OTHER_MISC . ' AND iscategorized = 0 AND groups_id = ' . $groupID
: 'WHERE categories_id = ' . Category::OTHER_MISC . ' AND iscategorized = 0')
);
@@ -1091,8 +1091,8 @@ class ProcessReleases
sprintf("
SELECT r.guid, r.id
FROM releases r
- INNER JOIN groups g ON g.id = r.groupid
- WHERE r.groupid = %d
+ INNER JOIN groups g ON g.id = r.groups_id
+ WHERE r.groups_id = %d
AND greatest(IFNULL(g.minsizetoformrelease, 0), %d) > 0
AND r.size < greatest(IFNULL(g.minsizetoformrelease, 0), %d)",
$groupID['id'],
@@ -1112,7 +1112,7 @@ class ProcessReleases
sprintf('
SELECT id, guid
FROM releases
- WHERE groupid = %d
+ WHERE groups_id = %d
AND size > %d',
$groupID['id'],
$maxSizeSetting
@@ -1130,8 +1130,8 @@ class ProcessReleases
sprintf("
SELECT r.id, r.guid
FROM releases r
- INNER JOIN groups g ON g.id = r.groupid
- WHERE r.groupid = %d
+ INNER JOIN groups g ON g.id = r.groups_id
+ WHERE r.groups_id = %d
AND greatest(IFNULL(g.minfilestoformrelease, 0), %d) > 0
AND r.totalpart < greatest(IFNULL(g.minfilestoformrelease, 0), %d)",
$groupID['id'],
diff --git a/newznab/processing/post/ProcessAdditional.php b/newznab/processing/post/ProcessAdditional.php
index 7061f594f..2943decab 100644
--- a/newznab/processing/post/ProcessAdditional.php
+++ b/newznab/processing/post/ProcessAdditional.php
@@ -613,7 +613,7 @@ class ProcessAdditional
{
$this->_releases = $this->pdo->query(
sprintf('
- SELECT r.id, r.id AS releases_id, r.guid, r.name, r.size, r.groupid, r.nfostatus,
+ SELECT r.id, r.id AS releases_id, r.guid, r.name, r.size, r.groups_id, r.nfostatus,
r.completion, r.categories_id, r.searchname, r.predb_id,
c.disablepreview
FROM releases r
@@ -627,7 +627,7 @@ class ProcessAdditional
LIMIT %d',
$this->_maxSize,
$this->_minSize,
- ($groupID === '' ? '' : 'AND r.groupid = ' . $groupID),
+ ($groupID === '' ? '' : 'AND r.groups_id = ' . $groupID),
($guidChar === '' ? '' : 'AND r.leftguid = ' . $this->pdo->escapeString($guidChar)),
$this->_queryLimit
)
@@ -1745,7 +1745,7 @@ class ProcessAdditional
// Make sure the category is music or other.
$rQuery = $this->pdo->queryOneRow(
sprintf(
- 'SELECT searchname, categories_id AS id, groupid FROM releases WHERE proc_pp = 0 AND id = %d',
+ 'SELECT searchname, categories_id AS id, groups_id FROM releases WHERE proc_pp = 0 AND id = %d',
$this->_release['id']
)
);
@@ -1802,7 +1802,7 @@ class ProcessAdditional
} else if ($ext === 'FLAC') {
$newCat = Category::MUSIC_LOSSLESS;
} else {
- $newCat = $this->_categorize->determineCategory($rQuery['groupid'], $newName);
+ $newCat = $this->_categorize->determineCategory($rQuery['groups_id'], $newName);
}
$newTitle = $this->pdo->escapeString(substr($newName, 0, 255));
@@ -1828,7 +1828,7 @@ class ProcessAdditional
'old_name' => $rQuery['searchname'],
'new_category' => $newCat,
'old_category' => $rQuery['id'],
- 'group' => $rQuery['groupid'],
+ 'group' => $rQuery['groups_id'],
'release_id' => $this->_release['id'],
'method' => 'ProcessAdditional->_getAudioInfo'
]
@@ -2390,7 +2390,7 @@ class ProcessAdditional
}
// Get a new category ID.
- $newCategory = $this->_categorize->determineCategory($this->_release['groupid'], $newName);
+ $newCategory = $this->_categorize->determineCategory($this->_release['groups_id'], $newName);
$newTitle = $this->pdo->escapeString(substr($newName, 0, 255));
// Update the release with the data.
@@ -2416,7 +2416,7 @@ class ProcessAdditional
'old_name' => $this->_release['searchname'],
'new_category' => $newCategory,
'old_category' => $this->_release['categories_id'],
- 'group' => $this->_release['groupid'],
+ 'group' => $this->_release['groups_id'],
'release_id' => $this->_release['id'],
'method' => 'ProcessAdditional->_processU4ETitle'
]
@@ -2530,7 +2530,7 @@ class ProcessAdditional
$this->_passwordStatus = [Releases::PASSWD_NONE];
$this->_releaseHasPassword = false;
- $this->_releaseGroupName = $this->_groups->getByNameByID($this->_release['groupid']);
+ $this->_releaseGroupName = $this->_groups->getByNameByID($this->_release['groups_id']);
$this->_releaseHasNoNFO = false;
// Make sure we don't already have an nfo.
diff --git a/newznab/processing/tv/TV.php b/newznab/processing/tv/TV.php
index 613d709e0..d48fcfdcf 100644
--- a/newznab/processing/tv/TV.php
+++ b/newznab/processing/tv/TV.php
@@ -158,7 +158,7 @@ abstract class TV extends Videos
LIMIT %d",
$status,
$this->catWhere,
- ($groupID === '' ? '' : 'AND r.groupid = ' . $groupID),
+ ($groupID === '' ? '' : 'AND r.groups_id = ' . $groupID),
($guidChar === '' ? '' : 'AND r.leftguid = ' . $this->pdo->escapeString($guidChar)),
($lookupSetting == 2 ? 'AND r.isrenamed = 1' : ''),
$this->tvqty
diff --git a/resources/db/patches/mysql/0258~general.sql b/resources/db/patches/mysql/0258~general.sql
new file mode 100644
index 000000000..62d36a82d
--- /dev/null
+++ b/resources/db/patches/mysql/0258~general.sql
@@ -0,0 +1,8 @@
+# Change releases.groupid to releases.groups_id to follow lithium convention.
+ALTER TABLE releases CHANGE COLUMN groupid groups_id INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'FK to groups.id';
+
+# Change predb.groupid to predb.groups_id to follow lithium convention.
+ALTER TABLE predb CHANGE COLUMN groupid groups_id INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'FK to groups.id';
+
+# Change predb_imports.groupid to predb_imports.groups_id to follow lithium convention.
+ALTER TABLE predb_imports CHANGE COLUMN groupid groups_id INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'FK to groups.id';
diff --git a/www/pages/preinfo.php b/www/pages/preinfo.php
index b3739350c..8edb9b15e 100644
--- a/www/pages/preinfo.php
+++ b/www/pages/preinfo.php
@@ -154,7 +154,7 @@ if (isset($_GET['type'])) {
sprintf('
SELECT p.*
FROM predb p
- INNER JOIN groups g ON g.id = p.groupid
+ INNER JOIN groups g ON g.id = p.groups_id
WHERE requestid = %d
AND g.name = %s
%s %s %s
diff --git a/www/themes/shared/templates/admin/nzb-export.tpl b/www/themes/shared/templates/admin/nzb-export.tpl
index 982d96d01..7955dedc4 100644
--- a/www/themes/shared/templates/admin/nzb-export.tpl
+++ b/www/themes/shared/templates/admin/nzb-export.tpl
@@ -4,7 +4,7 @@
Export nzbs from the system into a folder. Specify the full file path to a folder.
-If you are exporting a large number of nzb files, run this script from the command line and pass in the folder path as the first argument. e.g. php scriptname outputpath from(optional) to(optional) groupid(optional use -1) categories_id(optional)
+If you are exporting a large number of nzb files, run this script from the command line and pass in the folder path as the first argument. e.g. php scriptname outputpath from(optional) to(optional) groups_id(optional use -1) categories_id(optional)
php admin/nzb-export.php /path/to/export/into 01/01/2008 01/01/2010 -1 1050