当前位置: 首页>>代码示例>>PHP>>正文


PHP Groups::getByName方法代码示例

本文整理汇总了PHP中Groups::getByName方法的典型用法代码示例。如果您正苦于以下问题:PHP Groups::getByName方法的具体用法?PHP Groups::getByName怎么用?PHP Groups::getByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Groups的用法示例。


在下文中一共展示了Groups::getByName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: backfillAllGroups

 /**
  * Update all active groups categories and descriptions.
  */
 function backfillAllGroups($groupName = '', $backfillDate = null, $regexOnly = false)
 {
     $n = $this->n;
     $groups = new Groups();
     $res = false;
     if ($groupName != '') {
         $grp = $groups->getByName($groupName);
         if ($grp) {
             $res = array($grp);
         }
     } else {
         $res = $groups->getActive();
     }
     if ($res) {
         foreach ($res as $groupArr) {
             $this->backfillGroup($groupArr, $backfillDate, $regexOnly);
         }
     } else {
         echo "No groups specified. Ensure groups are added to newznab's database for updating.{$n}";
     }
 }
开发者ID:scriptzteam,项目名称:newzNZB-premium-indexer,代码行数:24,代码来源:backfill.php

示例2: backfillAllGroups

 function backfillAllGroups($groupName = '', $backfillDate = null)
 {
     $n = $this->n;
     $groups = new Groups();
     if ($groupName != '') {
         $grp = $groups->getByName($groupName);
         if ($grp) {
             $res = array($grp);
         }
     } else {
         $res = $groups->getActive();
     }
     if ($res) {
         $nntp = new Nntp();
         $nntp->doConnect();
         foreach ($res as $groupArr) {
             $this->backfillGroup($nntp, $groupArr, $backfillDate);
         }
         $nntp->doQuit();
     } else {
         echo "No groups specified. Ensure groups are added to newznab's database for updating.{$n}";
     }
 }
开发者ID:ehsanguru,项目名称:nnplus,代码行数:23,代码来源:backfill.php

示例3: processReleases

 /**
  * @param int    $categorize
  * @param int    $postProcess
  * @param string $groupName (optional)
  * @param \NNTP   $nntp
  * @param bool   $echooutput
  *
  * @return int
  */
 public function processReleases($categorize, $postProcess, $groupName, &$nntp, $echooutput)
 {
     $this->echoCLI = $echooutput && NN_ECHOCLI;
     $page = new Page();
     $groupID = '';
     $s = new Sites();
     echo $s->getLicense();
     if (!empty($groupName)) {
         $groupInfo = $this->groups->getByName($groupName);
         $groupID = $groupInfo['id'];
     }
     $processReleases = microtime(true);
     if ($this->echoCLI) {
         $this->pdo->log->doEcho($this->pdo->log->header("Starting release update process (" . date('Y-m-d H:i:s') . ")"), true);
     }
     if (!file_exists($page->settings->getSetting('nzbpath'))) {
         $this->pdo->log->doEcho($this->pdo->log->primary('Bad or missing nzb directory - ' . $page->settings->getSetting('nzbpath')), true);
         return -1;
     }
     $this->checkRegexesUptoDate($page->settings->getSetting('latestregexurl'), $page->settings->getSetting('latestregexrevision'), $page->settings->getSetting('newznabID'));
     $this->applyRegex($groupID);
     $this->processIncompleteBinaries($groupID);
     $DIR = NN_MISC;
     $PYTHON = shell_exec('which python3 2>/dev/null');
     $PYTHON = empty($PYTHON) ? 'python -OOu' : 'python3 -OOu';
     $processRequestIDs = (int) $page->settings->getSetting('lookup_reqids');
     $consoleTools = new ConsoleTools(['ColorCLI' => $this->pdo->log]);
     $totalReleasesAdded = 0;
     do {
         $releasesCount = $this->createReleases($groupID);
         $totalReleasesAdded += $releasesCount['added'];
         if ($processRequestIDs === 0) {
             $this->processRequestIDs($groupID, 5000, true);
         } else {
             if ($processRequestIDs === 1) {
                 $this->processRequestIDs($groupID, 5000, true);
                 $this->processRequestIDs($groupID, 1000, false);
             } else {
                 if ($processRequestIDs === 2) {
                     $requestIDTime = time();
                     if ($this->echoCLI) {
                         $this->pdo->log->doEcho($this->pdo->log->header("Process Releases -> Request id Threaded lookup."));
                     }
                     passthru("{$PYTHON} {$DIR}update_scripts/nix_scripts/tmux/python/requestid_threaded.py");
                     if ($this->echoCLI) {
                         $this->pdo->log->doEcho($this->pdo->log->primary("\nReleases updated in " . $consoleTools->convertTime(time() - $requestIDTime)));
                     }
                 }
             }
         }
         $this->categorizeReleases($categorize, $groupID);
         $this->postProcessReleases($postProcess, $nntp);
         $this->deleteBinaries($groupID);
         // This loops as long as there were releases created or 3 loops, otherwise, you could loop indefinately
     } while ($releasesCount['added'] + $releasesCount['dupes'] >= $this->releaseCreationLimit);
     $this->deletedReleasesByGroup($groupID);
     $this->deleteReleases();
     //
     // User/Request housekeeping, should ideally move this to its own section, but it needs to be done automatically.
     //
     $users = new Users();
     $users->pruneRequestHistory($page->settings->getSetting('userdownloadpurgedays'));
     //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 binaries ' . (!empty($groupID) ? ' WHERE groupid = ' . $groupID : ''));
         $this->pdo->log->doEcho($this->pdo->log->primary('Completed adding ' . number_format($totalReleasesAdded) . ' releases in ' . $this->consoleTools->convertTime(number_format(microtime(true) - $processReleases, 2)) . '. ' . number_format($countID === false ? 0 : $countID['count']) . ' binaries waiting to be converted (still incomplete or in queue for creation)'), true);
     }
     return $totalReleasesAdded;
 }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:78,代码来源:Releases.php

示例4: dirname

<?php

/* Argument 1 is optional string, group name. Or numeric, number of header max to download.
 * Argument 2 is optional int, max number of headers to download.
 */
require_once dirname(__FILE__) . '/config.php';
$pdo = new \nzedb\db\Settings();
// Create the connection here and pass
$nntp = new NNTP(['Settings' => $pdo]);
if ($nntp->doConnect() !== true) {
    exit($pdo->log->error("Unable to connect to usenet."));
}
$binaries = new Binaries(['NNTP' => $nntp, 'Settings' => $pdo]);
if (isset($argv[1]) && !is_numeric($argv[1])) {
    $groupName = $argv[1];
    echo $pdo->log->header("Updating group: {$groupName}");
    $grp = new Groups(['Settings' => $pdo]);
    $group = $grp->getByName($groupName);
    if (is_array($group)) {
        $binaries->updateGroup($group, isset($argv[2]) && is_numeric($argv[2]) && $argv[2] > 0 ? $argv[2] : 0);
    }
} else {
    $binaries->updateAllGroups(isset($argv[1]) && is_numeric($argv[1]) && $argv[1] > 0 ? $argv[1] : 0);
}
开发者ID:Jay204,项目名称:nZEDb,代码行数:24,代码来源:update_binaries.php

示例5: backfillAllGroups

 /**
  * Backfill all the groups up to user specified time/date.
  *
  * @param string $groupName
  * @param string|int $articles
  * @param string $type
  *
  * @return void
  */
 public function backfillAllGroups($groupName = '', $articles = '', $type = '')
 {
     $res = [];
     if ($groupName !== '') {
         $grp = $this->_groups->getByName($groupName);
         if ($grp) {
             $res = [$grp];
         }
     } else {
         if ($type === 'normal' || $type === '') {
             $res = $this->_groups->getActiveBackfill();
         } else {
             if ($type === 'date') {
                 $res = $this->_groups->getActiveByDateBackfill();
             }
         }
     }
     $groupCount = count($res);
     if ($groupCount > 0) {
         $counter = 1;
         $allTime = microtime(true);
         $dMessage = 'Backfilling: ' . $groupCount . ' group(s) - Using compression? ' . ($this->_compressedHeaders ? 'Yes' : 'No');
         if ($this->_debug) {
             $this->_debugging->log('Backfill', "backfillAllGroups", $dMessage, Logger::LOG_INFO);
         }
         if ($this->_echoCLI) {
             $this->pdo->log->doEcho($this->pdo->log->header($dMessage), true);
         }
         $this->_binaries = new \Binaries(['NNTP' => $this->_nntp, 'Echo' => $this->_echoCLI, 'Settings' => $this->pdo, 'Groups' => $this->_groups]);
         if ($articles !== '' && !is_numeric($articles)) {
             $articles = 20000;
         }
         // Loop through groups.
         foreach ($res as $groupArr) {
             if ($groupName === '') {
                 $dMessage = "Starting group " . $counter . ' of ' . $groupCount;
                 if ($this->_debug) {
                     $this->_debugging->log('Backfill', "backfillAllGroups", $dMessage, Logger::LOG_INFO);
                 }
                 if ($this->_echoCLI) {
                     $this->pdo->log->doEcho($this->pdo->log->header($dMessage), true);
                 }
             }
             $this->backfillGroup($groupArr, $groupCount - $counter, $articles);
             $counter++;
         }
         $dMessage = 'Backfilling completed in ' . number_format(microtime(true) - $allTime, 2) . " seconds.";
         if ($this->_debug) {
             $this->_debugging->log('Backfill', "backfillAllGroups", $dMessage, Logger::LOG_INFO);
         }
         if ($this->_echoCLI) {
             $this->pdo->log->doEcho($this->pdo->log->primary($dMessage));
         }
     } else {
         $dMessage = "No groups specified. Ensure groups are added to nZEDb's database for updating.";
         if ($this->_debug) {
             $this->_debugging->log('Backfill', "backfillAllGroups", $dMessage, Logger::LOG_FATAL);
         }
         if ($this->_echoCLI) {
             $this->pdo->log->doEcho($this->pdo->log->warning($dMessage), true);
         }
     }
 }
开发者ID:Jay204,项目名称:nZEDb,代码行数:72,代码来源:Backfill.php

示例6: relativeTime

<?php

require_once dirname(__FILE__) . "/config.php";
$time = TIME();
$c = new ColorCLI();
if (isset($argv[1])) {
    $group = $argv[1];
    echo $c->header("Updating group {$group}");
    $g = new Groups();
    $group = $g->getByName($group);
    $bin = new Binaries();
    $bin->updateGroup($group);
} else {
    $binaries = new Binaries();
    $binaries->updateAllGroups();
}
function relativeTime($_time)
{
    $d = array();
    $d[0] = array(1, "sec");
    $d[1] = array(60, "min");
    $d[2] = array(3600, "hr");
    $d[3] = array(86400, "day");
    $d[4] = array(31104000, "yr");
    $w = array();
    $return = "";
    $now = TIME();
    $diff = $now - $_time;
    $secondsLeft = $diff;
    for ($i = 4; $i > -1; $i--) {
        $w[$i] = intval($secondsLeft / $d[$i][0]);
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:31,代码来源:update_binaries.php

示例7: Settings

         (new \RequestIDLocal(['Echo' => true]))->lookupRequestIDs(['GroupID' => $options[2], 'limit' => 5000]);
     }
     break;
     /* Update a single group's article headers.
      *
      * $options[2] => (string) Group name.
      */
 /* Update a single group's article headers.
  *
  * $options[2] => (string) Group name.
  */
 case 'update_group_headers':
     $pdo = new Settings();
     $nntp = nntp($pdo);
     $groups = new \Groups();
     $groupMySQL = $groups->getByName($options[2]);
     (new \Binaries(['NNTP' => $nntp, 'Groups' => $groups, 'Settings' => $pdo]))->updateGroup($groupMySQL);
     break;
     // Do a single group (update_binaries/backFill/update_releases/postprocess).
     // $options[2] => (int)groupid, group to work on
 // Do a single group (update_binaries/backFill/update_releases/postprocess).
 // $options[2] => (int)groupid, group to work on
 case 'update_per_group':
     if (is_numeric($options[2])) {
         $pdo = new Settings();
         // Get the group info from MySQL.
         $groupMySQL = $pdo->queryOneRow(sprintf('SELECT * FROM groups WHERE id = %d', $options[2]));
         if ($groupMySQL === false) {
             exit('ERROR: Group not found with id ' . $options[2] . PHP_EOL);
         }
         // Connect to NNTP.
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:31,代码来源:switch.php

示例8: processReleases

 /**
  * Main method for creating releases/NZB files from collections.
  *
  * @param int    $categorize
  * @param int    $postProcess
  * @param string $groupName (optional)
  * @param NNTP   $nntp
  * @param bool   $echooutput
  *
  * @return int
  */
 public function processReleases($categorize, $postProcess, $groupName, &$nntp, $echooutput)
 {
     $this->echoCLI = $echooutput && nZEDb_ECHOCLI;
     $groupID = '';
     if (!empty($groupName)) {
         $groupInfo = $this->groups->getByName($groupName);
         $groupID = $groupInfo['id'];
     }
     $processReleases = microtime(true);
     if ($this->echoCLI) {
         $this->pdo->log->doEcho($this->pdo->log->header("Starting release update process (" . date('Y-m-d H:i:s') . ")"), true);
     }
     if (!file_exists($this->pdo->getSetting('nzbpath'))) {
         if ($this->echoCLI) {
             $this->pdo->log->doEcho($this->pdo->log->error('Bad or missing nzb directory - ' . $this->pdo->getSetting('nzbpath')), true);
         }
         return 0;
     }
     $this->processIncompleteCollections($groupID);
     $this->processCollectionSizes($groupID);
     $this->deleteUnwantedCollections($groupID);
     $DIR = nZEDb_MISC;
     $PYTHON = shell_exec('which python3 2>/dev/null');
     $PYTHON = empty($PYTHON) ? 'python -OOu' : 'python3 -OOu';
     $totalReleasesAdded = $loops = 0;
     do {
         $releasesAdded = $this->createReleases($groupID);
         $totalReleasesAdded += $releasesAdded;
         $nzbFilesAdded = $this->createNZBs($groupID);
         if ($this->processRequestIDs === 0) {
             $this->processRequestIDs($groupID, 5000, true);
         } else {
             if ($this->processRequestIDs === 1) {
                 $this->processRequestIDs($groupID, 5000, true);
                 $this->processRequestIDs($groupID, 1000, false);
             } else {
                 if ($this->processRequestIDs === 2) {
                     $requestIDTime = time();
                     if ($this->echoCLI) {
                         $this->pdo->log->doEcho($this->pdo->log->header("Process Releases -> Request ID Threaded lookup."));
                     }
                     passthru("{$PYTHON} {$DIR}update/python/requestid_threaded.py");
                     if ($this->echoCLI) {
                         $this->pdo->log->doEcho($this->pdo->log->primary("\nReleases updated in " . $this->consoleTools->convertTime(time() - $requestIDTime)));
                     }
                 }
             }
         }
         $this->categorizeReleases($categorize, $groupID);
         $this->postProcessReleases($postProcess, $nntp);
         $this->deleteCollections($groupID);
         // This loops as long as there were releases created or 3 loops, otherwise, you could loop indefinately
     } while (($nzbFilesAdded > 0 || $releasesAdded > 0) && $loops++ < 3);
     $this->deletedReleasesByGroup($groupID);
     $this->deleteReleases();
     //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 : ''));
         $this->pdo->log->doEcho($this->pdo->log->primary('Completed adding ' . number_format($totalReleasesAdded) . ' releases in ' . $this->consoleTools->convertTime(number_format(microtime(true) - $processReleases, 2)) . '. ' . number_format($countID === false ? 0 : $countID['count']) . ' collections waiting to be created (still incomplete or in queue for creation)'), true);
     }
     return $totalReleasesAdded;
 }
开发者ID:Jay204,项目名称:nZEDb,代码行数:73,代码来源:ProcessReleases.php


注:本文中的Groups::getByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。