Example #1
0
     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.
         $nntp = nntp($pdo);
         $backFill = new Backfill(['NNTP' => $nntp, 'Settings' => $pdo], true);
         // Update the group for new binaries.
         (new Binaries(['NNTP' => $nntp, 'Settings' => $pdo]))->updateGroup($groupMySQL);
         // BackFill the group with 20k articles.
         $backFill->backfillAllGroups($groupMySQL['name'], 20000, 'normal');
         // Check if we got anything from binaries/backFill, exit if not.
         collectionCheck($pdo, $options[2]);
         // Create releases.
         processReleases($pdo, new ProcessReleases(['Settings' => $pdo]), $options[2]);
         // Post process the releases.
         (new ProcessAdditional(['Echo' => true, 'NNTP' => $nntp, 'Settings' => $pdo]))->start($options[2]);
         (new Nfo(['Echo' => true, 'Settings' => $pdo]))->processNfoFiles($nntp, $options[2]);
     }
     break;
     // Post process additional and NFO.
     // $options[2] => (char)Letter or number a-f 0-9, first character of release guid.
Example #2
0
if (isset($argv[1]) && $argv[1] == 'all' && $argv[1] !== 'safe' && $argv[1] !== 'alph' && $argv[1] !== 'date' && !is_numeric($argv[1]) && !isset($argv[2])) {
    $backfill = new Backfill(['NNTP' => $nntp, 'Settings' => $pdo]);
    $backfill->backfillAllGroups();
} else {
    if (isset($argv[1]) && $argv[1] !== 'all' && $argv[1] !== 'safe' && $argv[1] !== 'alph' && $argv[1] !== 'date' && !is_numeric($argv[1]) && !isset($argv[2])) {
        $backfill = new Backfill(['NNTP' => $nntp, 'Settings' => $pdo]);
        $backfill->backfillAllGroups($argv[1]);
    } else {
        if (isset($argv[1]) && $argv[1] !== 'all' && $argv[1] !== 'safe' && $argv[1] !== 'alph' && $argv[1] !== 'date' && !is_numeric($argv[1]) && isset($argv[2]) && is_numeric($argv[2])) {
            $backfill = new Backfill(['NNTP' => $nntp, 'Settings' => $pdo]);
            $backfill->backfillAllGroups($argv[1], $argv[2]);
        } else {
            if (isset($argv[1]) && $argv[1] !== 'all' && $argv[1] !== 'safe' && $argv[1] == 'alph' && $argv[1] !== 'date' && !is_numeric($argv[1]) && isset($argv[2]) && is_numeric($argv[2])) {
                $backfill = new Backfill(['NNTP' => $nntp, 'Settings' => $pdo]);
                $backfill->backfillAllGroups('', $argv[2], 'normal');
            } else {
                if (isset($argv[1]) && $argv[1] !== 'all' && $argv[1] !== 'safe' && $argv[1] !== 'alph' && $argv[1] == 'date' && !is_numeric($argv[1]) && isset($argv[2]) && is_numeric($argv[2])) {
                    $backfill = new Backfill(['NNTP' => $nntp, 'Settings' => $pdo]);
                    $backfill->backfillAllGroups('', $argv[2], 'date');
                } else {
                    if (isset($argv[1]) && $argv[1] !== 'all' && $argv[1] == 'safe' && $argv[1] !== 'alph' && $argv[1] !== 'date' && !is_numeric($argv[1]) && isset($argv[2]) && is_numeric($argv[2])) {
                        $backfill = new Backfill(['NNTP' => $nntp, 'Settings' => $pdo]);
                        $backfill->safeBackfill($argv[2]);
                    } else {
                        exit($pdo->log->error("\nWrong set of arguments.\n" . 'php backfill.php safe 200000		 ...: Backfill an active group alphabetically, x articles, the script stops,' . "\n" . '					 ...: if the group has reached reached 2012-06-24, the next group will backfill.' . "\n" . 'php backfill.php alph 200000 		 ...: Backfills all groups (sorted alphabetically) by number of articles' . "\n" . 'php backfill.php date 200000 		 ...: Backfills all groups (sorted by least backfilled in time) by number of articles' . "\n" . 'php backfill.php alt.binaries.ath 200000 ...: Backfills a group by name by number of articles' . "\n" . 'php backfill.php all			 ...: Backfills all groups 1 at a time, by date (set in admin-view groups)' . "\n" . 'php backfill.php alt.binaries.ath	 ...: Backfills a group by name, by date (set in admin-view groups)' . "\n"));
                    }
                }
            }
        }
    }
}