/** * Reset some variables for the current release. */ protected function _resetReleaseStatus() { // Only process for samples, previews and images if not disabled. $this->_foundVideo = $this->_processVideo ? false : true; $this->_foundMediaInfo = $this->_processMediaInfo ? false : true; $this->_foundAudioInfo = $this->_processAudioInfo ? false : true; $this->_foundAudioSample = $this->_processAudioSample ? false : true; $this->_foundJPGSample = $this->_processJPGSample ? false : true; $this->_foundSample = $this->_processThumbnails ? false : true; $this->_foundSample = $this->_release['disablepreview'] == 1 ? true : false; $this->_foundPAR2Info = false; $this->_passwordStatus = [\Releases::PASSWD_NONE]; $this->_releaseHasPassword = false; $this->_releaseGroupName = $this->_groups->getByNameByID($this->_release['groupid']); $this->_releaseHasNoNFO = false; // Make sure we don't already have an nfo. if ($this->_release['nfostatus'] != 1) { $this->_releaseHasNoNFO = true; } $this->_NZBHasCompressedFile = false; $this->_sampleMessageIDs = $this->_JPGMessageIDs = $this->_MediaInfoMessageIDs = []; $this->_AudioInfoMessageIDs = $this->_RARFileMessageIDs = []; $this->_AudioInfoExtension = ''; $this->_addedFileInfo = 0; $this->_totalFileInfo = 0; $this->_compressedFilesChecked = 0; }
/** * Attempt to get a better name from a par2 file and categorize the release. * * @note Called from NZBContents.php * * @param string $messageID MessageID from NZB file. * @param int $relID id of the release. * @param int $groupID Group id of the release. * @param \NNTP $nntp Class NNTP * @param int $show Only show result or apply iy. * * @return bool */ public function parsePAR2($messageID, $relID, $groupID, &$nntp, $show) { if ($messageID === '') { return false; } $query = $this->pdo->queryOneRow(sprintf(' SELECT id, groupid, categoryid, name, searchname, UNIX_TIMESTAMP(postdate) AS post_date, id AS releaseid FROM releases WHERE isrenamed = 0 AND id = %d', $relID)); if ($query === false) { return false; } // Only get a new name if the category is OTHER. $foundName = true; if (!in_array((int) $query['categoryid'], array(\Category::CAT_BOOK_OTHER, \Category::CAT_GAME_OTHER, \Category::CAT_MOVIE_OTHER, \Category::CAT_MUSIC_OTHER, \Category::CAT_PC_MOBILEOTHER, \Category::CAT_TV_OTHER, \Category::CAT_MISC_HASHED, \Category::CAT_XXX_OTHER, \Category::CAT_MISC_OTHER))) { $foundName = false; } // Get the PAR2 file. $par2 = $nntp->getMessages($this->groups->getByNameByID($groupID), $messageID, $this->alternateNNTP); if ($nntp->isError($par2)) { return false; } // Put the PAR2 into Par2Info, check if there's an error. $this->_par2Info->setData($par2); if ($this->_par2Info->error) { return false; } // Get the file list from Par2Info. $files = $this->_par2Info->getFileList(); if ($files !== false && count($files) > 0) { $filesAdded = 0; // Loop through the files. foreach ($files as $file) { if (!isset($file['name'])) { continue; } // If we found a name and added 10 files, stop. if ($foundName === true && $filesAdded > 10) { break; } if ($this->addpar2) { // Add to release files. if ($filesAdded < 11 && $this->pdo->queryOneRow(sprintf(' SELECT id FROM releasefiles WHERE releaseid = %d AND name = %s', $relID, $this->pdo->escapeString($file['name']))) === false) { // Try to add the files to the DB. if ($this->releaseFiles->add($relID, $file['name'], $file['size'], $query['post_date'], 0)) { $filesAdded++; } } } else { $filesAdded++; } // Try to get a new name. if ($foundName === false) { $query['textstring'] = $file['name']; if ($this->nameFixer->checkName($query, 1, 'PAR2, ', 1, $show) === true) { $foundName = true; } } } // If we found some files. if ($filesAdded > 0) { $this->debugging->log(get_class(), __FUNCTION__, 'Added ' . $filesAdded . ' releasefiles from PAR2 for ' . $query['searchname'], \Logger::LOG_INFO); // Update the file count with the new file count + old file count. $this->pdo->queryExec(sprintf(' UPDATE releases SET rarinnerfilecount = rarinnerfilecount + %d WHERE id = %d', $filesAdded, $relID)); } if ($foundName === true) { return true; } } return false; }
/** * Attempt to find NFO files inside the NZB's of releases. * * @param object $nntp Instance of class NNTP. * @param string $groupID (optional) Group id. * @param string $guidChar (optional) First character of the release GUID (used for multi-processing). * @param int $processImdb (optional) Attempt to find IMDB id's in the NZB? * @param int $processTvrage (optional) Attempt to find TvRage id's in the NZB? * * @return int How many NFO's were processed? * * @access public */ public function processNfoFiles($nntp, $groupID = '', $guidChar = '', $processImdb = 1, $processTvrage = 1) { $ret = 0; $guidCharQuery = $guidChar === '' ? '' : 'AND r.guid ' . $this->pdo->likeString($guidChar, false, true); $groupIDQuery = $groupID === '' ? '' : 'AND r.groupid = ' . $groupID; $optionsQuery = self::NfoQueryString($this->pdo); $res = $this->pdo->query(sprintf(' SELECT r.id, r.guid, r.groupid, r.name FROM releases r WHERE 1=1 %s %s %s ORDER BY r.nfostatus ASC, r.postdate DESC LIMIT %d', $optionsQuery, $guidCharQuery, $groupIDQuery, $this->nzbs)); $nfoCount = count($res); if ($nfoCount > 0) { $this->pdo->log->doEcho($this->pdo->log->primary(PHP_EOL . ($guidChar === '' ? '' : '[' . $guidChar . '] ') . ($groupID === '' ? '' : '[' . $groupID . '] ') . 'Processing ' . $nfoCount . ' NFO(s), starting at ' . $this->nzbs . ' * = hidden NFO, + = NFO, - = no NFO, f = download failed.')); if ($this->echo) { // Get count of releases per nfo status $nfoStats = $this->pdo->queryDirect(sprintf(' SELECT r.nfostatus AS status, COUNT(*) AS count FROM releases r WHERE 1=1 %s %s %s GROUP BY r.nfostatus ORDER BY r.nfostatus ASC', $optionsQuery, $guidCharQuery, $groupIDQuery)); if ($nfoStats instanceof Traversable) { $outString = PHP_EOL . 'Available to process'; foreach ($nfoStats as $row) { $outString .= ', ' . $row['status'] . ' = ' . number_format($row['count']); } $this->pdo->log->doEcho($this->pdo->log->header($outString . '.')); } } $groups = new Groups(['Settings' => $this->pdo]); $nzbContents = new NZBContents(['Echo' => $this->echo, 'NNTP' => $nntp, 'Nfo' => $this, 'Settings' => $this->pdo, 'PostProcess' => new PostProcess(['Echo' => $this->echo, 'Nfo' => $this, 'Settings' => $this->pdo])]); $movie = new Movie(['Echo' => $this->echo, 'Settings' => $this->pdo]); $tvRage = new TvRage(['Echo' => $this->echo, 'Settings' => $this->pdo]); foreach ($res as $arr) { $fetchedBinary = $nzbContents->getNFOfromNZB($arr['guid'], $arr['id'], $arr['groupid'], $groups->getByNameByID($arr['groupid'])); if ($fetchedBinary !== false) { // Insert nfo into database. $cp = 'COMPRESS(%s)'; $nc = $this->pdo->escapeString($fetchedBinary); $ckreleaseid = $this->pdo->queryOneRow(sprintf('SELECT id FROM releasenfo WHERE releaseid = %d', $arr['id'])); if (!isset($ckreleaseid['id'])) { $this->pdo->queryInsert(sprintf('INSERT INTO releasenfo (nfo, releaseid) VALUES (' . $cp . ', %d)', $nc, $arr['id'])); } $this->pdo->queryExec(sprintf('UPDATE releases SET nfostatus = %d WHERE id = %d', self::NFO_FOUND, $arr['id'])); $ret++; $movie->doMovieUpdate($fetchedBinary, 'nfo', $arr['id'], $processImdb); // If set scan for tvrage info. if ($processTvrage == 1) { $rageId = $this->parseRageId($fetchedBinary); if ($rageId !== false) { $show = $tvRage->parseNameEpSeason($arr['name']); if (is_array($show) && $show['name'] != '') { // Update release with season, ep, and air date info (if available) from release title. $tvRage->updateEpInfo($show, $arr['id']); $rid = $tvRage->getByRageID($rageId); if (!$rid) { $tvrShow = $tvRage->getRageInfoFromService($rageId); $tvRage->updateRageInfo($rageId, $show, $tvrShow, $arr['id']); } } } } } } } // Remove nfo that we cant fetch after 5 attempts. $releases = $this->pdo->queryDirect(sprintf('SELECT r.id FROM releases r WHERE r.nzbstatus = %d AND r.nfostatus < %d %s %s', NZB::NZB_ADDED, $this->maxRetries, $groupIDQuery, $guidCharQuery)); if ($releases instanceof Traversable) { foreach ($releases as $release) { $this->pdo->queryExec(sprintf('DELETE FROM releasenfo WHERE nfo IS NULL AND releaseid = %d', $release['id'])); } } // Set releases with no NFO. $this->pdo->queryExec(sprintf(' UPDATE releases r SET r.nfostatus = %d WHERE r.nzbstatus = %d AND r.nfostatus < %d %s %s', self::NFO_FAILED, NZB::NZB_ADDED, $this->maxRetries, $groupIDQuery, $guidCharQuery)); if ($this->echo) { if ($nfoCount > 0) { echo PHP_EOL; } if ($ret > 0) { $this->pdo->log->doEcho($ret . ' NFO file(s) found/processed.', true); } } return $ret; }
function preName($argv, $argc) { global $pdo; $groups = new \Groups(['Settings' => $pdo]); $category = new \Categorize(['Settings' => $pdo]); $internal = $external = $pre = 0; $show = 2; if ($argv[$argc - 1] === 'show') { $show = 1; } else { if ($argv[$argc - 1] === 'bad') { $show = 3; } } $counter = 0; $pdo->log = new \ColorCLI(); $full = $all = $usepre = false; $what = $where = ''; if ($argv[1] === 'full') { $full = true; } else { if ($argv[1] === 'all') { $all = true; } else { if ($argv[1] === 'preid') { $usepre = true; } else { if (is_numeric($argv[1])) { $what = ' AND adddate > NOW() - INTERVAL ' . $argv[1] . ' HOUR'; } } } } if ($usepre === true) { $where = ''; $why = ' WHERE prehashid = 0 AND nzbstatus = 1'; } else { if (isset($argv[1]) && is_numeric($argv[1])) { $where = ''; $why = ' WHERE nzbstatus = 1 AND isrenamed = 0'; } else { if (isset($argv[2]) && is_numeric($argv[2]) && $full === true) { $where = ' AND groupid = ' . $argv[2]; $why = ' WHERE nzbstatus = 1 AND isrenamed = 0'; } else { if (isset($argv[2]) && preg_match('/\\([\\d, ]+\\)/', $argv[2]) && $full === true) { $where = ' AND groupid IN ' . $argv[2]; $why = ' WHERE nzbstatus = 1 AND isrenamed = 0'; } else { if (isset($argv[2]) && preg_match('/\\([\\d, ]+\\)/', $argv[2]) && $all === true) { $where = ' AND groupid IN ' . $argv[2]; $why = ' WHERE nzbstatus = 1'; } else { if (isset($argv[2]) && is_numeric($argv[2]) && $all === true) { $where = ' AND groupid = ' . $argv[2]; $why = ' WHERE nzbstatus = 1 and prehashid = 0'; } else { if (isset($argv[2]) && is_numeric($argv[2])) { $where = ' AND groupid = ' . $argv[2]; $why = ' WHERE nzbstatus = 1 AND isrenamed = 0'; } else { if ($full === true) { $why = ' WHERE nzbstatus = 1 AND (isrenamed = 0 OR categoryid between 8000 AND 8999)'; } else { if ($all === true) { $why = ' WHERE nzbstatus = 1'; } else { $why = ' WHERE 1=1'; } } } } } } } } } resetSearchnames(); echo $pdo->log->header("SELECT id, name, searchname, fromname, size, groupid, categoryid FROM releases" . $why . $what . $where . ";\n"); $res = $pdo->queryDirect("SELECT id, name, searchname, fromname, size, groupid, categoryid FROM releases" . $why . $what . $where); $total = $res->rowCount(); if ($total > 0) { $consoletools = new \ConsoleTools(['ColorCLI' => $pdo->log]); foreach ($res as $row) { $groupname = $groups->getByNameByID($row['groupid']); $cleanerName = releaseCleaner($row['name'], $row['fromname'], $row['size'], $groupname, $usepre); $preid = 0; $predb = $predbfile = $increment = false; if (!is_array($cleanerName)) { $cleanName = trim((string) $cleanerName); $propername = $increment = true; if ($cleanName != '' && $cleanerName != false) { $run = $pdo->queryOneRow("SELECT id FROM prehash WHERE title = " . $pdo->escapeString($cleanName)); if (isset($run['id'])) { $preid = $run['id']; $predb = true; } } } else { $cleanName = trim($cleanerName["cleansubject"]); $propername = $cleanerName["properlynamed"]; if (isset($cleanerName["increment"])) { $increment = $cleanerName["increment"]; } if (isset($cleanerName["predb"])) { $preid = $cleanerName["predb"]; $predb = true; } } if ($cleanName != '') { if (preg_match('/alt\\.binaries\\.e\\-?book(\\.[a-z]+)?/', $groupname)) { if (preg_match('/^[0-9]{1,6}-[0-9]{1,6}-[0-9]{1,6}$/', $cleanName, $match)) { $rf = new \ReleaseFiles($pdo); $files = $rf->get($row['id']); foreach ($files as $f) { if (preg_match('/^(?P<title>.+?)(\\[\\w\\[\\]\\(\\). -]+)?\\.(pdf|htm(l)?|epub|mobi|azw|tif|doc(x)?|lit|txt|rtf|opf|fb2|prc|djvu|cb[rz])/', $f["name"], $match)) { $cleanName = $match['title']; break; } } } } //try to match clean name against predb filename $prefile = $pdo->queryOneRow("SELECT id, title FROM prehash WHERE filename = " . $pdo->escapeString($cleanName)); if (isset($prefile['id'])) { $preid = $prefile['id']; $cleanName = $prefile['title']; $predbfile = true; $propername = true; } if ($cleanName != $row['name'] && $cleanName != $row['searchname']) { if (strlen(utf8_decode($cleanName)) <= 3) { } else { $determinedcat = $category->determineCategory($row["groupid"], $cleanName); if ($propername == true) { $pdo->queryExec(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, " . "iscategorized = 1, isrenamed = 1, searchname = %s, categoryid = %d, prehashid = " . $preid . " WHERE id = %d", $pdo->escapeString($cleanName), $determinedcat, $row['id'])); } else { $pdo->queryExec(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, " . "iscategorized = 1, searchname = %s, categoryid = %d, prehashid = " . $preid . " WHERE id = %d", $pdo->escapeString($cleanName), $determinedcat, $row['id'])); } if ($increment === true) { $internal++; } else { if ($predb === true) { $pre++; } else { if ($predbfile === true) { $pre++; } else { if ($propername === true) { $external++; } } } } if ($show === 1) { $oldcatname = $category->getNameByID($row["categoryid"]); $newcatname = $category->getNameByID($determinedcat); \NameFixer::echoChangedReleaseName(array('new_name' => $cleanName, 'old_name' => $row["searchname"], 'new_category' => $newcatname, 'old_category' => $oldcatname, 'group' => $groupname, 'release_id' => $row["id"], 'method' => 'lib/testing/Dev/renametopre.php')); } } } else { if ($show === 3 && preg_match('/^\\[?\\d*\\].+?yEnc/i', $row['name'])) { echo $pdo->log->primary($row['name']); } } } if ($cleanName == $row['name']) { $pdo->queryExec(sprintf("UPDATE releases SET isrenamed = 1, iscategorized = 1 WHERE id = %d", $row['id'])); } if ($show === 2 && $usepre === false) { $consoletools->overWritePrimary("Renamed Releases: [Internal=" . number_format($internal) . "][External=" . number_format($external) . "][Predb=" . number_format($pre) . "] " . $consoletools->percentString(++$counter, $total)); } else { if ($show === 2 && $usepre === true) { $consoletools->overWritePrimary("Renamed Releases: [" . number_format($pre) . "] " . $consoletools->percentString(++$counter, $total)); } } } } echo $pdo->log->header("\n" . number_format($pre) . " renamed using preDB Match\n" . number_format($external) . " renamed using ReleaseCleaning.php\n" . number_format($internal) . " using renametopre.php\nout of " . number_format($total) . " releases.\n"); if (isset($argv[1]) && is_numeric($argv[1]) && !isset($argv[2])) { echo $pdo->log->header("Categorizing all releases using searchname from the last {$argv[1]} hours. This can take a while, be patient."); } else { if (isset($argv[1]) && $argv[1] !== "all" && isset($argv[2]) && !is_numeric($argv[2]) && !preg_match('/\\([\\d, ]+\\)/', $argv[2])) { echo $pdo->log->header("Categorizing all non-categorized releases in other->misc using searchname. This can take a while, be patient."); } else { if (isset($argv[1]) && isset($argv[2]) && (is_numeric($argv[2]) || preg_match('/\\([\\d, ]+\\)/', $argv[2]))) { echo $pdo->log->header("Categorizing all non-categorized releases in {$argv[2]} using searchname. This can take a while, be patient."); } else { echo $pdo->log->header("Categorizing all releases using searchname. This can take a while, be patient."); } } } $timestart = TIME(); if (isset($argv[1]) && is_numeric($argv[1])) { $relcount = catRelease("searchname", "WHERE (iscategorized = 0 OR categoryid = 8010) AND adddate > NOW() - INTERVAL " . $argv[1] . " HOUR", true); } else { if (isset($argv[2]) && preg_match('/\\([\\d, ]+\\)/', $argv[2]) && $full === true) { $relcount = catRelease("searchname", str_replace(" AND", "WHERE", $where) . " AND iscategorized = 0 ", true); } else { if (isset($argv[2]) && preg_match('/\\([\\d, ]+\\)/', $argv[2]) && $all === true) { $relcount = catRelease("searchname", str_replace(" AND", "WHERE", $where), true); } else { if (isset($argv[2]) && is_numeric($argv[2]) && $argv[1] == "full") { $relcount = catRelease("searchname", str_replace(" AND", "WHERE", $where) . " AND iscategorized = 0 ", true); } else { if (isset($argv[2]) && is_numeric($argv[2]) && $argv[1] == "all") { $relcount = catRelease("searchname", str_replace(" AND", "WHERE", $where), true); } else { if (isset($argv[1]) && $argv[1] == "full") { $relcount = catRelease("searchname", "WHERE categoryid = 8010 OR iscategorized = 0", true); } else { if (isset($argv[1]) && $argv[1] == "all") { $relcount = catRelease("searchname", "", true); } else { if (isset($argv[1]) && $argv[1] == "preid") { $relcount = catRelease("searchname", "WHERE prehashid = 0 AND nzbstatus = 1", true); } else { $relcount = catRelease("searchname", "WHERE (iscategorized = 0 OR categoryid = 8010) AND adddate > NOW() - INTERVAL " . $argv[1] . " HOUR", true); } } } } } } } } $consoletools = new \ConsoleTools(['ColorCLI' => $pdo->log]); $time = $consoletools->convertTime(TIME() - $timestart); echo $pdo->log->header("Finished categorizing " . number_format($relcount) . " releases in " . $time . " seconds, using the usenet subject.\n"); resetSearchnames(); }
public function testRegex($regex, $groupname, $poster, $ignorematched, $matchagainstbins) { $cat = new Categorize(); $groups = new Groups(); $groupID = $groups->getByNameByID($groupname); $group = $groups->getCBPTableNames($this->tablePerGroup, $groupID); $catList = $cat->getForSelect(); $matches = []; if ($groupname === 0) { $groupname = '.*'; } if ($matchagainstbins !== '') { $sql = sprintf("select b.*, '0' as size, '0' as blacklistID, g.name as groupname from %s b left join groups g on g.id = b.groupid where b.groupid IN (select g.id from groups g where g.name REGEXP %s) order by b.date desc", $group['bname'], $this->pdo->escapeString('^' . $groupname . '$')); } else { $sql = sprintf("select rrt.* from releaseregextesting rrt where rrt.groupname REGEXP %s order by rrt.date desc", $this->pdo->escapeString('^' . $groupname . '$')); } $resbin = $this->pdo->queryDirect($sql); while ($rowbin = $this->pdo->getAssocArray($resbin)) { if ($ignorematched !== '' && ($rowbin['regexid'] != '' || $rowbin['blacklistid'] == 1)) { continue; } $regexarr = array("id" => "", 'regex' => $regex, 'poster' => $poster, "categoryid" => ""); $regexCheck = $this->performMatch($regexarr, $rowbin['name'], $rowbin['fromname']); if ($regexCheck !== false) { $relname = $regexCheck['name']; $relparts = explode("/", $regexCheck['parts']); $matches[$relname]['name'] = $relname; $matches[$relname]['parts'] = $regexCheck['parts']; $matches[$relname]['bincount'] = isset($matches[$relname]['bincount']) ? $matches[$relname]['bincount'] + 1 : 1; $matches[$relname]['bininfo'][] = $rowbin; $matches[$relname]['binsize'][] = $rowbin['size']; $matches[$relname]['totalsize'] = array_sum($matches[$relname]['binsize']); $matches[$relname]['relparts'][$relparts[1]] = $relparts[1]; $matches[$relname]['reltotalparts'] = array_sum($matches[$relname]['relparts']); $matches[$relname]['regexid'] = $regexCheck['regexid']; if (ctype_digit($regexCheck['regcatid'])) { $matches[$relname]['catname'] = $catList[$regexCheck['regcatid']]; } else { $matches[$relname]['catname'] = $catList[$cat->determineCategory($groupname, $relname)]; } } } //echo '<pre>'; //print_r(array_pop($matches)); //echo '</pre>'; return $matches; }
echo $pdo->log->info("Creating new collections, binaries, and parts tables for each group that has collections."); foreach ($actgroups as $group) { $pdo->queryExec("DROP TABLE IF EXISTS collections_" . $group['group_id']); $pdo->queryExec("DROP TABLE IF EXISTS binaries_" . $group['group_id']); $pdo->queryExec("DROP TABLE IF EXISTS parts_" . $group['group_id']); if ($groups->createNewTPGTables($group['group_id']) === false) { exit($pdo->log->error("\nThere is a problem creating new parts/files tables for group {$group['name']}.\n")); } } $collections_rows = $pdo->queryDirect("SELECT group_id FROM collections GROUP BY group_id"); echo $pdo->log->info("Counting parts, this could table a few minutes."); $parts_count = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM parts"); $i = 0; if ($collections_rows instanceof Traversable) { foreach ($collections_rows as $row) { $groupName = $groups->getByNameByID($row['group_id']); echo $pdo->log->header("Processing {$groupName}"); //collection $pdo->queryExec("INSERT IGNORE INTO collections_" . $row['group_id'] . " (subject, fromname, date, xref, totalfiles, group_id, collectionhash, dateadded, filecheck, filesize, releaseid) " . "SELECT subject, fromname, date, xref, totalfiles, group_id, collectionhash, dateadded, filecheck, filesize, releaseid FROM collections WHERE group_id = {$row['group_id']}"); $collections = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM collections where group_id = " . $row['group_id']); $ncollections = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM collections_" . $row['group_id']); echo $pdo->log->primary("Group {$groupName}, Collections = {$collections['cnt']} [{$ncollections['cnt']}]"); //binaries $pdo->queryExec("INSERT IGNORE INTO binaries_{$row['group_id']} (name, filenumber, totalparts, currentparts, binaryhash, partcheck, partsize, collectionid) " . "SELECT name, filenumber, totalparts, currentparts, binaryhash, partcheck, partsize, n.id FROM binaries b " . "INNER JOIN collections c ON b.collectionid = c.id " . "INNER JOIN collections_{$row['group_id']} n ON c.collectionhash = n.collectionhash AND c.group_id = {$row['group_id']}"); $binaries = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM binaries b INNER JOIN collections c ON b.collectionid = c.id where c.group_id = {$row['group_id']}"); $nbinaries = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM binaries_{$row['group_id']}"); echo $pdo->log->primary("Group {$groupName}, Binaries = {$binaries['cnt']} [{$nbinaries['cnt']}]"); //parts $pdo->queryExec("INSERT IGNORE INTO parts_{$row['group_id']} (messageid, number, partnumber, size, binaryid, collection_id) " . "SELECT messageid, number, partnumber, size, n.id, c.id FROM parts p " . "INNER JOIN binaries b ON p.binaryid = b.id " . "INNER JOIN binaries_{$row['group_id']} n ON b.binaryhash = n.binaryhash " . "INNER JOIN collections_{$row['group_id']} c on c.id = n.collectionid AND c.group_id = {$row['group_id']}"); $parts = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM parts p INNER JOIN binaries b ON p.binaryid = b.id INNER JOIN collections c ON b.collectionid = c.id WHERE c.group_id = {$row['group_id']}"); $nparts = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM parts_{$row['group_id']}");
$pieces = explode(' ', $line); if (isset($pieces[0]) && isset($pieces[1])) { $groups = new Groups(); $group = $groups->getByNameByID($pieces[0]); test_regex($pieces[1], $group, $argv); echo "\n\n\n"; } } } else { if ($argv[1] == 'file') { exit("The file {$argv['1']} does not exist or and invalid file was specified.\n"); } } if (isset($argv[2]) && is_numeric($argv[2]) && $argv[1] != 'file') { $groups = new Groups(); $group = $groups->getByNameByID($argv[2]); test_regex($argv[1], $group, $argv); } else { if ($argv[1] != 'file') { test_regex($argv[1], null, $argv); } } function print_str($type, $str, $argv) { if ($argv[1] != 'file') { $cli = new ColorCLI(); if ($type == "primary") { echo $cli->primary($str); } else { if ($type == "alternate") { echo $cli->alternate($str);