|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Blacklight; |
|
4
|
|
|
|
|
5
|
|
|
use App\Models\Settings; |
|
6
|
|
|
use Illuminate\Support\Arr; |
|
7
|
|
|
use Illuminate\Support\Facades\DB; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Tmux pane shell exec functions for pane respawning. |
|
11
|
|
|
* |
|
12
|
|
|
* |
|
13
|
|
|
* Class TmuxRun |
|
14
|
|
|
*/ |
|
15
|
|
|
class TmuxRun extends Tmux |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* @var mixed|string |
|
19
|
|
|
*/ |
|
20
|
|
|
protected mixed $_dateFormat; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* TmuxRun constructor. |
|
24
|
|
|
* |
|
25
|
|
|
* @throws \Exception |
|
26
|
|
|
*/ |
|
27
|
|
|
public function __construct() |
|
28
|
|
|
{ |
|
29
|
|
|
parent::__construct(); |
|
30
|
|
|
$this->_dateFormat = '%Y-%m-%d %T'; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Main switch for running tmux panes. |
|
35
|
|
|
* |
|
36
|
|
|
* |
|
37
|
|
|
* |
|
38
|
|
|
* @throws \Exception |
|
39
|
|
|
*/ |
|
40
|
|
|
public function runPane($cmdParam, &$runVar): void |
|
41
|
|
|
{ |
|
42
|
|
|
switch ((int) $runVar['constants']['sequential']) { |
|
43
|
|
|
case 0: |
|
44
|
|
|
switch ((string) $cmdParam) { |
|
45
|
|
|
case 'amazon': |
|
46
|
|
|
$this->_runAmazon($runVar); |
|
47
|
|
|
break; |
|
48
|
|
|
case 'dehash': |
|
49
|
|
|
$this->_runDehash($runVar); |
|
50
|
|
|
break; |
|
51
|
|
|
case 'fixnames': |
|
52
|
|
|
$this->_runFixReleaseNames($runVar); |
|
53
|
|
|
break; |
|
54
|
|
|
case 'main': |
|
55
|
|
|
$this->_runMainNon($runVar); |
|
56
|
|
|
break; |
|
57
|
|
|
case 'nonamazon': |
|
58
|
|
|
$this->_runNonAmazon($runVar); |
|
59
|
|
|
break; |
|
60
|
|
|
case 'notrunning': |
|
61
|
|
|
$this->_notRunningNon($runVar); |
|
62
|
|
|
break; |
|
63
|
|
|
case 'ppadditional': |
|
64
|
|
|
$this->_runPPAdditional($runVar); |
|
65
|
|
|
break; |
|
66
|
|
|
case 'removecrap': |
|
67
|
|
|
$this->_runRemoveCrap($runVar); |
|
68
|
|
|
break; |
|
69
|
|
|
case 'scraper': |
|
70
|
|
|
$this->_runIRCScraper(3, $runVar); |
|
71
|
|
|
break; |
|
72
|
|
|
case 'sharing': |
|
73
|
|
|
$this->_runSharing(4, $runVar); |
|
74
|
|
|
break; |
|
75
|
|
|
case 'updatetv': |
|
76
|
|
|
$this->_runUpdateTv($runVar); |
|
77
|
|
|
break; |
|
78
|
|
|
} |
|
79
|
|
|
break; |
|
80
|
|
|
case 1: |
|
81
|
|
|
switch ($cmdParam) { |
|
82
|
|
|
case 'amazon': |
|
83
|
|
|
$this->_runAmazon($runVar); |
|
84
|
|
|
break; |
|
85
|
|
|
case 'dehash': |
|
86
|
|
|
$this->_runDehash($runVar); |
|
87
|
|
|
break; |
|
88
|
|
|
case 'fixnames': |
|
89
|
|
|
$this->_runFixReleaseNames($runVar); |
|
90
|
|
|
break; |
|
91
|
|
|
case 'main': |
|
92
|
|
|
$this->_runMainBasic($runVar); |
|
93
|
|
|
break; |
|
94
|
|
|
case 'nonamazon': |
|
95
|
|
|
$this->_runNonAmazon($runVar); |
|
96
|
|
|
break; |
|
97
|
|
|
case 'notrunning': |
|
98
|
|
|
$this->_notRunningBasic($runVar); |
|
99
|
|
|
break; |
|
100
|
|
|
case 'ppadditional': |
|
101
|
|
|
$this->_runPPAdditional($runVar); |
|
102
|
|
|
break; |
|
103
|
|
|
case 'removecrap': |
|
104
|
|
|
$this->_runRemoveCrap($runVar); |
|
105
|
|
|
break; |
|
106
|
|
|
case 'scraper': |
|
107
|
|
|
$this->_runIRCScraper(3, $runVar); |
|
108
|
|
|
break; |
|
109
|
|
|
case 'sharing': |
|
110
|
|
|
$this->_runSharing(4, $runVar); |
|
111
|
|
|
break; |
|
112
|
|
|
case 'updatetv': |
|
113
|
|
|
$this->_runUpdateTv($runVar); |
|
114
|
|
|
break; |
|
115
|
|
|
} |
|
116
|
|
|
break; |
|
117
|
|
|
} |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* @throws \Exception |
|
122
|
|
|
*/ |
|
123
|
|
|
protected function _runDehash(&$runVar): void |
|
124
|
|
|
{ |
|
125
|
|
|
switch ($runVar['settings']['dehash']) { |
|
126
|
|
|
case 1: |
|
127
|
|
|
$log = $this->writelog($runVar['panes']['one'][3]); |
|
128
|
|
|
shell_exec( |
|
129
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:1.3 ' \ |
|
130
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/match_prefiles.php 3000 show $log; \ |
|
131
|
|
|
date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['dehash_timer']}' 2>&1 1> /dev/null" |
|
132
|
|
|
); |
|
133
|
|
|
break; |
|
134
|
|
|
case 2: |
|
135
|
|
|
$log = $this->writelog($runVar['panes']['one'][3]); |
|
136
|
|
|
shell_exec( |
|
137
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:1.3 ' \ |
|
138
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/tmux/bin/postprocess_pre.php {$runVar['constants']['pre_lim']} $log; \ |
|
139
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/match_prefiles.php 3000 show $log; \ |
|
140
|
|
|
date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['dehash_timer']}' 2>&1 1> /dev/null" |
|
141
|
|
|
); |
|
142
|
|
|
break; |
|
143
|
|
|
case 3: |
|
144
|
|
|
$log = $this->writelog($runVar['panes']['one'][3]); |
|
145
|
|
|
shell_exec( |
|
146
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:1.3 ' \ |
|
147
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/tmux/bin/postprocess_pre.php {$runVar['constants']['pre_lim']} $log; \ |
|
148
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/match_prefiles.php 300 show $log; \ |
|
149
|
|
|
date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['dehash_timer']}' 2>&1 1> /dev/null" |
|
150
|
|
|
); |
|
151
|
|
|
break; |
|
152
|
|
|
default: |
|
153
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
154
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:1.3 'echo \"\033[38;5;${color}m\n{$runVar['panes']['one'][3]} has been disabled/terminated by Decrypt Hashes\"'"); |
|
155
|
|
|
} |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* @throws \Exception |
|
160
|
|
|
*/ |
|
161
|
|
|
protected function _runFixReleaseNames(&$runVar): void |
|
162
|
|
|
{ |
|
163
|
|
|
if ((int) $runVar['settings']['fix_names'] === 1) { |
|
164
|
|
|
if ($runVar['counts']['now']['processrenames'] > 0) { |
|
165
|
|
|
$log = $this->writelog($runVar['panes']['one'][0]); |
|
166
|
|
|
shell_exec( |
|
167
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:1.0 ' \ |
|
168
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}testing/Releases/fixReleaseNames.php 1 true other yes show $log; \ |
|
169
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}testing/Releases/fixReleaseNames.php 3 true other yes show $log; \ |
|
170
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}testing/Releases/fixReleaseNames.php 5 true other yes show $log; \ |
|
171
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}testing/Releases/fixReleaseNames.php 7 true other yes show $log; \ |
|
172
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}testing/Releases/fixReleaseNames.php 9 true other yes show $log; \ |
|
173
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}testing/Releases/fixReleaseNames.php 11 true other yes show $log; \ |
|
174
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}testing/Releases/fixReleaseNames.php 13 true other yes show $log; \ |
|
175
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}testing/Releases/fixReleaseNames.php 15 true other yes show $log; \ |
|
176
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}testing/Releases/fixReleaseNames.php 17 true other yes show $log; \ |
|
177
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}testing/Releases/fixReleaseNames.php 19 true other yes show $log; date +\"{$this->_dateFormat}\"; \ |
|
178
|
|
|
{$runVar['commands']['_sleep']} {$runVar['settings']['fix_timer']}' 2>&1 1> /dev/null" |
|
179
|
|
|
); |
|
180
|
|
|
} else { |
|
181
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
182
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:1.0 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['one'][0]} has been disabled/terminated by no Fix Release Names to process\"'"); |
|
183
|
|
|
} |
|
184
|
|
|
} else { |
|
185
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
186
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:1.0 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['one'][0]} has been disabled/terminated by Fix Release Names\"'"); |
|
187
|
|
|
} |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
/** |
|
191
|
|
|
* @throws \Exception |
|
192
|
|
|
*/ |
|
193
|
|
|
protected function _runAmazon(&$runVar): void |
|
194
|
|
|
{ |
|
195
|
|
|
switch (true) { |
|
196
|
|
|
case (int) $runVar['settings']['post_amazon'] === 1 && |
|
197
|
|
|
( |
|
198
|
|
|
(int) $runVar['counts']['now']['processmusic'] > 0 || |
|
199
|
|
|
(int) $runVar['counts']['now']['processbooks'] > 0 || |
|
200
|
|
|
(int) $runVar['counts']['now']['processconsole'] > 0 || |
|
201
|
|
|
(int) $runVar['counts']['now']['processgames'] > 0 || |
|
202
|
|
|
(int) $runVar['counts']['now']['processxxx'] > 0 |
|
203
|
|
|
) && |
|
204
|
|
|
( |
|
205
|
|
|
(int) $runVar['settings']['processbooks'] === 1 || |
|
206
|
|
|
(int) $runVar['settings']['processmusic'] === 1 || |
|
207
|
|
|
(int) $runVar['settings']['processgames'] === 1 || |
|
208
|
|
|
(int) $runVar['settings']['processxxx'] === 1 |
|
209
|
|
|
): |
|
210
|
|
|
|
|
211
|
|
|
$log = $this->writelog($runVar['panes']['two'][2]); |
|
212
|
|
|
shell_exec( |
|
213
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:2.2 ' \ |
|
214
|
|
|
{$runVar['commands']['_phpn']} {$runVar['paths']['misc']}update/postprocess.php amazon true $log; date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['post_timer_amazon']}' 2>&1 1> /dev/null" |
|
215
|
|
|
); |
|
216
|
|
|
break; |
|
217
|
|
|
case (int) $runVar['settings']['post_amazon'] === 1 && (int) $runVar['settings']['processbooks'] === 0 |
|
218
|
|
|
&& (int) $runVar['settings']['processmusic'] === 0 && (int) $runVar['settings']['processgames'] === 0 |
|
219
|
|
|
&& (int) $runVar['settings']['processxxx'] === 0: |
|
220
|
|
|
|
|
221
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
222
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:2.2 \ |
|
223
|
|
|
'echo \"\033[38;5;{$color}m\n{$runVar['panes']['two'][2]} has been disabled/terminated in Admin Disable Music/Books/Console/XXX\"'"); |
|
224
|
|
|
break; |
|
225
|
|
|
case (int) $runVar['settings']['post_amazon'] === 1 && (int) $runVar['counts']['now']['processmusic'] === 0 && |
|
226
|
|
|
(int) $runVar['counts']['now']['processbooks'] === 0 && (int) $runVar['counts']['now']['processconsole'] === 0 && (int) $runVar['counts']['now']['processgames'] === 0 && (int) $runVar['counts']['now']['processxxx'] === 0: |
|
227
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
228
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:2.2 \ |
|
229
|
|
|
'echo \"\033[38;5;{$color}m\n{$runVar['panes']['two'][2]} has been disabled/terminated by No Music/Books/Console/Games/XXX to process\"'"); |
|
230
|
|
|
break; |
|
231
|
|
|
default: |
|
232
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
233
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:2.2 \ |
|
234
|
|
|
'echo \"\033[38;5;{$color}m\n{$runVar['panes']['two'][2]} has been disabled/terminated by Postprocess Amazon\"'"); |
|
235
|
|
|
} |
|
236
|
|
|
} |
|
237
|
|
|
|
|
238
|
|
|
/** |
|
239
|
|
|
* @throws \Exception |
|
240
|
|
|
*/ |
|
241
|
|
|
protected function _runAmazonFull(&$runVar): void |
|
242
|
|
|
{ |
|
243
|
|
|
switch (true) { |
|
244
|
|
|
case ((int) $runVar['settings']['post_amazon'] === 1) && (((int) $runVar['counts']['now']['processmusic'] > 0) |
|
245
|
|
|
|| ((int) $runVar['counts']['now']['processbooks'] > 0) || ((int) $runVar['counts']['now']['processconsole'] > 0) |
|
246
|
|
|
|| ((int) $runVar['counts']['now']['processgames'] > 0) || ((int) $runVar['counts']['now']['processxxx'] > 0)) |
|
247
|
|
|
&& (((int) $runVar['settings']['processbooks'] !== 0) || ((int) $runVar['settings']['processconsole'] !== 0) |
|
248
|
|
|
|| ((int) $runVar['settings']['processmusic'] !== 0) || |
|
249
|
|
|
((int) $runVar['settings']['processgames'] !== 0) |
|
250
|
|
|
|| ((int) $runVar['settings']['processxxx'] !== 0)): |
|
251
|
|
|
|
|
252
|
|
|
$log = $this->writelog($runVar['panes']['one'][1]); |
|
253
|
|
|
shell_exec( |
|
254
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:1.1 ' \ |
|
255
|
|
|
{$runVar['commands']['_phpn']} {$runVar['paths']['misc']}update/multiprocessing/postprocess.php ama $log; \ |
|
256
|
|
|
date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['post_timer_amazon']}' 2>&1 1> /dev/null" |
|
257
|
|
|
); |
|
258
|
|
|
break; |
|
259
|
|
|
case ((int) $runVar['settings']['post_amazon'] === 1) && ((int) $runVar['settings']['processbooks'] === 0) |
|
260
|
|
|
&& ((int) $runVar['counts']['now']['processconsole'] === 0) && ((int) $runVar['settings']['processmusic'] === 0) |
|
261
|
|
|
&& ((int) $runVar['settings']['processgames'] === 0): |
|
262
|
|
|
|
|
263
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
264
|
|
|
shell_exec( |
|
265
|
|
|
"tmux respawnp -k -t{$runVar['constants']['tmux_session']}:1.1 \ |
|
266
|
|
|
'echo \"\033[38;5;{$color}m\n{$runVar['panes']['one'][1]} has been disabled/terminated in Admin Disable Music/Books/Console/XXX\"'" |
|
267
|
|
|
); |
|
268
|
|
|
break; |
|
269
|
|
|
case ((int) $runVar['settings']['post_amazon'] === 1) && ((int) $runVar['counts']['now']['processmusic'] === 0) |
|
270
|
|
|
&& ((int) $runVar['counts']['now']['processbooks'] === 0) && ((int) $runVar['counts']['now']['processconsole'] === 0) |
|
271
|
|
|
&& ((int) $runVar['counts']['now']['processgames'] === 0) && ((int) $runVar['counts']['now']['processxxx'] === 0): |
|
272
|
|
|
|
|
273
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
274
|
|
|
shell_exec( |
|
275
|
|
|
"tmux respawnp -k -t{$runVar['constants']['tmux_session']}:1.1 \ |
|
276
|
|
|
'echo \"\033[38;5;{$color}m\n{$runVar['panes']['one'][1]} has been disabled/terminated by No Music/Books/Console/Games/XXX to process\"'" |
|
277
|
|
|
); |
|
278
|
|
|
break; |
|
279
|
|
|
default: |
|
280
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
281
|
|
|
shell_exec( |
|
282
|
|
|
"tmux respawnp -k -t{$runVar['constants']['tmux_session']}:1.1 \ |
|
283
|
|
|
'echo \"\033[38;5;{$color}m\n{$runVar['panes']['one'][1]} has been disabled/terminated by Postprocess Amazon\"'" |
|
284
|
|
|
); |
|
285
|
|
|
} |
|
286
|
|
|
} |
|
287
|
|
|
|
|
288
|
|
|
/** |
|
289
|
|
|
* @throws \Exception |
|
290
|
|
|
*/ |
|
291
|
|
|
protected function _runNonAmazon(&$runVar): void |
|
292
|
|
|
{ |
|
293
|
|
|
switch (true) { |
|
294
|
|
|
case (int) $runVar['settings']['post_non'] !== 0 && ((int) $runVar['counts']['now']['processmovies'] > 0 || (int) $runVar['counts']['now']['processtv'] > 0 || $runVar['counts']['now']['processanime'] > 0): |
|
295
|
|
|
$log = $this->writelog($runVar['panes']['two'][1]); |
|
296
|
|
|
shell_exec( |
|
297
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:2.1 ' \ |
|
298
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/multiprocessing/postprocess.php tv $log; \ |
|
299
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/multiprocessing/postprocess.php mov $log; \ |
|
300
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/postprocess.php anime true $log; \ |
|
301
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}testing/PostProc/check_covers.php true $log; \ |
|
302
|
|
|
date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['post_timer_non']}' 2>&1 1> /dev/null" |
|
303
|
|
|
); |
|
304
|
|
|
break; |
|
305
|
|
|
case (int) $runVar['settings']['post_non'] !== 0 && (int) $runVar['counts']['now']['processmovies'] === 0 && (int) $runVar['counts']['now']['processtv'] === 0 && (int) $runVar['counts']['now']['processanime'] === 0: |
|
306
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
307
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:2.1 \ |
|
308
|
|
|
'echo \"\033[38;5;{$color}m\n{$runVar['panes']['two'][1]} has been disabled/terminated by No Movies/TV/Anime to process\"'"); |
|
309
|
|
|
break; |
|
310
|
|
|
default: |
|
311
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
312
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:2.1 \ |
|
313
|
|
|
'echo \"\033[38;5;{$color}m\n{$runVar['panes']['two'][1]} has been disabled/terminated by Postprocess Non-Amazon\"'"); |
|
314
|
|
|
} |
|
315
|
|
|
} |
|
316
|
|
|
|
|
317
|
|
|
/** |
|
318
|
|
|
* @throws \Exception |
|
319
|
|
|
*/ |
|
320
|
|
|
protected function _runNonUpdateBinaries(&$runVar): void |
|
321
|
|
|
{ |
|
322
|
|
|
//run update_binaries |
|
323
|
|
|
//$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
324
|
|
|
if (((int) $runVar['settings']['binaries_run'] !== 0) && ($runVar['killswitch']['pp'] === false)) { |
|
325
|
|
|
$log = $this->writelog($runVar['panes']['zero'][2]); |
|
326
|
|
|
shell_exec( |
|
327
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:0.2 ' \ |
|
328
|
|
|
{$runVar['scripts']['binaries']} $log; date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['bins_timer']}' 2>&1 1> /dev/null" |
|
329
|
|
|
); |
|
330
|
|
|
} elseif ($runVar['killswitch']['pp'] === true) { |
|
331
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
332
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:0.2 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['zero'][2]} has been disabled/terminated by Exceeding Limits\"'"); |
|
333
|
|
|
} else { |
|
334
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
335
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:0.2 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['zero'][2]} has been disabled/terminated by Binaries\"'"); |
|
336
|
|
|
} |
|
337
|
|
|
} |
|
338
|
|
|
|
|
339
|
|
|
/** |
|
340
|
|
|
* @throws \Exception |
|
341
|
|
|
*/ |
|
342
|
|
|
protected function _runNonBackfill(&$runVar): void |
|
343
|
|
|
{ |
|
344
|
|
|
//run backfill |
|
345
|
|
|
$backsleep = ( |
|
346
|
|
|
(int) $runVar['settings']['progressive'] === 1 && floor($runVar['counts']['now']['collections_table'] / 500) > $runVar['settings']['back_timer'] |
|
347
|
|
|
? floor($runVar['counts']['now']['collections_table'] / 500) |
|
348
|
|
|
: $runVar['settings']['back_timer'] |
|
349
|
|
|
); |
|
350
|
|
|
|
|
351
|
|
|
if (((int) $runVar['settings']['backfill'] !== 0) && ($runVar['killswitch']['coll'] === false) && ($runVar['killswitch']['pp'] === false)) { |
|
352
|
|
|
$log = $this->writelog($runVar['panes']['zero'][3]); |
|
353
|
|
|
shell_exec( |
|
354
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:0.3 ' \ |
|
355
|
|
|
{$runVar['scripts']['backfill']} $log; date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} $backsleep' 2>&1 1> /dev/null" |
|
356
|
|
|
); |
|
357
|
|
|
} elseif (($runVar['killswitch']['coll'] === true) || ($runVar['killswitch']['pp'] === true)) { |
|
358
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
359
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:0.3 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['zero'][3]} has been disabled/terminated by Exceeding Limits\"'"); |
|
360
|
|
|
} else { |
|
361
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
362
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:0.3 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['zero'][3]} has been disabled/terminated by Backfill\"'"); |
|
363
|
|
|
} |
|
364
|
|
|
} |
|
365
|
|
|
|
|
366
|
|
|
/** |
|
367
|
|
|
* @throws \Exception |
|
368
|
|
|
*/ |
|
369
|
|
|
protected function _runNonUpdateReleases(&$runVar): void |
|
370
|
|
|
{ |
|
371
|
|
|
//run update_releases |
|
372
|
|
|
if ((int) $runVar['settings']['releases_run'] !== 0) { |
|
373
|
|
|
$log = $this->writelog($runVar['panes']['zero'][4]); |
|
374
|
|
|
shell_exec( |
|
375
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:0.4 ' \ |
|
376
|
|
|
{$runVar['scripts']['releases']} $log; date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['rel_timer']}' 2>&1 1> /dev/null" |
|
377
|
|
|
); |
|
378
|
|
|
} else { |
|
379
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
380
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:0.4 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['zero'][4]} has been disabled/terminated by Releases\"'"); |
|
381
|
|
|
} |
|
382
|
|
|
} |
|
383
|
|
|
|
|
384
|
|
|
/** |
|
385
|
|
|
* Run postprocess_releases additional. |
|
386
|
|
|
* |
|
387
|
|
|
* |
|
388
|
|
|
* |
|
389
|
|
|
* @throws \Exception |
|
390
|
|
|
*/ |
|
391
|
|
|
protected function _runPPAdditional(&$runVar): void |
|
392
|
|
|
{ |
|
393
|
|
|
switch (true) { |
|
394
|
|
|
case ((int) $runVar['settings']['post'] === 1) && ((int) $runVar['counts']['now']['work'] > 0): |
|
395
|
|
|
$log = $this->writelog($runVar['panes']['two'][0]); |
|
396
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
397
|
|
|
shell_exec( |
|
398
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:2.0 'echo \"\033[38;5;{$color}m\"; \ |
|
399
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/multiprocessing/postprocess.php add $log; date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['post_timer']}' 2>&1 1> /dev/null" |
|
400
|
|
|
); |
|
401
|
|
|
$runVar['timers']['timer3'] = time(); |
|
402
|
|
|
break; |
|
403
|
|
|
case ((int) $runVar['settings']['post'] === 2) && ((int) $runVar['counts']['now']['processnfo'] > 0): |
|
404
|
|
|
$log = $this->writelog($runVar['panes']['two'][0]); |
|
405
|
|
|
shell_exec( |
|
406
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:2.0 ' \ |
|
407
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/multiprocessing/postprocess.php nfo $log; date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['post_timer']}' 2>&1 1> /dev/null" |
|
408
|
|
|
); |
|
409
|
|
|
$runVar['timers']['timer3'] = time(); |
|
410
|
|
|
break; |
|
411
|
|
|
case ((int) $runVar['settings']['post'] === 3) && (((int) $runVar['counts']['now']['processnfo'] > 0) || ((int) $runVar['counts']['now']['work'] > 0)): |
|
412
|
|
|
//run postprocess_releases additional |
|
413
|
|
|
$log = $this->writelog($runVar['panes']['two'][0]); |
|
414
|
|
|
shell_exec( |
|
415
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:2.0 ' \ |
|
416
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/multiprocessing/postprocess.php add $log; \ |
|
417
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/multiprocessing/postprocess.php nfo $log; \ |
|
418
|
|
|
date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['post_timer']}' 2>&1 1> /dev/null" |
|
419
|
|
|
); |
|
420
|
|
|
$runVar['timers']['timer3'] = time(); |
|
421
|
|
|
break; |
|
422
|
|
|
case ((int) $runVar['settings']['post'] !== 0) && ((int) $runVar['counts']['now']['processnfo'] === 0) && ((int) $runVar['counts']['now']['work'] === 0): |
|
423
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
424
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:2.0 \ |
|
425
|
|
|
'echo \"\033[38;5;{$color}m\n{$runVar['panes']['two'][0]} has been disabled/terminated by No Misc/Nfo to process\"'"); |
|
426
|
|
|
break; |
|
427
|
|
|
default: |
|
428
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
429
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:2.0 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['two'][0]} has been disabled/terminated by Postprocess Additional\"'"); |
|
430
|
|
|
} |
|
431
|
|
|
} |
|
432
|
|
|
|
|
433
|
|
|
/** |
|
434
|
|
|
* @throws \Exception |
|
435
|
|
|
*/ |
|
436
|
|
|
protected function _runRemoveCrap(&$runVar): void |
|
437
|
|
|
{ |
|
438
|
|
|
switch ($runVar['settings']['fix_crap_opt']) { |
|
439
|
|
|
// Do all types up to 2 hours. |
|
440
|
|
|
case 'All': |
|
441
|
|
|
$log = $this->writelog($runVar['panes']['one'][1]); |
|
442
|
|
|
shell_exec( |
|
443
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:1.1 ' \ |
|
444
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}testing/Releases/removeCrapReleases.php true 2 $log; \ |
|
445
|
|
|
date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['crap_timer']}' 2>&1 1> /dev/null" |
|
446
|
|
|
); |
|
447
|
|
|
break; |
|
448
|
|
|
// The user has specified custom types. |
|
449
|
|
|
case 'Custom': |
|
450
|
|
|
$log = $this->writelog($runVar['panes']['one'][1]); |
|
451
|
|
|
|
|
452
|
|
|
// Check how many types the user picked. |
|
453
|
|
|
$runVar['modsettings']['fc']['max'] = \count($runVar['modsettings']['fix_crap']); |
|
454
|
|
|
|
|
455
|
|
|
// Make sure the user actually selected some. |
|
456
|
|
|
if ($runVar['modsettings']['fc']['max'] > 0) { |
|
457
|
|
|
// If this is the first run, do a full run, else run on last 2 hours of releases. |
|
458
|
|
|
$runVar['modsettings']['fc']['time'] = '4'; |
|
459
|
|
|
if (($runVar['counts']['iterations'] == 1) || $runVar['modsettings']['fc']['firstrun']) { |
|
460
|
|
|
$runVar['modsettings']['fc']['time'] = 'full'; |
|
461
|
|
|
} |
|
462
|
|
|
|
|
463
|
|
|
//Check to see if the pane is dead, if so respawn it. |
|
464
|
|
|
if (shell_exec("tmux list-panes -t{$runVar['constants']['tmux_session']}:1 | grep ^1 | grep -c dead") == 1) { |
|
465
|
|
|
// Run remove crap releases. |
|
466
|
|
|
shell_exec( |
|
467
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:1.1 ' \ |
|
468
|
|
|
echo \"\nRunning removeCrapReleases for {$runVar['modsettings']['fix_crap'][$runVar['modsettings']['fc']['num']]}\"; \ |
|
469
|
|
|
{$runVar['commands']['_phpn']} {$runVar['paths']['misc']}testing/Releases/removeCrapReleases.php true \ |
|
470
|
|
|
{$runVar['modsettings']['fc']['time']} {$runVar['modsettings']['fix_crap'][$runVar['modsettings']['fc']['num']]} $log; \ |
|
471
|
|
|
date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['crap_timer']}' 2>&1 1> /dev/null" |
|
472
|
|
|
); |
|
473
|
|
|
|
|
474
|
|
|
// Increment so we know which type to run next. |
|
475
|
|
|
$runVar['modsettings']['fc']['num']++; |
|
476
|
|
|
} |
|
477
|
|
|
|
|
478
|
|
|
// If we reached the end, reset the type. |
|
479
|
|
|
if ((int) $runVar['modsettings']['fc']['num'] === (int) $runVar['modsettings']['fc']['max']) { |
|
480
|
|
|
$runVar['modsettings']['fc']['num'] = 0; |
|
481
|
|
|
// And say we are not on the first run, so we run 2 hours the next times. |
|
482
|
|
|
$runVar['modsettings']['fc']['firstrun'] = false; |
|
483
|
|
|
} |
|
484
|
|
|
} |
|
485
|
|
|
break; |
|
486
|
|
|
case 'Disabled': |
|
487
|
|
|
default: |
|
488
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
489
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:1.1 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['one'][1]} has been disabled/terminated by Remove Crap Releases\"'"); |
|
490
|
|
|
} |
|
491
|
|
|
} |
|
492
|
|
|
|
|
493
|
|
|
/** |
|
494
|
|
|
* @throws \Exception |
|
495
|
|
|
*/ |
|
496
|
|
|
protected function _runUpdateTv(&$runVar): void |
|
497
|
|
|
{ |
|
498
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
499
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:1.2 \ |
|
500
|
|
|
'echo \"\033[38;5;{$color}m\n{$runVar['panes']['one'][2]} has been disabled/terminated by Update TV/Theater\"'"); |
|
501
|
|
|
} |
|
502
|
|
|
|
|
503
|
|
|
/** |
|
504
|
|
|
* @throws \Exception |
|
505
|
|
|
*/ |
|
506
|
|
|
protected function _runUpdateTvFull(&$runVar): void |
|
507
|
|
|
{ |
|
508
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
509
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:1.0 \ |
|
510
|
|
|
'echo \"\033[38;5;{$color}m\n{$runVar['panes']['one'][0]} has been disabled/terminated by Update TV/Theater\"'"); |
|
511
|
|
|
} |
|
512
|
|
|
|
|
513
|
|
|
/** |
|
514
|
|
|
* @throws \Exception |
|
515
|
|
|
*/ |
|
516
|
|
|
protected function _runMainNon(&$runVar): void |
|
517
|
|
|
{ |
|
518
|
|
|
$this->_runNonUpdateBinaries($runVar); |
|
519
|
|
|
$this->_runNonUpdateReleases($runVar); |
|
520
|
|
|
$this->_runNonBackfill($runVar); |
|
521
|
|
|
} |
|
522
|
|
|
|
|
523
|
|
|
/** |
|
524
|
|
|
* @throws \Exception |
|
525
|
|
|
*/ |
|
526
|
|
|
protected function _runMainBasic(&$runVar): void |
|
527
|
|
|
{ |
|
528
|
|
|
$log = $this->writelog($runVar['panes']['zero'][2]); |
|
529
|
|
|
if (($runVar['killswitch']['pp'] === false) && (time() - $runVar['timers']['timer5'] <= 4800)) { |
|
530
|
|
|
$date = 'date +"%Y-%m-%d %T";'; |
|
531
|
|
|
$sleep = sprintf( |
|
532
|
|
|
'%s %s;', |
|
533
|
|
|
$runVar['commands']['_sleep'], |
|
534
|
|
|
$runVar['settings']['seq_timer'] |
|
535
|
|
|
); |
|
536
|
|
|
|
|
537
|
|
|
$binaries = match ($runVar['settings']['binaries_run']) { |
|
538
|
|
|
0 => 'echo "\nbinaries has been disabled/terminated by Binaries"', |
|
539
|
|
|
1 => sprintf('%s %s;', $runVar['scripts']['binaries'], $log), |
|
540
|
|
|
default => '', |
|
541
|
|
|
}; |
|
542
|
|
|
|
|
543
|
|
|
$backfill = match ($runVar['settings']['backfill']) { |
|
544
|
|
|
0 => 'echo "backfill is disabled in settings";', |
|
545
|
|
|
1 => sprintf('%s %s %s;', $runVar['scripts']['backfill'], $runVar['settings']['backfill_qty'], $log), |
|
546
|
|
|
2 => sprintf('%s %s %s;', $runVar['scripts']['backfill'], 'group', $log), |
|
547
|
|
|
4 => sprintf('%s %s;', $runVar['scripts']['backfill'], $log), |
|
548
|
|
|
default => '', |
|
549
|
|
|
}; |
|
550
|
|
|
|
|
551
|
|
|
$releases = match ($runVar['settings']['releases_run']) { |
|
552
|
|
|
0 => 'echo PHP_EOL . "releases have been disabled/terminated by Releases"', |
|
553
|
|
|
1 => sprintf('%s %s;', $runVar['scripts']['releases'], $log), |
|
554
|
|
|
default => '', |
|
555
|
|
|
}; |
|
556
|
|
|
|
|
557
|
|
|
shell_exec("tmux respawnp -t{$runVar['constants']['tmux_session']}:0.2 '$binaries $backfill $releases $date $sleep' 2>&1 1> /dev/null"); |
|
558
|
|
|
} elseif (($runVar['killswitch']['pp'] === false) && (time() - $runVar['timers']['timer5'] >= 4800)) { |
|
559
|
|
|
//run backfill all once and resets the timer |
|
560
|
|
|
if ((int) $runVar['settings']['backfill'] !== 0) { |
|
561
|
|
|
shell_exec( |
|
562
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:0.2 ' \ |
|
563
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/multiprocessing/backfill.php $log; \ |
|
564
|
|
|
date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['seq_timer']}' 2>&1 1> /dev/null" |
|
565
|
|
|
); |
|
566
|
|
|
$runVar['timers']['timer5'] = time(); |
|
567
|
|
|
} else { |
|
568
|
|
|
$runVar['timers']['timer5'] = time(); |
|
569
|
|
|
} |
|
570
|
|
|
} elseif (($runVar['killswitch']['pp'] === true) && (int) $runVar['settings']['releases_run'] !== 0) { |
|
571
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
572
|
|
|
shell_exec( |
|
573
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:0.2 'echo \"\033[38;5;{$color}m\"; \ |
|
574
|
|
|
echo \"\nbinaries and backfill has been disabled/terminated by Exceeding Limits\"; \ |
|
575
|
|
|
{$runVar['scripts']['releases']} $log; date +\"{$this->_dateFormat}\"; echo \"\nbinaries and backfill has been disabled/terminated by Exceeding Limits\"; \ |
|
576
|
|
|
{$runVar['commands']['_sleep']} {$runVar['settings']['seq_timer']}' 2>&1 1> /dev/null" |
|
577
|
|
|
); |
|
578
|
|
|
} elseif ($runVar['killswitch']['pp'] === true) { |
|
579
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
580
|
|
|
shell_exec("tmux respawnp -t{$runVar['constants']['tmux_session']}:0.2 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['zero'][2]} has been disabled/terminated by Exceeding Limits\"'"); |
|
581
|
|
|
} |
|
582
|
|
|
} |
|
583
|
|
|
|
|
584
|
|
|
/** |
|
585
|
|
|
* @throws \Exception |
|
586
|
|
|
*/ |
|
587
|
|
|
protected function _notRunningNon(&$runVar): void |
|
588
|
|
|
{ |
|
589
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
590
|
|
|
for ($g = 1; $g <= 4; $g++) { |
|
591
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:0.$g 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['zero'][$g]} has been disabled/terminated by Running\"'"); |
|
592
|
|
|
} |
|
593
|
|
|
for ($g = 0; $g <= 3; $g++) { |
|
594
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:1.$g 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['one'][$g]} has been disabled/terminated by Running\"'"); |
|
595
|
|
|
} |
|
596
|
|
|
for ($g = 0; $g <= 2; $g++) { |
|
597
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:2.$g 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['two'][$g]} has been disabled/terminated by Running\"'"); |
|
598
|
|
|
} |
|
599
|
|
|
} |
|
600
|
|
|
|
|
601
|
|
|
/** |
|
602
|
|
|
* @throws \Exception |
|
603
|
|
|
*/ |
|
604
|
|
|
protected function _notRunningBasic(&$runVar): void |
|
605
|
|
|
{ |
|
606
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
607
|
|
|
for ($g = 1; $g <= 2; $g++) { |
|
608
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:0.$g 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['zero'][$g]} has been disabled/terminated by Running\"'"); |
|
609
|
|
|
} |
|
610
|
|
|
for ($g = 0; $g <= 3; $g++) { |
|
611
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:1.$g 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['one'][$g]} has been disabled/terminated by Running\"'"); |
|
612
|
|
|
} |
|
613
|
|
|
for ($g = 0; $g <= 2; $g++) { |
|
614
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:2.$g 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['two'][$g]} has been disabled/terminated by Running\"'"); |
|
615
|
|
|
} |
|
616
|
|
|
} |
|
617
|
|
|
|
|
618
|
|
|
/** |
|
619
|
|
|
* @throws \Exception |
|
620
|
|
|
*/ |
|
621
|
|
|
protected function _notRunningFull(&$runVar): void |
|
622
|
|
|
{ |
|
623
|
|
|
$color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); |
|
624
|
|
|
for ($g = 1; $g <= 2; $g++) { |
|
625
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:0.$g 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['zero'][$g]} has been disabled/terminated by Running\"'"); |
|
626
|
|
|
} |
|
627
|
|
|
for ($g = 0; $g <= 1; $g++) { |
|
628
|
|
|
shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:1.$g 'echo \"\033[38;5;{$color}m\n{$runVar['panes']['one'][$g]} has been disabled/terminated by Running\"'"); |
|
629
|
|
|
} |
|
630
|
|
|
} |
|
631
|
|
|
|
|
632
|
|
|
protected function _runIRCScraper($pane, &$runVar): void |
|
633
|
|
|
{ |
|
634
|
|
|
if ((int) $runVar['constants']['run_ircscraper'] === 1) { |
|
635
|
|
|
//Check to see if the pane is dead, if so respawn it. |
|
636
|
|
|
if ((int) shell_exec("tmux list-panes -t{$runVar['constants']['tmux_session']}:{$pane} | grep ^0 | grep -c dead") === 1) { |
|
637
|
|
|
shell_exec( |
|
638
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:{$pane}.0 ' \ |
|
639
|
|
|
{$runVar['commands']['_phpn']} {$runVar['paths']['scraper']} true'" |
|
640
|
|
|
); |
|
641
|
|
|
} |
|
642
|
|
|
} else { |
|
643
|
|
|
shell_exec("tmux respawnp -t{$runVar['constants']['tmux_session']}:{$pane}.0 'echo \"\nIRCScraper has been disabled/terminated by IRCSCraper\"'"); |
|
644
|
|
|
} |
|
645
|
|
|
} |
|
646
|
|
|
|
|
647
|
|
|
protected function _runSharing($pane, &$runVar): void |
|
648
|
|
|
{ |
|
649
|
|
|
$sharing = (array) Arr::first(DB::select('SELECT enabled, posting, fetching FROM sharing')); |
|
650
|
|
|
|
|
651
|
|
|
if (! empty($sharing) && (int) $sharing['enabled'] === 1 && (int) $runVar['settings']['run_sharing'] === 1 && ((int) $sharing['posting'] === 1 || (int) $sharing['fetching'] === 1) && shell_exec("tmux list-panes -t{$runVar['constants']['tmux_session']}:{$pane} | grep ^0 | grep -c dead") == 1) { |
|
652
|
|
|
shell_exec( |
|
653
|
|
|
"tmux respawnp -t{$runVar['constants']['tmux_session']}:{$pane}.0 ' \ |
|
654
|
|
|
{$runVar['commands']['_php']} {$runVar['paths']['misc']}/update/multiprocessing/postprocess.php sha; \ |
|
655
|
|
|
{$runVar['commands']['_sleep']} {$runVar['settings']['sharing_timer']}' 2>&1 1> /dev/null" |
|
656
|
|
|
); |
|
657
|
|
|
} |
|
658
|
|
|
} |
|
659
|
|
|
} |
|
660
|
|
|
|