diff --git a/misc/update_scripts/nix_scripts/tmux/bin/update_binaries.php b/misc/update_scripts/nix_scripts/tmux/bin/update_binaries.php deleted file mode 100644 index 04cb97d7c..000000000 --- a/misc/update_scripts/nix_scripts/tmux/bin/update_binaries.php +++ /dev/null @@ -1,53 +0,0 @@ -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 = []; - $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 = []; - - $return = ""; - $now = TIME(); - $diff = ($now - $_time); - $secondsLeft = $diff; - - for ($i = 4; $i > -1; $i--) { - $w[$i] = intval($secondsLeft / $d[$i][0]); - $secondsLeft -= ($w[$i] * $d[$i][0]); - if ($w[$i] != 0) { - //$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." "; - $return .= $w[$i] . " " . $d[$i][1] . (($w[$i] > 1) ? 's' : '') . " "; - } - } - - //$return .= ($diff>0)?"ago":"left"; - return $return; -} - -echo $c->header("Group update process completed in: " . relativeTime($time) . "\n"); - diff --git a/misc/update_scripts/nix_scripts/tmux/bin/update_releases.php b/misc/update_scripts/nix_scripts/tmux/bin/update_releases.php deleted file mode 100644 index ef04bcea1..000000000 --- a/misc/update_scripts/nix_scripts/tmux/bin/update_releases.php +++ /dev/null @@ -1,69 +0,0 @@ - $pdo]); - if ($nntp->doConnect() !== true) { - exit($pdo->log->error("Unable to connect to usenet.")); - } -} -if ($pdo->getSetting('tablepergroup') === 1) { - exit($pdo->log->error("You are using 'tablepergroup', you must use .../misc/update_scripts/nix_scripts/multiprocessing/releases.php")); -} - -$groupName = isset($argv[3]) ? $argv[3] : ''; -if (isset($argv[1]) && isset($argv[2])) { - $consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]); - $releases = new ProcessReleases(['Settings' => $pdo, 'ConsoleTools' => $consoletools]); - if ($argv[1] == 1 && $argv[2] == 'true') { - $releases->processReleases(1, 1, $groupName, $nntp, true); - } else if ($argv[1] == 1 && $argv[2] == 'false') { - $releases->processReleases(1, 2, $groupName, $nntp, true); - } else if ($argv[1] == 2 && $argv[2] == 'true') { - $releases->processReleases(2, 1, $groupName, $nntp, true); - } else if ($argv[1] == 2 && $argv[2] == 'false') { - $releases->processReleases(2, 2, $groupName, $nntp, true); - } else if ($argv[1] == 4 && ($argv[2] == 'true' || $argv[2] == 'false')) { - echo $pdo->log->header("Moving all releases to other -> misc, this can take a while, be patient."); - $releases->resetCategorize(); - } else if ($argv[1] == 5 && ($argv[2] == 'true' || $argv[2] == 'false')) { - echo $pdo->log->header("Categorizing all non-categorized releases in other->misc using usenet subject. This can take a while, be patient."); - $timestart = TIME(); - $relcount = $releases->categorizeRelease('name', 'WHERE iscategorized = 0 AND categoryid = 8010'); - $time = $consoletools->convertTime(TIME() - $timestart); - echo $pdo->log->primary("\n" . 'Finished categorizing ' . $relcount . ' releases in ' . $time . " seconds, using the usenet subject."); - } else if ($argv[1] == 6 && $argv[2] == 'true') { - echo $pdo->log->header("Categorizing releases in all sections using the searchname. This can take a while, be patient."); - $timestart = TIME(); - $relcount = $releases->categorizeRelease('searchname', ''); - $consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]); - $time = $consoletools->convertTime(TIME() - $timestart); - echo $pdo->log->primary("\n" . 'Finished categorizing ' . $relcount . ' releases in ' . $time . " seconds, using the search name."); - } else if ($argv[1] == 6 && $argv[2] == 'false') { - echo $pdo->log->header("Categorizing releases in misc sections using the searchname. This can take a while, be patient."); - $timestart = TIME(); - $relcount = $releases->categorizeRelease('searchname', 'WHERE categoryid IN (1090, 2020, 3050, 5050, 6050, 8010)'); - $consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]); - $time = $consoletools->convertTime(TIME() - $timestart); - echo $pdo->log->primary("\n" . 'Finished categorizing ' . $relcount . ' releases in ' . $time . " seconds, using the search name."); - } else { - exit($pdo->log->error("Wrong argument, type php update_releases.php to see a list of valid arguments.")); - } -} else { - exit($pdo->log->error("\nWrong set of arguments.\n" - . "php update_releases.php 1 true ...: Creates releases and attempts to categorize new releases\n" - . "php update_releases.php 2 true ...: Creates releases and leaves new releases in other -> misc\n" - . "\nYou must pass a second argument whether to post process or not, true or false\n" - . "You can pass a third optional argument, a group name (ex.: alt.binaries.multimedia).\n" - . "\nExtra commands::\n" - . "php update_releases.php 4 true ...: Puts all releases in other-> misc (also resets to look like they have never been categorized)\n" - . "php update_releases.php 5 true ...: Categorizes all releases in other-> misc (which have not been categorized already)\n" - . "php update_releases.php 6 false ...: Categorizes releases in misc sections using the search name\n" - . "php update_releases.php 6 true ...: Categorizes releases in all sections using the search name\n")); -} \ No newline at end of file diff --git a/misc/update_scripts/nix_scripts/tmux/conf/.gitignore b/misc/update_scripts/nix_scripts/tmux/conf/.gitignore deleted file mode 100644 index 2d2fd07c1..000000000 --- a/misc/update_scripts/nix_scripts/tmux/conf/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -tmux_user.conf -my.cnf diff --git a/misc/update_scripts/nix_scripts/tmux/monitor.php b/misc/update_scripts/nix_scripts/tmux/monitor.php index 1b7186b38..672cb0e2a 100644 --- a/misc/update_scripts/nix_scripts/tmux/monitor.php +++ b/misc/update_scripts/nix_scripts/tmux/monitor.php @@ -87,7 +87,7 @@ while ($runVar['counts']['iterations'] > 0) { //assign scripts $runVar['scripts']['releases'] = ($runVar['constants']['tablepergroup'] == 0 - ? "{$runVar['commands']['_php']} {$runVar['paths']['misc']}update_scripts/nix_scripts/tmux/bin/update_releases.php 1 false" + ? "{$runVar['commands']['_php']} {$runVar['paths']['misc']}update_scripts/update_releases.php 1 false" : "{$runVar['commands']['_php']} {$runVar['paths']['misc']}update_scripts/nix_scripts/multiprocessing/releases.php" ); diff --git a/misc/update_scripts/nix_scripts/tmux/run.php b/misc/update_scripts/nix_scripts/tmux/run.php index b67f87b74..066bc20ce 100644 --- a/misc/update_scripts/nix_scripts/tmux/run.php +++ b/misc/update_scripts/nix_scripts/tmux/run.php @@ -281,7 +281,7 @@ function attach($DIR, $tmux_session) if ($powerline == 1) { $tmuxconfig = $DIR . "powerline/tmux.conf"; } else { - $tmuxconfig = $DIR . "conf/tmux.conf"; + $tmuxconfig = $DIR . "tmux.conf"; } if ($seq == 1) { diff --git a/misc/update_scripts/nix_scripts/tmux/conf/tmux.conf b/misc/update_scripts/nix_scripts/tmux/tmux.conf similarity index 100% rename from misc/update_scripts/nix_scripts/tmux/conf/tmux.conf rename to misc/update_scripts/nix_scripts/tmux/tmux.conf diff --git a/misc/update_scripts/nntpproxy.php b/misc/update_scripts/nntpproxy.php index 740f64871..b703702e6 100644 --- a/misc/update_scripts/nntpproxy.php +++ b/misc/update_scripts/nntpproxy.php @@ -42,7 +42,7 @@ function window_proxy($tmux_session, $powerline) if ($powerline === '1') { $tmuxconfig = $DIR . "update_scripts/nix_scripts/tmux/powerline/tmux.conf"; } else { - $tmuxconfig = $DIR . "update_scripts/nix_scripts/tmux/conf/tmux.conf"; + $tmuxconfig = $DIR . "update_scripts/nix_scripts/tmux/tmux.conf"; } $nntpproxy = $site->nntpproxy; diff --git a/misc/update_scripts/optimise_db.php b/misc/update_scripts/optimise_db.php deleted file mode 100644 index e61a79588..000000000 --- a/misc/update_scripts/optimise_db.php +++ /dev/null @@ -1,19 +0,0 @@ -optimise($force); - -if (count($ret) > 0) -{ - echo "Optmze : Optimised ".count($ret)." tables\n"; -} -else -{ - echo "Optmze : Nothing required optimisation.".(!$force ? " Try using force (optimise_db.php true)" : "")."\n"; -} \ No newline at end of file diff --git a/misc/update_scripts/update_binaries.php b/misc/update_scripts/update_binaries.php index bde8bb42b..b1d606d1e 100644 --- a/misc/update_scripts/update_binaries.php +++ b/misc/update_scripts/update_binaries.php @@ -1,15 +1,14 @@ getSetting('maxheadersiteration') ?: 1000000; +$maxHeaders = $pdo->getSetting('max.headers.iteration') ?: 1000000; // Create the connection here and pass -$nntp = new \NNTP(['Settings' => $pdo]); +$nntp = new NNTP(['Settings' => $pdo]); if ($nntp->doConnect() !== true) { exit($pdo->log->error("Unable to connect to usenet.")); } diff --git a/misc/update_scripts/update_releases.php b/misc/update_scripts/update_releases.php index 1be430a88..ef04bcea1 100644 --- a/misc/update_scripts/update_releases.php +++ b/misc/update_scripts/update_releases.php @@ -1,9 +1,69 @@ processReleases(1, 1, $groupName, $nntp, true); -$sphinx->update(); +$pdo = new Settings(); + +if (isset($argv[2]) && $argv[2] === 'true') { + // Create the connection here and pass + $nntp = new NNTP(['Settings' => $pdo]); + if ($nntp->doConnect() !== true) { + exit($pdo->log->error("Unable to connect to usenet.")); + } +} +if ($pdo->getSetting('tablepergroup') === 1) { + exit($pdo->log->error("You are using 'tablepergroup', you must use .../misc/update_scripts/nix_scripts/multiprocessing/releases.php")); +} + +$groupName = isset($argv[3]) ? $argv[3] : ''; +if (isset($argv[1]) && isset($argv[2])) { + $consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]); + $releases = new ProcessReleases(['Settings' => $pdo, 'ConsoleTools' => $consoletools]); + if ($argv[1] == 1 && $argv[2] == 'true') { + $releases->processReleases(1, 1, $groupName, $nntp, true); + } else if ($argv[1] == 1 && $argv[2] == 'false') { + $releases->processReleases(1, 2, $groupName, $nntp, true); + } else if ($argv[1] == 2 && $argv[2] == 'true') { + $releases->processReleases(2, 1, $groupName, $nntp, true); + } else if ($argv[1] == 2 && $argv[2] == 'false') { + $releases->processReleases(2, 2, $groupName, $nntp, true); + } else if ($argv[1] == 4 && ($argv[2] == 'true' || $argv[2] == 'false')) { + echo $pdo->log->header("Moving all releases to other -> misc, this can take a while, be patient."); + $releases->resetCategorize(); + } else if ($argv[1] == 5 && ($argv[2] == 'true' || $argv[2] == 'false')) { + echo $pdo->log->header("Categorizing all non-categorized releases in other->misc using usenet subject. This can take a while, be patient."); + $timestart = TIME(); + $relcount = $releases->categorizeRelease('name', 'WHERE iscategorized = 0 AND categoryid = 8010'); + $time = $consoletools->convertTime(TIME() - $timestart); + echo $pdo->log->primary("\n" . 'Finished categorizing ' . $relcount . ' releases in ' . $time . " seconds, using the usenet subject."); + } else if ($argv[1] == 6 && $argv[2] == 'true') { + echo $pdo->log->header("Categorizing releases in all sections using the searchname. This can take a while, be patient."); + $timestart = TIME(); + $relcount = $releases->categorizeRelease('searchname', ''); + $consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]); + $time = $consoletools->convertTime(TIME() - $timestart); + echo $pdo->log->primary("\n" . 'Finished categorizing ' . $relcount . ' releases in ' . $time . " seconds, using the search name."); + } else if ($argv[1] == 6 && $argv[2] == 'false') { + echo $pdo->log->header("Categorizing releases in misc sections using the searchname. This can take a while, be patient."); + $timestart = TIME(); + $relcount = $releases->categorizeRelease('searchname', 'WHERE categoryid IN (1090, 2020, 3050, 5050, 6050, 8010)'); + $consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]); + $time = $consoletools->convertTime(TIME() - $timestart); + echo $pdo->log->primary("\n" . 'Finished categorizing ' . $relcount . ' releases in ' . $time . " seconds, using the search name."); + } else { + exit($pdo->log->error("Wrong argument, type php update_releases.php to see a list of valid arguments.")); + } +} else { + exit($pdo->log->error("\nWrong set of arguments.\n" + . "php update_releases.php 1 true ...: Creates releases and attempts to categorize new releases\n" + . "php update_releases.php 2 true ...: Creates releases and leaves new releases in other -> misc\n" + . "\nYou must pass a second argument whether to post process or not, true or false\n" + . "You can pass a third optional argument, a group name (ex.: alt.binaries.multimedia).\n" + . "\nExtra commands::\n" + . "php update_releases.php 4 true ...: Puts all releases in other-> misc (also resets to look like they have never been categorized)\n" + . "php update_releases.php 5 true ...: Categorizes all releases in other-> misc (which have not been categorized already)\n" + . "php update_releases.php 6 false ...: Categorizes releases in misc sections using the search name\n" + . "php update_releases.php 6 true ...: Categorizes releases in all sections using the search name\n")); +} \ No newline at end of file