Ejemplo n.º 1
0
 /**
  * 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'), __FUNCTION__, Logger::LOG_INFO, 'header');
         // Loop through groups.
         foreach ($groups as $group) {
             $this->log('Starting group ' . $counter . ' of ' . $groupCount, __FUNCTION__, Logger::LOG_INFO, 'header');
             $this->updateGroup($group, $maxHeaders);
             $counter++;
         }
         $this->log('Updating completed in ' . number_format(microtime(true) - $allTime, 2) . ' seconds.', __FUNCTION__, Logger::LOG_INFO, 'primary');
     } else {
         $this->log('No groups specified. Ensure groups are added to nZEDb\'s database for updating.', __FUNCTION__, Logger::LOG_NOTICE, 'warning');
     }
 }
Ejemplo n.º 2
0
  php convert_to_tpg.php true               Convert c/b/p to tpg leaving current collections/binaries/parts tables in-tact.
  php convert_to_tgp.php true delete        Convert c/b/p to tpg and TRUNCATE current collections/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 collections/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 c/b/p to tpg leaving current collections/binaries/parts tables in-tact.\n" . "php {$argv['0']} true delete      ...: Convert c/b/p to tpg and TRUNCATE current collections/binaries/parts tables.\n"));
}
$clen = $pdo->queryOneRow('SELECT COUNT(*) AS total FROM collections;');
$cdone = 0;
$ccount = 1;
$gdone = 1;
$actgroups = $groups->getActive();
$glen = count($actgroups);
$newtables = $glen * 3;
$begintime = time();
echo "Creating new collections, 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";