mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Update tmux related files
This commit is contained in:
@@ -18,7 +18,7 @@ use Blacklight\processing\ProcessReleases;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
// Are we coming from python or php ? $options[0] => (string): python|php
|
||||
|
||||
// The type of process we want to do: $options[1] => (string): releases
|
||||
$options = explode(' ', $argv[1]);
|
||||
|
||||
@@ -38,7 +38,7 @@ switch ($options[1]) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
try {
|
||||
(new Backfill())->backfillAllGroups($options[2], ($options[3] === 1 ? '' : $value['value']));
|
||||
(new Backfill())->backfillAllGroups($options[2], ($options[3] == 1 ? '' : $value['value']));
|
||||
} catch (Throwable $e) {
|
||||
Log::error($e->getTraceAsString());
|
||||
echo $e->getMessage();
|
||||
@@ -324,7 +324,7 @@ switch ($options[1]) {
|
||||
|
||||
// Create the connection here and pass, this is for post processing, so check for alternate.
|
||||
try {
|
||||
$nntp = nntp(true);
|
||||
$nntp = nntp();
|
||||
} catch (Throwable $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
@@ -414,15 +414,14 @@ function charCheck(string $char): bool
|
||||
/**
|
||||
* Connect to usenet, return NNTP object.
|
||||
*
|
||||
* @param bool $alternate Use alternate NNTP provider.
|
||||
* @return NNTP
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
function &nntp(bool $alternate = false): NNTP
|
||||
function &nntp(): NNTP
|
||||
{
|
||||
$nntp = new NNTP();
|
||||
if (($alternate && (int) Settings::settingValue('..alternate_nntp') === 1 ? $nntp->doConnect(true, true) : $nntp->doConnect()) !== true) {
|
||||
if (((int) Settings::settingValue('..alternate_nntp') === 1 ? $nntp->doConnect(false, true) : $nntp->doConnect()) !== true) {
|
||||
exit('ERROR: Unable to connect to usenet.'.PHP_EOL);
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -12,8 +12,8 @@ $tmuxPath = base_path().'/misc/update/tmux/';
|
||||
$import = Settings::settingValue('site.tmux.import') ?? 0;
|
||||
$tmux_session = Settings::settingValue('site.tmux.tmux_session') ?? 0;
|
||||
$seq = Settings::settingValue('site.tmux.sequential') ?? 0;
|
||||
$delaytimet = Settings::settingValue('..delaytime');
|
||||
$delaytimet = $delaytimet ? (int) $delaytimet : 2;
|
||||
$delaytime = Settings::settingValue('..delaytime');
|
||||
$delaytime = $delaytime ? (int) $delaytime : 2;
|
||||
$colorCli = new ColorCLI();
|
||||
|
||||
Utility::clearScreen();
|
||||
@@ -21,11 +21,11 @@ Utility::clearScreen();
|
||||
//reset collections dateadded to now if dateadded > delay time check
|
||||
$colorCli->header('Resetting collections that have expired to this moment. This could take some time if many collections need to be reset');
|
||||
|
||||
DB::transaction(function () use ($delaytimet) {
|
||||
Collection::query()->where('dateadded', '<', now()->subHours($delaytimet))->update(['dateadded' => now()]);
|
||||
DB::transaction(function () use ($delaytime) {
|
||||
Collection::query()->where('dateadded', '<', now()->subHours($delaytime))->update(['dateadded' => now()]);
|
||||
}, 10);
|
||||
|
||||
function command_exist($cmd)
|
||||
function command_exist($cmd): bool
|
||||
{
|
||||
$returnVal = Process::run("which $cmd 2>/dev/null");
|
||||
|
||||
@@ -43,7 +43,7 @@ foreach ($apps as &$value) {
|
||||
|
||||
unset($value);
|
||||
|
||||
function start_apps($tmux_session)
|
||||
function start_apps($tmux_session): void
|
||||
{
|
||||
$htop = Settings::settingValue('site.tmux.htop');
|
||||
$vnstat = Settings::settingValue('site.tmux.vnstat');
|
||||
@@ -129,23 +129,23 @@ function attach($tmuxPath, $tmux_session): void
|
||||
|
||||
//create tmux session
|
||||
|
||||
$tmuxconfig = $tmuxPath.'tmux.conf';
|
||||
$tmuxConfig = $tmuxPath.'tmux.conf';
|
||||
|
||||
if ((int) $seq === 1) {
|
||||
Process::run("cd ${tmuxPath}; tmux -f $tmuxconfig new-session -d -s $tmux_session -n Monitor 'printf \"\033]2;\"Monitor\"\033\"'");
|
||||
Process::run("cd ${tmuxPath}; tmux -f $tmuxConfig new-session -d -s $tmux_session -n Monitor 'printf \"\033]2;\"Monitor\"\033\"'");
|
||||
Process::run("tmux selectp -t $tmux_session:0.0; tmux splitw -t $tmux_session:0 -h -p 67 'printf \"\033]2;update_releases\033\"'");
|
||||
Process::run("tmux selectp -t $tmux_session:0.0; tmux splitw -t $tmux_session:0 -v -p 25 'printf \"\033]2;nzb-import\033\"'");
|
||||
|
||||
window_utilities($tmux_session);
|
||||
window_post($tmux_session);
|
||||
} elseif ((int) $seq === 2) {
|
||||
Process::run("cd ${tmuxPath}; tmux -f $tmuxconfig new-session -d -s $tmux_session -n Monitor 'printf \"\033]2;\"Monitor\"\033\"'");
|
||||
Process::run("cd ${tmuxPath}; tmux -f $tmuxConfig new-session -d -s $tmux_session -n Monitor 'printf \"\033]2;\"Monitor\"\033\"'");
|
||||
Process::run("tmux selectp -t $tmux_session:0.0; tmux splitw -t $tmux_session:0 -h -p 67 'printf \"\033]2;sequential\033\"'");
|
||||
Process::run("tmux selectp -t $tmux_session:0.0; tmux splitw -t $tmux_session:0 -v -p 25 'printf \"\033]2;nzb-import\033\"'");
|
||||
|
||||
window_stripped_utilities($tmux_session);
|
||||
} else {
|
||||
Process::run("cd ${tmuxPath}; tmux -f $tmuxconfig new-session -d -s $tmux_session -n Monitor 'printf \"\033]2;Monitor\033\"'");
|
||||
Process::run("cd ${tmuxPath}; tmux -f $tmuxConfig new-session -d -s $tmux_session -n Monitor 'printf \"\033]2;Monitor\033\"'");
|
||||
Process::run("tmux selectp -t $tmux_session:0.0; tmux splitw -t $tmux_session:0 -h -p 67 'printf \"\033]2;update_binaries\033\"'");
|
||||
Process::run("tmux selectp -t $tmux_session:0.0; tmux splitw -t $tmux_session:0 -v -p 25 'printf \"\033]2;nzb-import\033\"'");
|
||||
Process::run("tmux selectp -t $tmux_session:0.2; tmux splitw -t $tmux_session:0 -v -p 67 'printf \"\033]2;backfill\033\"'");
|
||||
|
||||
Reference in New Issue
Block a user