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


PHP Groups::getActive方法代码示例

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


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

示例1: updateAllGroups

 /**
  * Process headers and store in database for all active groups.
  */
 function updateAllGroups()
 {
     $n = $this->n;
     $groups = new Groups();
     $res = $groups->getActive();
     $s = new Sites();
     echo $s->getLicense();
     if ($res) {
         shuffle($res);
         $alltime = microtime(true);
         echo 'Updating: ' . sizeof($res) . ' groups - Using compression? ' . ($this->compressedHeaders ? 'Yes' : 'No') . $n;
         $nntp = new Nntp();
         if ($nntp->doConnect()) {
             $pos = 0;
             foreach ($res as $groupArr) {
                 $pos++;
                 echo 'Group ' . $pos . ' of ' . sizeof($res) . $n;
                 $this->message = array();
                 $this->updateGroup($nntp, $groupArr);
             }
             $nntp->doQuit();
             echo 'Updating completed in ' . number_format(microtime(true) - $alltime, 2) . ' seconds' . $n;
         } else {
             echo "Failed to get NNTP connection.{$n}";
         }
     } else {
         echo "No groups specified. Ensure groups are added to newznab's database and activated before updating.{$n}";
     }
 }
开发者ID:scriptzteam,项目名称:newzNZB-premium-indexer,代码行数:32,代码来源:binaries.php

示例2: applyRegex

    /**
     * @param int|string $groupID (optional)
     */
    public function applyRegex($groupID)
    {
        //
        // Get all regexes for all groups which are to be applied to new binaries
        // in order of how they should be applied
        //
        $group = $this->groups->getCBPTableNames($this->tablePerGroup, $groupID);
        $activeGroups = $this->groups->getActive();
        $this->releaseRegex->get();
        $this->pdo->log->doEcho($this->pdo->log->primary('Applying regex to binaries'), true);
        foreach ($activeGroups as $groupArr) {
            //check if regexes have already been applied during update binaries
            if ($groupArr['regexmatchonly'] == 1) {
                continue;
            }
            $groupRegexes = $this->releaseRegex->getForGroup($groupArr['name']);
            $this->pdo->log->doEcho($this->pdo->log->primary('Applying ' . sizeof($groupRegexes) . ' regexes to group ' . $groupArr['name']), true);
            // Get out all binaries of STAGE0 for current group
            $newUnmatchedBinaries = array();
            $ressql = sprintf('SELECT id, name, date, totalparts, procstat, fromname FROM %s b
 								WHERE groupid = %d AND procstat IN (%d, %d) AND regexid IS NULL ORDER BY b.date ASC', $group['bname'], $groupArr['id'], Releases::PROCSTAT_NEW, Releases::PROCSTAT_TITLENOTMATCHED);
            $resbin = $this->pdo->queryDirect($ressql);
            $matchedbins = 0;
            while ($rowbin = $this->pdo->getAssocArray($resbin)) {
                $regexMatches = array();
                foreach ($groupRegexes as $groupRegex) {
                    $regexCheck = $this->releaseRegex->performMatch($groupRegex, $rowbin['name']);
                    if ($regexCheck !== false) {
                        $regexMatches = $regexCheck;
                        break;
                    }
                }
                if (!empty($regexMatches)) {
                    $matchedbins++;
                    $relparts = explode("/", $regexMatches['parts']);
                    $this->pdo->queryExec(sprintf("UPDATE %s SET relname = replace(%s, '_', ' '), relpart = %d, reltotalpart = %d, procstat=%d, categoryid=%s, regexid=%d, reqid=%s WHERE id = %d", $group['bname'], $this->pdo->escapeString($regexMatches['name']), $relparts[0], $relparts[1], Releases::PROCSTAT_TITLEMATCHED, $regexMatches['regcatid'], $regexMatches['regexid'], $this->pdo->escapeString($regexMatches['reqid']), $rowbin["id"]));
                } else {
                    if ($rowbin['procstat'] == Releases::PROCSTAT_NEW) {
                        $newUnmatchedBinaries[] = $rowbin['id'];
                    }
                }
            }
            //mark as not matched
            if (!empty($newUnmatchedBinaries)) {
                $this->pdo->queryExec(sprintf("UPDATE %s SET procstat=%d WHERE id IN (%s)", $group['bname'], Releases::PROCSTAT_TITLENOTMATCHED, implode(',', $newUnmatchedBinaries)));
            }
        }
    }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:51,代码来源:Releases.php

示例3: updateAllGroups

 /**
  * Download new headers for all active groups.
  *
  * @param int $maxHeaders (Optional) How many headers to download max.
  *
  * @return void
  */
 public function updateAllGroups($maxHeaders = 0)
 {
     $groups = $this->_groups->getActive();
     $groupCount = count($groups);
     if ($groupCount > 0) {
         $counter = 1;
         $allTime = microtime(true);
         $this->log('Updating: ' . $groupCount . ' group(s) - Using compression? ' . ($this->_compressedHeaders ? 'Yes' : 'No'), 'updateAllGroups', \Logger::LOG_INFO, 'header');
         // Loop through groups.
         foreach ($groups as $group) {
             $this->log('Starting group ' . $counter . ' of ' . $groupCount, 'updateAllGroups', \Logger::LOG_INFO, 'header');
             $this->updateGroup($group, $maxHeaders);
             $counter++;
         }
         $this->log('Updating completed in ' . number_format(microtime(true) - $allTime, 2) . ' seconds.', 'updateAllGroups', \Logger::LOG_INFO, 'primary');
     } else {
         $this->log('No groups specified. Ensure groups are added to newznab\'s database for updating.', 'updateAllGroups', \Logger::LOG_NOTICE, 'warning');
     }
 }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:26,代码来源:Binaries.php

示例4: 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

示例5: 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

示例6: header

         echo $content;
     } else {
         header('Content-type: application/json');
         echo json_encode(responseXmlToObject($content));
     }
     break;
     //
     // capabilities request
     //
 //
 // capabilities request
 //
 case "c":
     $parentcatlist = $category->getForMenu();
     $page->smarty->assign('parentcatlist', $parentcatlist);
     $grps = $grp->getActive();
     $page->smarty->assign('grps', $grps);
     $genres = $gen->getGenres('', true);
     $page->smarty->assign('genres', $genres);
     header("Content-type: text/xml");
     $output = $page->smarty->fetch('apicaps.tpl');
     if ($outputtype == "xml") {
         header("Content-type: text/xml");
         echo $output;
     } else {
         header('Content-type: application/json');
         echo json_encode(responseXmlToObject($output));
     }
     break;
     //
     // register request
开发者ID:scriptzteam,项目名称:newzNZB-premium-indexer,代码行数:31,代码来源:api.php

示例7: Groups

<?php

require "config.php";
require_once WWW_DIR . "/lib/groups.php";
require_once WWW_DIR . "/lib/binaries.php";
require_once WWW_DIR . '/lib/powerprocess.php';
$groups = new Groups();
$groupList = $groups->getActive();
unset($groups);
$ps = new PowerProcess();
$ps->RegisterCallback('psUpdateComplete');
$ps->maxThreads = 10;
$ps->tickCount = 10000;
// value in usecs. change this to 1000000 (one second) to reduce cpu use
$ps->threadTimeLimit = 0;
// Disable child timeout
echo "Starting threaded backfill process\n";
while ($ps->RunControlCode()) {
    // Start the parent loop
    if (count($groupList)) {
        // We still have groups to process
        if ($ps->SpawnReady()) {
            // Spawn another thread
            $ps->threadData = array_pop($groupList);
            echo "[Thread-MASTER] Spawning new thread.  Still have " . count($groupList) . " group(s) to update after this\n";
            $ps->spawnThread();
        } else {
            // There are no more slots available to run
            //$ps->tick();
            //echo ".\n";
        }
开发者ID:scriptzteam,项目名称:newzNZB-premium-indexer,代码行数:31,代码来源:backfill_threaded.php

示例8: dogroup

<?php

require_once dirname(__FILE__) . '/../../../../www/config.php';
if (!isset($argv[1])) {
    exit('You must start the script like this (# of articles) : php test-backfillcleansubject.php 20000' . "\n");
} else {
    $pdo = new nzedb\db\Settings();
    $nntp = new NNTP(['Settings' => $pdo]);
    if ($nntp->doConnect() !== true) {
        exit($pdo->log->error("Unable to connect to usenet."));
    }
    $backfill = new Backfill(['NNTP' => $nntp, 'Settings' => $pdo]);
    $groups = new Groups(['Settings' => $pdo]);
    $grouplist = $groups->getActive();
    foreach ($grouplist as $name) {
        dogroup($name["name"], $argv[1]);
    }
}
function dogroup($name, $articles)
{
    global $backfill, $pdo;
    $backfill->backfillAllGroups($name, $articles);
    echo $pdo->log->primaryOver("Type y and press enter to continue, n to quit.\n");
    if (trim(fgets(fopen("php://stdin", "r"))) == 'y') {
        return true;
    } else {
        exit($pdo->log->primary("Done"));
    }
}
开发者ID:Jay204,项目名称:nZEDb,代码行数:29,代码来源:test-backfillcollectionname.php

示例9: processReleases

 function processReleases()
 {
     require_once WWW_DIR . "/lib/binaries.php";
     $db = new DB();
     $currTime_ori = $db->queryOneRow("SELECT NOW() as now");
     $cat = new Category();
     $nzb = new Nzb();
     $s = new Sites();
     $releaseRegex = new ReleaseRegex();
     $page = new Page();
     $groups = new Groups();
     $retcount = 0;
     echo $s->getLicense();
     echo "\n\nStarting release update process (" . date("Y-m-d H:i:s") . ")\n";
     if (!file_exists($page->site->nzbpath)) {
         echo "Bad or missing nzb directory - " . $page->site->nzbpath;
         return -1;
     }
     //
     // Get all regexes for all groups which are to be applied to new binaries
     // in order of how they should be applied
     //
     $releaseRegex->get();
     echo "Stage 1 : Applying regex to binaries\n";
     $activeCategories = $cat->get();
     $catbasedsizes = $db->getLookupAsArray($activeCategories, "ID");
     $activeGroups = $groups->getActive(false);
     $groupbasedminsizes = $db->getLookupAsArray($groups->getAllNoReleases(), "ID");
     foreach ($activeGroups as $groupArr) {
         //check if regexes have already been applied during update binaries
         if ($groupArr['regexmatchonly'] == 1) {
             continue;
         }
         $groupRegexes = $releaseRegex->getForGroup($groupArr['name']);
         echo "Stage 1 : Applying " . sizeof($groupRegexes) . " regexes to group " . $groupArr['name'] . "\n";
         // Get out all binaries of STAGE0 for current group
         $newUnmatchedBinaries = array();
         $ressql = sprintf("SELECT binaries.ID, binaries.name, binaries.date, binaries.totalParts, binaries.procstat, binaries.fromname from binaries where groupID = %d and procstat IN (%d,%d) and regexID IS NULL order by binaries.date asc", $groupArr['ID'], Releases::PROCSTAT_NEW, Releases::PROCSTAT_TITLENOTMATCHED);
         $resbin = $db->queryDirect($ressql);
         $matchedbins = 0;
         while ($rowbin = $db->getAssocArray($resbin)) {
             $regexMatches = array();
             foreach ($groupRegexes as $groupRegex) {
                 $regexCheck = $releaseRegex->performMatch($groupRegex, $rowbin['name']);
                 if ($regexCheck !== false) {
                     $regexMatches = $regexCheck;
                     break;
                 }
             }
             if (!empty($regexMatches)) {
                 $matchedbins++;
                 $relparts = explode("/", $regexMatches['parts']);
                 $db->exec(sprintf("update binaries set relname = replace(%s, '_', ' '), relpart = %d, reltotalpart = %d, procstat=%d, categoryID=%s, regexID=%d, reqID=%s where ID = %d", $db->escapeString($regexMatches['name']), $relparts[0], $relparts[1], Releases::PROCSTAT_TITLEMATCHED, $regexMatches['regcatid'], $regexMatches['regexID'], $db->escapeString($regexMatches['reqID']), $rowbin["ID"]));
             } else {
                 if ($rowbin['procstat'] == Releases::PROCSTAT_NEW) {
                     $newUnmatchedBinaries[] = $rowbin['ID'];
                 }
             }
         }
         //mark as not matched
         if (!empty($newUnmatchedBinaries)) {
             $db->exec(sprintf("update binaries set procstat=%d where ID IN (%s)", Releases::PROCSTAT_TITLENOTMATCHED, implode(',', $newUnmatchedBinaries)));
         }
     }
     //
     // Move all binaries from releases which have the correct number of files on to the next stage.
     //
     echo "Stage 2 : Marking binaries where all parts are available";
     $result = $db->queryDirect(sprintf("SELECT relname, date, SUM(reltotalpart) AS reltotalpart, groupID, reqID, fromname, SUM(num) AS num, coalesce(g.minfilestoformrelease, s.minfilestoformrelease) as minfilestoformrelease FROM   ( SELECT relname, reltotalpart, groupID, reqID, fromname, max(date) as date, COUNT(ID) AS num FROM binaries     WHERE procstat = %s     GROUP BY relname, reltotalpart, groupID, reqID, fromname ORDER BY NULL ) x left outer join groups g on g.ID = x.groupID inner join ( select value as minfilestoformrelease from site where setting = 'minfilestoformrelease' ) s GROUP BY relname, groupID, reqID, fromname, minfilestoformrelease ORDER BY NULL", Releases::PROCSTAT_TITLEMATCHED));
     while ($row = $db->getAssocArray($result)) {
         $retcount++;
         //
         // Less than the site permitted number of files in a release. Dont discard it, as it may
         // be part of a set being uploaded.
         //
         if ($row["num"] < $row["minfilestoformrelease"]) {
             //echo "Number of files in release ".$row["relname"]." less than site/group setting (".$row['num']."/".$row["minfilestoformrelease"].")\n";
             //$db->exec(sprintf("update binaries set procattempts = procattempts + 1 where relname = %s and procstat = %d and groupID = %d and fromname = %s", $db->escapeString($row["relname"]), Releases::PROCSTAT_TITLEMATCHED, $row["groupID"], $db->escapeString($row["fromname"]) ));
         } elseif ($row["num"] >= $row["reltotalpart"]) {
             $incomplete = false;
             if ($row['reltotalpart'] == 0 && strtotime($currTime_ori['now']) - strtotime($row['date']) < 14400) {
                 $incomplete = true;
             } else {
                 // Check that the binary is complete
                 $binlist = $db->query(sprintf("SELECT binaries.ID, totalParts, date, COUNT(DISTINCT parts.messageID) AS num FROM binaries, parts WHERE binaries.ID=parts.binaryID AND binaries.relname = %s AND binaries.procstat = %d AND binaries.groupID = %d AND binaries.fromname = %s GROUP BY binaries.ID ORDER BY NULL", $db->escapeString($row["relname"]), Releases::PROCSTAT_TITLEMATCHED, $row["groupID"], $db->escapeString($row["fromname"])));
                 foreach ($binlist as $rowbin) {
                     if ($rowbin['num'] < $rowbin['totalParts']) {
                         // Allow to binary to release if posted to usenet longer than four hours ago and we still don't have all the parts
                         if (!(strtotime($currTime_ori['now']) - strtotime($rowbin['date']) > 14400)) {
                             $incomplete = true;
                             break;
                         }
                     }
                 }
             }
             if (!$incomplete) {
                 //
                 // Right number of files, but see if the binary is a allfilled/reqid post, in which case it needs its name looked up
                 //
                 if ($row['reqID'] != '' && $page->site->reqidurl != "") {
//.........这里部分代码省略.........
开发者ID:scriptzteam,项目名称:newzNZB-premium-indexer,代码行数:101,代码来源:releases.php

示例10: Settings

  php convert_to_tpg.php true               Convert c/b/p to tpg leaving current binaries/parts tables in-tact.
  php convert_to_tgp.php true delete        Convert c/b/p to tpg and TRUNCATE current binaries/parts tables.
 */
$debug = false;
$pdo = new Settings();
$groups = new \Groups(['Settings' => $pdo]);
$consoletools = new \ConsoleTools(['ColorCLI' => $pdo->log]);
$DoPartRepair = $pdo->getSetting('partrepair') == '0' ? false : true;
if (!isset($argv[1]) || $argv[1] != 'true') {
    exit($pdo->log->error("\nMandatory argument missing\n\n" . "This script will allow you to move from single binaries/parts tables to TPG without having to run reset_truncate.\n" . "Please STOP all update scripts before running this script.\n\n" . "Use the following options to run:\n" . "php {$argv['0']} true             ...: Convert b/p to tpg leaving current binaries/parts tables in-tact.\n" . "php {$argv['0']} true delete      ...: Convert b/p to tpg and TRUNCATE current binaries/parts tables.\n"));
}
$blen = $pdo->queryOneRow('SELECT COUNT(*) AS total FROM binaries;');
$bdone = 0;
$bcount = 1;
$gdone = 1;
$actgroups = $groups->getActive();
$glen = count($actgroups);
$newtables = $glen * 3;
$begintime = time();
echo "Creating new binaries, and parts tables for each active group...\n";
foreach ($actgroups as $group) {
    if ($groups->createNewTPGTables($group['id']) === false) {
        exit($pdo->log->error("There is a problem creating new parts/files tables for group {$group['name']}."));
    }
    $consoletools->overWrite("Tables Created: " . $consoletools->percentString($gdone * 3, $newtables));
    $gdone++;
}
$endtime = time();
echo "\nTable creation took " . $consoletools->convertTime($endtime - $begintime) . ".\n";
$starttime = time();
echo "\nNew tables created, moving data from old tables to new tables.\nThis will take awhile....\n\n";
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:31,代码来源:convert_to_tpg.php


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