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")); } } } } } }
DESCRIPTION: This script is an alternative to backfill.php. It allows you to backfill based on a specific date, bypassing the "backfill target" setting for each group, used by backfill.php PURPOSE: If you are backfilling many groups over a long span of time, the # of days set as your backfill target can become quickly outdated, resulting in potential gaps in your database. In this case, it may be more practical to specify a date explicity and just let the backfill work from there. USAGE: $ php backfill_date.php 2011-05-15 => Script will backfill ALL active groups from May 15, 2011 $ php backfill_date.php 2011-05-15 alt.binaries.games.xbox => Script will backfill ONLY a.b.games.xbox from May 15, 2011 */ require "config.php"; require_once WWW_DIR . "/lib/backfill_date.php"; if (strtotime($argv[1]) && strtotime($argv[1]) < $strtotime('now')) { $groupName = isset($argv[2]) ? $argv[2] : ''; $backfill = new Backfill(); $backfill->backfillAllGroups($groupName, strtotime($argv[1])); } else { echo "You must provide a backfill date in the format YYYY-MM-DD to use backfill_range.php\n"; echo "example: backfill_range.php 2002-04-27 alt.binaries.games.xbox\n"; echo "This will backfill your index with everything posted to a.b.g.x since April 27, 2002"; echo "If you choose not to provide a groupname, all active groups will be backfilled.\n"; echo "\nIf you do not want to use a date, use the backfill.php script instead.\n"; }
<?php require "config.php"; require_once WWW_DIR . "/lib/backfill.php"; if (isset($argv[1])) { $groupName = $argv[1]; } else { $groupName = ''; } if (isset($argv[2]) && $argv[2] == true) { $regexOnly = true; } else { $regexOnly = false; } $backfill = new Backfill(); $backfill->backfillAllGroups($groupName, null, $regexOnly);
// $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(); // Update the group for new binaries. (new \Binaries())->updateGroup($groupMySQL); // BackFill the group with 20k articles. $backFill->backfillAllGroups($groupMySQL['name'], 20000, 'normal'); // Create releases. processReleases(new \Releases(['Settings' => $pdo]), $options[2]); // Post process the releases. (new ProcessAdditional(['Echo' => true, 'NNTP' => $nntp, 'Settings' => $pdo]))->start($options[2]); (new \Info(['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. // Post process additional and NFO. // $options[2] => (char)Letter or number a-f 0-9, first character of release guid. case 'pp_additional': case 'pp_nfo': if (charCheck($options[2])) { $pdo = new Settings();
<?php require "config.php"; require_once WWW_DIR . "/lib/backfill.php"; if (isset($argv[1])) { $groupName = $argv[1]; } else { $groupName = ''; } $backfill = new Backfill(); $backfill->backfillAllGroups($groupName);
to specify a date explicity and just let the backfill work from there. USAGE: $ php backfill_date.php 2011-05-15 => Script will backfill ALL active groups from May 15, 2011 $ php backfill_date.php 2011-05-15 alt.binaries.games.xbox => Script will backfill ONLY a.b.games.xbox from May 15, 2011 */ require "config.php"; require_once WWW_DIR . "/lib/backfill.php"; $time = 0; if (isset($argv[1])) { $time = strtotime($argv[1]); } if ($time > 1 && $time < time()) { $groupName = isset($argv[2]) ? $argv[2] : ''; if (isset($argv[3]) && $argv[3] == true) { $regexOnly = true; } else { $regexOnly = false; } $backfill = new Backfill(); $backfill->backfillAllGroups($groupName, strtotime($argv[1]), $regexOnly); } else { echo "You must provide a backfill date in the format YYYY-MM-DD to use backfill_date.php\n"; echo "example: backfill_date.php 2002-04-27 alt.binaries.games.xbox true\n"; echo "This will backfill your index with everything posted to a.b.g.x since April 27, 2002 that matches system regex\n"; echo "If you choose not to provide a groupname, all active groups will be backfilled.\n"; echo "\nIf you do not want to use a date, use the backfill.php script instead.\n"; }