本文整理汇总了PHP中Groups::getByNameByID方法的典型用法代码示例。如果您正苦于以下问题:PHP Groups::getByNameByID方法的具体用法?PHP Groups::getByNameByID怎么用?PHP Groups::getByNameByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Groups
的用法示例。
在下文中一共展示了Groups::getByNameByID方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _resetReleaseStatus
/**
* 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;
}
示例2: parsePAR2
/**
* 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;
}
示例3: processNfoFiles
/**
* 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;
}
//.........这里部分代码省略.........
示例4: preName
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"]);
//.........这里部分代码省略.........
示例5: testRegex
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;
}
示例6: exit
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']}");
示例7: print_str
$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);