diff --git a/lib/MiscSorter.php b/lib/MiscSorter.php index 120cbd1c6..cc32c0e16 100644 --- a/lib/MiscSorter.php +++ b/lib/MiscSorter.php @@ -11,7 +11,6 @@ require_once(WWW_DIR . "/lib/nzb.php"); require_once(WWW_DIR . "/lib/ColorCLI.php"); require_once("Info.php"); require_once("Film.php"); -require_once("Enzebe.php"); require_once("namefixer.php"); require_once("Konsole.php"); require_once(WWW_DIR . "/lib/ReleaseCleaning.php"); diff --git a/lib/NZBGet.php b/lib/NZBGet.php index 8b2f8a85a..8ecfd1b51 100644 --- a/lib/NZBGet.php +++ b/lib/NZBGet.php @@ -111,7 +111,7 @@ class NZBGet { $relData = $this->Releases->getByGuid($guid); - $string = Utility::unzipGzipFile($this->NZB->getNZBPath($guid)); + $string = Utility::unzipGzipFile($this->NZB->NZBPath($guid)); $string = ($string === false ? '' : $string); $header = diff --git a/lib/ProcessAdditional.php b/lib/ProcessAdditional.php index ae2619edc..d3be2e9dc 100644 --- a/lib/ProcessAdditional.php +++ b/lib/ProcessAdditional.php @@ -304,18 +304,18 @@ Class ProcessAdditional $this->_echoDebug = NN_DEBUG; $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); - $this->_nntp = ($options['NNTP'] instanceof NNTP ? $options['NNTP'] : new NNTP(['Echo' => $this->_echoCLI, 'Settings' => $this->pdo])); + $this->_nntp = ($options['NNTP'] instanceof \NNTP ? $options['NNTP'] : new \NNTP(['Echo' => $this->_echoCLI, 'Settings' => $this->pdo])); - $this->_nzb = ($options['NZB'] instanceof NZB ? $options['NZB'] : new NZB($this->pdo)); - $this->_groups = ($options['Groups'] instanceof Groups ? $options['Groups'] : new Groups(['Settings' => $this->pdo])); + $this->_nzb = ($options['NZB'] instanceof \NZB ? $options['NZB'] : new \NZB($this->pdo)); + $this->_groups = ($options['Groups'] instanceof \Groups ? $options['Groups'] : new \Groups(['Settings' => $this->pdo])); $this->_archiveInfo = new ArchiveInfo(); - $this->_releaseFiles = ($options['ReleaseFiles'] instanceof ReleaseFiles ? $options['ReleaseFiles'] : new ReleaseFiles($this->pdo)); - $this->_categorize = ($options['Categorize'] instanceof Categorize ? $options['Categorize'] : new Categorize(['Settings' => $this->pdo])); - $this->_nameFixer = ($options['NameFixer'] instanceof NameFixer ? $options['NameFixer'] : new NameFixer(['Echo' =>$this->_echoCLI, 'Groups' => $this->_groups, 'Settings' => $this->pdo, 'Categorize' => $this->_categorize])); - $this->_releaseExtra = ($options['ReleaseExtra'] instanceof ReleaseExtra ? $options['ReleaseExtra'] : new ReleaseExtra($this->pdo)); - $this->_releaseImage = ($options['ReleaseImage'] instanceof ReleaseImage ? $options['ReleaseImage'] : new ReleaseImage($this->pdo)); + $this->_releaseFiles = ($options['ReleaseFiles'] instanceof \ReleaseFiles ? $options['ReleaseFiles'] : new \ReleaseFiles($this->pdo)); + $this->_categorize = ($options['Categorize'] instanceof \Categorize ? $options['Categorize'] : new \Categorize(['Settings' => $this->pdo])); + $this->_nameFixer = ($options['NameFixer'] instanceof \NameFixer ? $options['NameFixer'] : new \NameFixer(['Echo' =>$this->_echoCLI, 'Groups' => $this->_groups, 'Settings' => $this->pdo, 'Categorize' => $this->_categorize])); + $this->_releaseExtra = ($options['ReleaseExtra'] instanceof \ReleaseExtra ? $options['ReleaseExtra'] : new \ReleaseExtra($this->pdo)); + $this->_releaseImage = ($options['ReleaseImage'] instanceof \ReleaseImage ? $options['ReleaseImage'] : new \ReleaseImage($this->pdo)); $this->_par2Info = new Par2Info(); - $this->_nfo = ($options['Nfo'] instanceof Info ? $options['Nfo'] : new Info(['Echo' => $this->_echoCLI, 'Settings' => $this->pdo])); + $this->_nfo = ($options['Nfo'] instanceof \Info ? $options['Nfo'] : new \Info(['Echo' => $this->_echoCLI, 'Settings' => $this->pdo])); $this->sphinx = ($options['SphinxSearch'] instanceof \SphinxSearch ? $options['SphinxSearch'] : new \SphinxSearch()); $s = new Sites(); $this->site = $s->get(); diff --git a/lib/copy_this/misc/update_scripts/import.php b/lib/copy_this/misc/update_scripts/import.php index abeb2b36d..9a18e3deb 100644 --- a/lib/copy_this/misc/update_scripts/import.php +++ b/lib/copy_this/misc/update_scripts/import.php @@ -103,7 +103,7 @@ foreach ($filestoprocess as $nzbFile) { $relid = $releases->insertRelease($name, $nzbInfo->filecount, $groupID, $relguid, $catId, "", date("Y-m-d H:i:s", $nzbInfo->postedlast), $nzbInfo->poster, "", $page->site); $db->queryExec(sprintf("update releases set totalpart = %d, size = %s, completion = %d, GID=%s where ID = %d", $nzbInfo->filecount, $nzbInfo->filesize, $nzbInfo->completion, $db->escapeString($nzbInfo->gid), $relid)); - $nzbfilename = $nzb->getNZBPath($relguid, $page->site->nzbpath, true); + $nzbfilename = $nzb->NZBPath($relguid, $page->site->nzbpath, true); $fp = gzopen($nzbfilename, "w"); if ($fp) { gzwrite($fp, $nzbInfo->toNzb()); diff --git a/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/Forking.php b/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/Forking.php index 6a3e5d08e..6841148ba 100644 --- a/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/Forking.php +++ b/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/Forking.php @@ -5,9 +5,9 @@ require_once(NN_LIB . 'ColorCLI.php'); require_once(NN_LIB . 'site.php'); require_once(NN_LIB . 'nntp.php'); require_once(NN_LIB . 'postprocess.php'); +require_once(NN_LIB . 'nzb.php'); require_once(NN_LIB . 'RequestID.php'); require_once(NN_TMUX . 'lib' . DS . 'Pprocess.php'); -require_once(NN_TMUX . 'lib' . DS . 'Enzebe.php'); diff --git a/lib/copy_this/www/lib/Books.php b/lib/copy_this/www/lib/Books.php index 2735b5151..3db38aaee 100644 --- a/lib/copy_this/www/lib/Books.php +++ b/lib/copy_this/www/lib/Books.php @@ -5,7 +5,6 @@ require_once(WWW_DIR."/lib/category.php"); require_once(WWW_DIR."/lib/site.php"); require_once(WWW_DIR."/lib/util.php"); require_once(WWW_DIR."/lib/releaseimage.php"); -require_once(NN_TMUX . 'lib' . DS . 'Enzebe.php'); /* * Class for processing book info. diff --git a/lib/Enzebe.php b/lib/copy_this/www/lib/Enzebe.php similarity index 97% rename from lib/Enzebe.php rename to lib/copy_this/www/lib/Enzebe.php index 8ba418cb9..2f40b4538 100644 --- a/lib/Enzebe.php +++ b/lib/copy_this/www/lib/Enzebe.php @@ -1,7 +1,7 @@ pdo->queryExec( sprintf(' UPDATE releases SET nzbstatus = %d %s WHERE ID = %d', - \Enzebe::NZB_ADDED, + \NZB::NZB_ADDED, ($nzb_guid === '' ? '' : ', nzb_guid = ' . $this->pdo->escapestring(md5($nzb_guid))), $relID ) @@ -273,7 +273,7 @@ class Enzebe * * @access public */ - public function getNZBPath($releaseGuid, $levelsToSplit = 0, $createIfNotExist = false) + public function NZBPath($releaseGuid, $levelsToSplit = 0, $createIfNotExist = false) { if ($levelsToSplit === 0) { $levelsToSplit = $this->nzbSplitLevel; @@ -294,7 +294,7 @@ class Enzebe */ public function NZBPath($releaseGuid) { - $nzbFile = $this->getNZBPath($releaseGuid); + $nzbFile = $this->NZBPath($releaseGuid); return (is_file($nzbFile) ? $nzbFile : false); } diff --git a/lib/copy_this/www/lib/NZBImport.php b/lib/copy_this/www/lib/NZBImport.php index 47c386596..fa637ebb3 100644 --- a/lib/copy_this/www/lib/NZBImport.php +++ b/lib/copy_this/www/lib/NZBImport.php @@ -7,7 +7,6 @@ require_once(WWW_DIR . "/lib/site.php"); require_once(WWW_DIR . "/lib/util.php"); require_once(WWW_DIR . "/lib/Categorize.php"); require_once(NN_TMUX . 'lib' . DS . 'ReleaseCleaning.php'); -require_once(NN_TMUX . 'lib' . DS . 'Enzebe.php'); /** * Import NZB files into the database. @@ -192,7 +191,7 @@ class NZBImport if ($inserted) { // Try to copy the NZB to the NZB folder. - $path = $this->nzb->getNZBPath($this->relGuid, '', true); + $path = $this->nzb->NZBPath($this->relGuid, '', true); // Try to compress the NZB file in the NZB folder. $fp = gzopen ($path, 'w5'); diff --git a/lib/copy_this/www/lib/TmuxOutput.php b/lib/copy_this/www/lib/TmuxOutput.php index ba536aec8..c9411ca12 100644 --- a/lib/copy_this/www/lib/TmuxOutput.php +++ b/lib/copy_this/www/lib/TmuxOutput.php @@ -117,7 +117,7 @@ class TmuxOutput extends Tmux $buffer = ''; $state = ($this->runVar['settings']['is_running'] == 1) ? 'Running' : 'Disabled'; //$version = $this->_tvers . 'r' . $this->_vers; - $tversion = '0.6r0001'; + $tversion = '0.6r0010'; $buffer .= sprintf($this->tmpMasks[2], "Monitor $state v$tversion @ $this->_tvers [" . $this->_vers ."]: ", diff --git a/lib/copy_this/www/lib/nfo.php b/lib/copy_this/www/lib/nfo.php index e76201d3f..68fbb7046 100644 --- a/lib/copy_this/www/lib/nfo.php +++ b/lib/copy_this/www/lib/nfo.php @@ -508,7 +508,7 @@ class Nfo $res = $db->query($mnfo); if($res){ foreach($res as $r){ - $nzbfile = $nzb->getNZBPath($r["guid"]); + $nzbfile = $nzb->NZBPath($r["guid"]); if(!is_file($nzbfile)){ if($this->verbose) echo sprintf("%s Missing NZB File: %d/%s ...\n", 'NfoProc', intval($r["ID"]), $r["name"]); diff --git a/lib/copy_this/www/lib/nzb.php b/lib/copy_this/www/lib/nzb.php index 697b8fbee..372855c11 100644 --- a/lib/copy_this/www/lib/nzb.php +++ b/lib/copy_this/www/lib/nzb.php @@ -290,7 +290,7 @@ class NZB * * @access public */ - public function getNZBPath($releaseGuid, $levelsToSplit = 0, $createIfNotExist = false) + public function NZBPath($releaseGuid, $levelsToSplit = 0, $createIfNotExist = false) { if ($levelsToSplit === 0) { $levelsToSplit = $this->nzbSplitLevel; @@ -311,7 +311,7 @@ class NZB */ public function NZBPath($releaseGuid) { - $nzbFile = $this->getNZBPath($releaseGuid); + $nzbFile = $this->NZBPath($releaseGuid); return (is_file($nzbFile) ? $nzbFile : false); } diff --git a/lib/copy_this/www/lib/parsing.php b/lib/copy_this/www/lib/parsing.php index 5173d4f66..79173cdbc 100644 --- a/lib/copy_this/www/lib/parsing.php +++ b/lib/copy_this/www/lib/parsing.php @@ -678,7 +678,7 @@ class Parsing // do par check if user has elected for downloading extra stuff if ($this->site->unrarpath != '' && $foundName == "") { $nzb = new NZB(); - $nzbfile = $nzb->getNZBPath($rel['guid'], $this->site->nzbpath, true); + $nzbfile = $nzb->NZBPath($rel['guid'], $this->site->nzbpath, true); $nzbInfo = new nzbInfo; $nzbInfo->loadFromFile($nzbfile); if (!empty($nzbInfo->parfiles) && empty($nzbInfo->rarfiles) && empty($nzbInfo->audiofiles)) { diff --git a/lib/copy_this/www/lib/postprocess.php b/lib/copy_this/www/lib/postprocess.php index ae55e5166..8bc5d907a 100644 --- a/lib/copy_this/www/lib/postprocess.php +++ b/lib/copy_this/www/lib/postprocess.php @@ -376,7 +376,7 @@ class PostProcess // only load nzbs and check for rar files if we are doing something with them. if ($processVideoSample || $processMediainfo || $processPasswords || $processAudioSample) { - $nzbfile = $nzb->getNZBPath($rel['guid'], $this->site->nzbpath); + $nzbfile = $nzb->NZBPath($rel['guid'], $this->site->nzbpath); if (!$nzbInfo->loadFromFile($nzbfile)) { continue; diff --git a/lib/copy_this/www/lib/releases.php b/lib/copy_this/www/lib/releases.php index bb9f111d6..7bba408a8 100644 --- a/lib/copy_this/www/lib/releases.php +++ b/lib/copy_this/www/lib/releases.php @@ -711,7 +711,7 @@ class Releases public function deleteSingle($identifiers, $nzb, $releaseImage) { // Delete NZB from disk. - $nzbPath = $nzb->getNZBPath($identifiers['g']); + $nzbPath = $nzb->NZBPath($identifiers['g']); if ($nzbPath) { @unlink($nzbPath); } @@ -1293,7 +1293,7 @@ class Releases $zipFile = new \ZipFile(); foreach ($guids as $guid) { - $nzbPath = $nzb->getNZBPath($guid); + $nzbPath = $nzb->NZBPath($guid); if ($nzbPath) { $nzbContents = Utility::unzipGzipFile($nzbPath); diff --git a/lib/copy_this/www/lib/sphinx.php b/lib/copy_this/www/lib/sphinx.php index 44a5463f8..a49bed2d5 100644 --- a/lib/copy_this/www/lib/sphinx.php +++ b/lib/copy_this/www/lib/sphinx.php @@ -574,7 +574,7 @@ class Sphinx while ($row = $ndb->getAssocArray($result)) { $fileNames = ""; $fileCount = 0; - $nzbpath = $this->nzb->getNZBPath($row['guid'], $this->site->nzbpath); + $nzbpath = $this->nzb->NZBPath($row['guid'], $this->site->nzbpath); if (file_exists($nzbpath)) { $nzbfile = file_get_contents('compress.zlib://'.$nzbpath); $files = $this->nzb->nzbFileList($nzbfile); diff --git a/lib/copy_this/www/lib/spotnab.php b/lib/copy_this/www/lib/spotnab.php index 2ea18000a..ef189f0f3 100644 --- a/lib/copy_this/www/lib/spotnab.php +++ b/lib/copy_this/www/lib/spotnab.php @@ -587,9 +587,9 @@ class SpotNab { // Fetch some date ranges $last_month = date("Y-m-d",strtotime( - date("Y-m-d", mktime()) . " - 30 day")); + date("Y-m-d", time()) . " - 30 day")); $last_year = date('Y-m-d',strtotime( - date("Y-m-d", mktime()) . " - 365 day")); + date("Y-m-d", time()) . " - 365 day")); // Header $message = array( @@ -974,8 +974,7 @@ class SpotNab { } // Update DB With Global Identifer - $ures = $db->queryExec(sprintf($usql, $gid, $r['ID'])); - var_dump($ures); + $ures = $db->query(sprintf($usql, $gid, $r['ID'])); if($ures < 0){ printf("\nPostPrc : Failed to update: %s\n", $r['name']); } @@ -992,8 +991,7 @@ class SpotNab { .'AND releasecomment.GID IS NULL ' .'AND releases.GID IS NOT NULL '; - $affected = $db->queryExec(sprintf($usql)); - var_dump($affected); + $affected = $db->query(sprintf($usql)); if($affected > 0) $processed += $affected; return $processed; diff --git a/lib/copy_this/www/pages/details.php b/lib/copy_this/www/pages/details.php index 723af3e63..700aff9ac 100644 --- a/lib/copy_this/www/pages/details.php +++ b/lib/copy_this/www/pages/details.php @@ -39,7 +39,7 @@ if (isset($_GET["id"])) $comments = $rc->getCommentsByGid($data["gid"]); $rage = ''; - if ($data["rageid"] != '') + if ($data["rageID"] != '') { $tvrage = new TvAnger(); diff --git a/lib/copy_this/www/pages/getnzb.php b/lib/copy_this/www/pages/getnzb.php index bbe03e602..f466181c6 100644 --- a/lib/copy_this/www/pages/getnzb.php +++ b/lib/copy_this/www/pages/getnzb.php @@ -83,7 +83,7 @@ if (isset($_GET["id"]) && isset($_GET["zip"]) && $_GET["zip"] == "1") { if (isset($_GET["id"])) { $reldata = $rel->getByGuid($_GET["id"]); - $nzbpath = $nzb->getNZBPath($_GET["id"]); + $nzbpath = $nzb->NZBPath($_GET["id"]); if (!file_exists($nzbpath)) { header("X-DNZB-RCode: 404"); diff --git a/lib/copy_this/www/processing/ProcessReleases.php b/lib/copy_this/www/processing/ProcessReleases.php index 8f7c12447..c52713380 100644 --- a/lib/copy_this/www/processing/ProcessReleases.php +++ b/lib/copy_this/www/processing/ProcessReleases.php @@ -3,7 +3,6 @@ require_once(NN_LIB . 'framework' . DS . 'db.php'); require_once(NN_LIB . 'nzb.php'); require_once(NN_LIB . 'groups.php'); require_once(NN_LIB . 'ConsoleTools.php'); -require_once(NN_TMUX . 'lib' . DS . 'Enzebe.php'); require_once(NN_LIB . 'ReleaseCleaning.php'); require_once(NN_LIB . 'releaseimage.php'); require_once(NN_LIB . 'releases.php'); @@ -11,6 +10,7 @@ require_once(NN_LIB . 'site.php'); require_once(NN_LIB . 'RequestIDLocal.php'); require_once(NN_LIB . 'RequestIDWeb.php'); require_once(NN_TMUX . 'lib' . DS . 'prehash.php'); +require_once(NN_TMUX . 'lib' . DS . 'Pprocess.php'); @@ -222,7 +222,7 @@ class ProcessReleases //Print amount of added releases and time it took. if ($this->echoCLI && $this->tablePerGroup === false) { - $countID = $this->pdo->queryOneRow('SELECT COUNT(ID) AS count FROM collections ' . (!empty($groupID) ? ' WHERE group_id = ' . $groupID : '')); + $countID = $this->pdo->queryOneRow('SELECT COUNT(id) AS count FROM collections ' . (!empty($groupID) ? ' WHERE group_id = ' . $groupID : '')); $this->pdo->log->doEcho( $this->pdo->log->primary( 'Completed adding ' . @@ -250,7 +250,7 @@ class ProcessReleases public function resetCategorize($where = '') { $this->pdo->queryExec( - sprintf('UPDATE releases SET categoryID = %d, iscategorized = 0 %s', \Category::CAT_MISC, $where) + sprintf('UPDATE releases SET categoryID = %d, iscategorized = 0 %s', \Category::CAT_MISC_OTHER, $where) ); } @@ -267,13 +267,13 @@ 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, groupID FROM releases %s', $type, $where)); if ($releases && $releases->rowCount()) { $total = $releases->rowCount(); foreach ($releases as $release) { $catId = $cat->determineCategory($release[$type], $release['groupID']); $this->pdo->queryExec( - sprintf('UPDATE releases SET categoryID = %d, iscategorized = 1 WHERE id = %d', $catId, $release['id']) + sprintf('UPDATE releases SET categoryID = %d, iscategorized = 1 WHERE ID = %d', $catId, $release['ID']) ); $categorized++; if ($this->echoCLI) { @@ -411,7 +411,7 @@ class ProcessReleases foreach ($groupIDs as $groupID) { if ($this->pdo->queryOneRow( sprintf( - 'SELECT id FROM %s WHERE filecheck = %d AND filesize > 0 AND group_id = %d LIMIT 1', + 'SELECT ID FROM %s WHERE filecheck = %d AND filesize > 0 AND group_id = %d LIMIT 1', $group['cname'], self::COLLFC_SIZED, $groupID['id'] @@ -552,7 +552,7 @@ class ProcessReleases // A 1% variance in size is considered the same size when the subject and poster are the same $dupeCheck = $this->pdo->queryOneRow( sprintf(" - SELECT id + SELECT ID FROM releases WHERE name = %s AND fromname = %s @@ -680,10 +680,10 @@ class ProcessReleases $releases = $this->pdo->queryDirect( sprintf(" SELECT CONCAT(COALESCE(cp.title,'') , CASE WHEN cp.title IS NULL THEN '' ELSE ' > ' END , c.title) AS title, - r.name, r.id, r.guid + r.name, r.ID, r.guid FROM releases r - INNER JOIN category c ON r.categoryID = c.id - INNER JOIN category cp ON cp.id = c.parentid + INNER JOIN category c ON r.categoryID = c.ID + INNER JOIN category cp ON cp.ID = c.parentID WHERE %s nzbstatus = 0", (!empty($groupID) ? ' r.groupID = ' . $groupID . ' AND ' : ' ') ) @@ -697,7 +697,7 @@ class ProcessReleases $this->nzb->initiateForWrite($groupID); foreach ($releases as $release) { - if ($this->nzb->writeNZBforReleaseId($release['id'], $release['guid'], $release['name'], $release['title']) === true) { + if ($this->nzb->writeNZBforReleaseId($release['ID'], $release['guid'], $release['name'], $release['title']) === true) { $nzbCount++; if ($this->echoCLI) { echo $this->pdo->log->primaryOver("Creating NZBs:\t" . $nzbCount . '/' . $total . "\r"); @@ -720,7 +720,7 @@ class ProcessReleases $deleteQuery = $this->pdo->queryExec( sprintf(' DELETE c FROM %s c - INNER JOIN releases r ON r.id = c.releaseid + INNER JOIN releases r ON r.ID = c.releaseid WHERE r.nzbstatus = %d AND c.filecheck = %d', $group['cname'], @@ -850,7 +850,7 @@ class ProcessReleases public function postProcessReleases($postProcess, &$nntp) { if ($postProcess == 1) { - (new PostProcess(['Echo' => $this->echoCLI, 'Settings' => $this->pdo, 'Groups' => $this->groups]))->processAll($nntp); + (new PProcess(['Echo' => $this->echoCLI, 'Settings' => $this->pdo, 'Groups' => $this->groups]))->processAll($nntp); } else { if ($this->echoCLI) { $this->pdo->log->doEcho( @@ -937,7 +937,7 @@ class ProcessReleases if (mt_rand(0, 100) <= 5) { $deleteQuery = $this->pdo->queryExec( sprintf( - 'DELETE FROM %s WHERE binaryid NOT IN (SELECT id FROM %s) %s', + 'DELETE FROM %s WHERE binaryid NOT IN (SELECT ID FROM %s) %s', $group['pname'], $group['bname'], $this->minMaxQueryFormulator($group['pname'], 40000) ) ); @@ -960,7 +960,7 @@ class ProcessReleases // Binaries that somehow have no collection. Don't delete currently inserting binaries by checking the max id. $deleteQuery = $this->pdo->queryExec( sprintf( - 'DELETE FROM %s WHERE collection_id NOT IN (SELECT id FROM %s) %s', + 'DELETE FROM %s WHERE collection_id NOT IN (SELECT ID FROM %s) %s', $group['bname'], $group['cname'], $this->minMaxQueryFormulator($group['bname'], 20000) ) ); @@ -982,7 +982,7 @@ class ProcessReleases // Collections that somehow have no binaries. $collectionIDs = $this->pdo->queryDirect( sprintf( - 'SELECT id FROM %s WHERE id NOT IN (SELECT collection_id FROM %s) %s', + 'SELECT ID FROM %s WHERE id NOT IN (SELECT collection_id FROM %s) %s', $group['cname'], $group['bname'], $this->minMaxQueryFormulator($group['cname'], 10000) ) ); @@ -1074,9 +1074,9 @@ class ProcessReleases foreach ($groupIDs as $groupID) { $releases = $this->pdo->queryDirect( sprintf(" - SELECT r.guid, r.id + SELECT r.guid, r.ID FROM releases r - INNER JOIN groups g ON g.id = r.groupID + INNER JOIN groups g ON g.ID = r.groupID WHERE r.groupID = %d AND greatest(IFNULL(g.minsizetoformrelease, 0), %d) > 0 AND r.size < greatest(IFNULL(g.minsizetoformrelease, 0), %d)", @@ -1087,7 +1087,7 @@ class ProcessReleases ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); $minSizeDeleted++; } } @@ -1095,7 +1095,7 @@ class ProcessReleases if ($maxSizeSetting > 0) { $releases = $this->pdo->queryDirect( sprintf(' - SELECT id, guid + SELECT ID, guid FROM releases WHERE groupID = %d AND size > %d', @@ -1105,7 +1105,7 @@ class ProcessReleases ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); $maxSizeDeleted++; } } @@ -1113,9 +1113,9 @@ class ProcessReleases $releases = $this->pdo->queryDirect( sprintf(" - SELECT r.id, r.guid + SELECT r.ID, r.guid FROM releases r - INNER JOIN groups g ON g.id = r.groupID + INNER JOIN groups g ON g.ID = r.groupID WHERE r.groupID = %d AND greatest(IFNULL(g.minfilestoformrelease, 0), %d) > 0 AND r.totalpart < greatest(IFNULL(g.minfilestoformrelease, 0), %d)", @@ -1126,7 +1126,7 @@ class ProcessReleases ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); $minFilesDeleted++; } } @@ -1169,13 +1169,13 @@ class ProcessReleases if ($this->site->releaseretentiondays != 0) { $releases = $this->pdo->queryDirect( sprintf( - 'SELECT id, guid FROM releases WHERE postdate < (NOW() - INTERVAL %d DAY)', + 'SELECT ID, guid FROM releases WHERE postdate < (NOW() - INTERVAL %d DAY)', $this->site->releaseretentiondays ) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); $retentionDeleted++; } } @@ -1185,13 +1185,13 @@ class ProcessReleases if ($this->site->deletepasswordedrelease == 1) { $releases = $this->pdo->queryDirect( sprintf( - 'SELECT id, guid FROM releases WHERE passwordstatus = %d', + 'SELECT ID, guid FROM releases WHERE passwordstatus = %d', \Releases::PASSWD_RAR ) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); $passwordDeleted++; } } @@ -1201,13 +1201,13 @@ class ProcessReleases if ($this->site->deletepossiblerelease == 1) { $releases = $this->pdo->queryDirect( sprintf( - 'SELECT id, guid FROM releases WHERE passwordstatus = %d', + 'SELECT ID, guid FROM releases WHERE passwordstatus = %d', \Releases::PASSWD_POTENTIAL ) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); $passwordDeleted++; } } @@ -1218,7 +1218,7 @@ class ProcessReleases do { $releases = $this->pdo->queryDirect( sprintf( - 'SELECT id, guid FROM releases WHERE adddate > (NOW() - INTERVAL %d HOUR) GROUP BY name HAVING COUNT(name) > 1', + 'SELECT ID, guid FROM releases WHERE adddate > (NOW() - INTERVAL %d HOUR) GROUP BY name HAVING COUNT(name) > 1', $this->crossPostTime ) ); @@ -1226,7 +1226,7 @@ class ProcessReleases if ($releases && $releases->rowCount()) { $total = $releases->rowCount(); foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); $duplicateDeleted++; } } @@ -1235,11 +1235,11 @@ class ProcessReleases if ($this->completion > 0) { $releases = $this->pdo->queryDirect( - sprintf('SELECT id, guid FROM releases WHERE completion < %d AND completion > 0', $this->completion) + sprintf('SELECT ID, guid FROM releases WHERE completion < %d AND completion > 0', $this->completion) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); $completionDeleted++; } } @@ -1250,12 +1250,12 @@ class ProcessReleases if (count($disabledCategories) > 0) { foreach ($disabledCategories as $disabledCategory) { $releases = $this->pdo->queryDirect( - sprintf('SELECT id, guid FROM releases WHERE categoryID = %d', $disabledCategory['id']) + sprintf('SELECT ID, guid FROM releases WHERE categoryID = %d', $disabledCategory['ID']) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { $disabledCategoryDeleted++; - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); } } } @@ -1263,11 +1263,11 @@ class ProcessReleases // Delete smaller than category minimum sizes. $categories = $this->pdo->queryDirect(' - SELECT c.id AS id, + SELECT c.ID AS id, CASE WHEN c.minsizetoformrelease = 0 THEN cp.minsizetoformrelease ELSE c.minsizetoformrelease END AS minsize FROM category c - INNER JOIN category cp ON cp.id = c.parentid - WHERE c.parentid IS NOT NULL' + INNER JOIN category cp ON cp.ID = c.parentID + WHERE c.parentID IS NOT NULL' ); if ($categories instanceof \Traversable) { @@ -1275,17 +1275,17 @@ class ProcessReleases if ($category['minsize'] > 0) { $releases = $this->pdo->queryDirect( sprintf(' - SELECT r.id, r.guid + SELECT r.ID, r.guid FROM releases r WHERE r.categoryID = %d AND r.size < %d', - $category['id'], + $category['ID'], $category['minsize'] ) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); $categoryMinSizeDeleted++; } } @@ -1299,17 +1299,17 @@ class ProcessReleases foreach ($genrelist as $genre) { $releases = $this->pdo->queryDirect( sprintf(' - SELECT id, guid + SELECT ID, guid FROM releases - INNER JOIN (SELECT id AS mid FROM musicinfo WHERE musicinfo.genre_id = %d) mi - ON musicinfoid = mid', - $genre['id'] + INNER JOIN (SELECT ID AS mid FROM musicinfo WHERE musicinfo.genreID = %d) mi + ON musicinfoID = mid', + $genre['ID'] ) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { $disabledGenreDeleted++; - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); } } } @@ -1319,7 +1319,7 @@ class ProcessReleases if ($this->site->miscotherretentionhours > 0) { $releases = $this->pdo->queryDirect( sprintf(' - SELECT id, guid + SELECT ID, guid FROM releases WHERE categoryID = %d AND adddate <= NOW() - INTERVAL %d HOUR', @@ -1329,7 +1329,7 @@ class ProcessReleases ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); $miscRetentionDeleted++; } } diff --git a/lib/nzbcontents.php b/lib/nzbcontents.php index dc3841458..0d5cbe2bf 100644 --- a/lib/nzbcontents.php +++ b/lib/nzbcontents.php @@ -247,7 +247,7 @@ Class NZBContents public function LoadNZB(&$guid) { // Fetch the NZB location using the GUID. - $nzbPath = $this->nzb->getNZBPath($guid); + $nzbPath = $this->nzb->NZBPath($guid); if ($nzbPath === false) { if ($this->echooutput) { echo PHP_EOL . $guid . ' appears to be missing the nzb file, skipping.' . PHP_EOL; diff --git a/lib/testing/DB/populate_nzb_guid.php b/lib/testing/DB/populate_nzb_guid.php index f72effd57..98741edf2 100644 --- a/lib/testing/DB/populate_nzb_guid.php +++ b/lib/testing/DB/populate_nzb_guid.php @@ -48,7 +48,7 @@ function create_guids($live, $delete = false) if ($relrecs instanceof \Traversable) { foreach ($relrecs as $relrec) { $reccnt++; - $nzbpath = $nzb->getNZBPath($relrec['guid']); + $nzbpath = $nzb->NZBPath($relrec['guid']); if ($nzbpath !== false) { $nzbfile = Utility::unzipGzipFile($nzbpath); if ($nzbfile) {