/**
 * @param array $group
 * @param Binaries $binaries
 *
 * @return bool
 */
function dogroup($group, $binaries)
{
    $binaries->updateGroup($group);
    echo "Press enter to continue, type n and press enter to quit.\n";
    $cmd = trim(fgets(fopen("php://stdin", "r")));
    if ($cmd == '') {
        return true;
    } else {
        if ($cmd == "no") {
            exit("Done.\n");
        } else {
            return true;
        }
    }
}
Example #2
0
<?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);
}
<?php

require_once "config.php";
use newznab\db\Settings;
$pdo = new Settings();
$maxHeaders = $pdo->getSetting('max.headers.iteration') ?: 1000000;
// 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] : $maxHeaders);
    }
} else {
    $binaries->updateAllGroups(isset($argv[1]) && is_numeric($argv[1]) && $argv[1] > 0 ? $argv[1] : $maxHeaders);
}
<?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]);
<?php

require "config.php";
require_once WWW_DIR . "/lib/groups.php";
require_once WWW_DIR . "/lib/binaries.php";
require_once WWW_DIR . "/lib/releases.php";
require_once WWW_DIR . "/lib/site.php";
if (isset($argv[1])) {
    $group = $argv[1];
    echo "Updating group {$group}\n";
    $g = new Groups();
    $group = $g->getByName($group);
    $bin = new Binaries();
    $bin->updateGroup(null, $group);
} else {
    $s = new Sites();
    $releases = new Releases();
    $site = $s->get();
    if ($site->newznabID == "") {
        echo "Warning : No Newznab ID present. Check Admin > Site Edit\n";
    }
    $releases->checkRegexesUptoDate($site->latestregexurl, $site->latestregexrevision, $site->newznabID);
    $binaries = new Binaries();
    $binaries->updateAllGroups();
}