Move more scripts out of tmux folder, move tmux.conf out of conf folder.

This commit is contained in:
Darko
2015-09-30 11:35:59 +02:00
parent 0602f5173a
commit 2e54188bec
10 changed files with 71 additions and 155 deletions
@@ -1,53 +0,0 @@
<?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 = [];
$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");
@@ -1,69 +0,0 @@
<?php
require_once(dirname(__FILE__) . "/config.php");
use newznab\db\Settings;
use newznab\processing\ProcessReleases;
$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"));
}
@@ -1,2 +0,0 @@
tmux_user.conf
my.cnf
@@ -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"
);
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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;
-19
View File
@@ -1,19 +0,0 @@
<?php
require_once("config.php");
use newznab\db\Settings;
$force = ((isset($argv[1]) && ($argv[1] == "true")));
$db = new Settings;
$ret = $db->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";
}
+3 -4
View File
@@ -1,15 +1,14 @@
<?php
require_once("config.php");
require_once(dirname(__FILE__) . "/config.php");
use newznab\db\Settings;
$pdo = new Settings();
$maxHeaders = $pdo->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."));
}
+65 -5
View File
@@ -1,9 +1,69 @@
<?php
require_once(dirname(__FILE__) . "/config.php");
require_once("config.php");
use newznab\db\Settings;
use newznab\processing\ProcessReleases;
$releases = new ProcessReleases();
$sphinx = new Sphinx();
$releases->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"));
}