First batch of updates to rename all the columns to lower case and scripts to use that kind of naming.

This commit is contained in:
Darko
2015-03-18 14:28:22 +01:00
parent 6379b12579
commit 96626bc8c2
246 changed files with 2991 additions and 2927 deletions
+25 -25
View File
@@ -468,7 +468,7 @@ Class ProcessAdditional
$this->_mainTmpPath .= DS;
}
// If we are doing per group, use the groupID has a inner path, so other scripts don't delete the files we are working on.
// If we are doing per group, use the groupid has a inner path, so other scripts don't delete the files we are working on.
if ($groupID !== '') {
$this->_mainTmpPath .= ($groupID . DS);
} else if ($guidChar !== '') {
@@ -523,9 +523,9 @@ Class ProcessAdditional
$this->_releases = $this->pdo->query(
sprintf(
'
SELECT r.ID, r.guid, r.name, c.disablepreview, r.size, r.groupID, r.nfostatus, r.completion, r.categoryID, r.searchname, r.prehashID
SELECT r.ID, r.guid, r.name, c.disablepreview, r.size, r.groupid, r.nfostatus, r.completion, r.categoryid, r.searchname, r.prehashid
FROM releases r
LEFT JOIN category c ON c.ID = r.categoryID
LEFT JOIN category c ON c.ID = r.categoryid
WHERE r.nzbstatus = 1
%s %s %s %s
AND r.passwordstatus BETWEEN -6 AND -1
@@ -535,7 +535,7 @@ Class ProcessAdditional
LIMIT %d',
$this->_maxSize,
$this->_minSize,
($groupID === '' ? '' : 'AND r.groupID = ' . $groupID),
($groupID === '' ? '' : 'AND r.groupid = ' . $groupID),
($guidChar === '' ? '' : 'AND r.guid ' . $this->pdo->likeString($guidChar, false, true)),
$this->_queryLimit
)
@@ -1092,7 +1092,7 @@ Class ProcessAdditional
sprintf(
'
SELECT ID FROM releasefiles
WHERE releaseID = %d
WHERE releaseid = %d
AND name = %s
AND size = %d',
$this->_release['ID'], $this->pdo->escapeString($file['name']), $file['size']
@@ -1117,7 +1117,7 @@ Class ProcessAdditional
} //Run a PreDB filename check on insert to try and match the release
else if (strpos($file['name'], '.') != 0 && strlen($file['name']) > 0) {
$this->_release['filename'] = $file['name'];
$this->_release['releaseID'] = $this->_release['ID'];
$this->_release['releaseid'] = $this->_release['ID'];
$this->_nameFixer->matchPredbFiles($this->_release, 1, 1, true, 1);
}
}
@@ -1212,7 +1212,7 @@ Class ProcessAdditional
} // Check if it's alt.binaries.u4e file.
else if (in_array($this->_releaseGroupName, ['alt.binaries.u4e', 'alt.binaries.mom']) &&
preg_match('/Linux_2rename\.sh/i', $file) &&
($this->_release['categoryID'] == \Category::CAT_MISC_HASHED || $this->_release['categoryID'] == \Category::CAT_MISC_OTHER)
($this->_release['categoryid'] == \Category::CAT_MISC_HASHED || $this->_release['categoryid'] == \Category::CAT_MISC_OTHER)
) {
$this->_processU4ETitle($file);
}
@@ -1512,10 +1512,10 @@ Class ProcessAdditional
$releaseFiles = $this->pdo->queryOneRow(
sprintf(
'
SELECT COUNT(releasefiles.releaseID) AS count,
SELECT COUNT(releasefiles.releaseid) AS count,
SUM(releasefiles.size) AS size
FROM releasefiles
WHERE releaseID = %d',
WHERE releaseid = %d',
$this->_release['ID']
)
);
@@ -1623,7 +1623,7 @@ Class ProcessAdditional
// Make sure the category is music or other.
$rQuery = $this->pdo->queryOneRow(
sprintf(
'SELECT searchname, categoryID AS id, groupID FROM releases WHERE proc_pp = 0 AND ID = %d',
'SELECT searchname, categoryid AS id, groupid FROM releases WHERE proc_pp = 0 AND ID = %d',
$this->_release['ID']
)
);
@@ -1663,7 +1663,7 @@ Class ProcessAdditional
if (isset($track['Album']) && isset($track['Performer'])) {
if (NN_RENAME_MUSIC_MEDIAINFO && $this->_release['prehashID'] == 0) {
if (NN_RENAME_MUSIC_MEDIAINFO && $this->_release['prehashid'] == 0) {
// Make the extension upper case.
$ext = strtoupper($fileExtension);
@@ -1680,7 +1680,7 @@ Class ProcessAdditional
} else if ($ext === 'FLAC') {
$newCat = Category::CAT_MUSIC_LOSSLESS;
} else {
$newCat = $this->_categorize->determineCategory($rQuery['groupID'],$newName);
$newCat = $this->_categorize->determineCategory($rQuery['groupid'],$newName);
}
$newTitle = $this->pdo->escapeString(substr($newName, 0, 255));
@@ -1689,7 +1689,7 @@ Class ProcessAdditional
sprintf(
'
UPDATE releases
SET searchname = %s, categoryID = %d, iscategorized = 1, isrenamed = 1, proc_pp = 1
SET searchname = %s, categoryid = %d, iscategorized = 1, isrenamed = 1, proc_pp = 1
WHERE ID = %d',
$newTitle,
$newCat,
@@ -1706,7 +1706,7 @@ Class ProcessAdditional
'old_name' => $rQuery['searchname'],
'new_category' => $newCat,
'old_category' => $rQuery['id'],
'group' => $rQuery['groupID'],
'group' => $rQuery['groupid'],
'release_id' => $this->_release['ID'],
'method' => 'ProcessAdditional->_getAudioInfo'
)
@@ -2127,7 +2127,7 @@ Class ProcessAdditional
if (NN_RENAME_PAR2 &&
$releaseInfo['proc_pp'] == 0 &&
in_array(
((int)$this->_release['categoryID']),
((int)$this->_release['categoryid']),
array(
Category::CAT_BOOK_OTHER,
Category::CAT_GAME_OTHER,
@@ -2163,7 +2163,7 @@ Class ProcessAdditional
if ($filesAdded < 11 &&
$this->pdo->queryOneRow(
sprintf(
'SELECT ID FROM releasefiles WHERE releaseID = %d AND name = %s',
'SELECT ID FROM releasefiles WHERE releaseid = %d AND name = %s',
$this->_release['ID'], $this->pdo->escapeString($file['name'])
)
) === false
@@ -2181,7 +2181,7 @@ Class ProcessAdditional
// Try to get a new name.
if ($foundName === false) {
$this->_release['textstring'] = $file['name'];
$this->_release['releaseID'] = $this->_release['ID'];
$this->_release['releaseid'] = $this->_release['ID'];
if ($this->_nameFixer->checkName($this->_release, ($this->_echoCLI ? 1 : 0), 'PAR2, ', 1, 1) === true) {
$foundName = true;
}
@@ -2266,7 +2266,7 @@ Class ProcessAdditional
}
// Get a new category ID.
$newCategory = $this->_categorize->determineCategory($this->_release['groupID'], $newName);
$newCategory = $this->_categorize->determineCategory($this->_release['groupid'], $newName);
$newTitle = $this->pdo->escapeString(substr($newName, 0, 255));
// Update the release with the data.
@@ -2274,10 +2274,10 @@ Class ProcessAdditional
sprintf(
'
UPDATE releases
SET rageID = -1, seriesfull = NULL, season = NULL, episode = NULL,
tvtitle = NULL, tvairdate = NULL, imdbID = NULL, musicinfoID = NULL,
consoleinfoID = NULL, bookinfoID = NULL, anidbid = NULL, prehashID = 0,
searchname = %s, isrenamed = 1, iscategorized = 1, proc_files = 1, categoryID = %d
SET rageid = -1, seriesfull = NULL, season = NULL, episode = NULL,
tvtitle = NULL, tvairdate = NULL, imdbid = NULL, musicinfoid = NULL,
consoleinfoid = NULL, bookinfoid = NULL, anidbid = NULL, prehashid = 0,
searchname = %s, isrenamed = 1, iscategorized = 1, proc_files = 1, categoryid = %d
WHERE ID = %d',
$newTitle,
$newCategory,
@@ -2293,8 +2293,8 @@ Class ProcessAdditional
'new_name' => $newName,
'old_name' => $this->_release['searchname'],
'new_category' => $newCategory,
'old_category' => $this->_release['categoryID'],
'group' => $this->_release['groupID'],
'old_category' => $this->_release['categoryid'],
'group' => $this->_release['groupid'],
'release_id' => $this->_release['ID'],
'method' => 'ProcessAdditional->_processU4ETitle'
)
@@ -2509,7 +2509,7 @@ Class ProcessAdditional
$this->_passwordStatus = array(Releases::PASSWD_NONE);
$this->_releaseHasPassword = false;
$this->_releaseGroupName = $this->_groups->getByNameByID($this->_release['groupID']);
$this->_releaseGroupName = $this->_groups->getByNameByID($this->_release['groupid']);
$this->_releaseHasNoNFO = false;
// Make sure we don't already have an nfo.