@@ -310,7 +310,15 @@ public function generate_nginx_files( $nodeapp_folder, $inc_root = true ) {
310
310
}
311
311
312
312
// Queue for single nginx files modified event
313
- file_put_contents ("/tmp/nodeapp_nginx_modified " , "$ user $ domain \n" , FILE_APPEND );
313
+ // Check if the file exists and doesn't already have $user $domain in it
314
+ if ( file_exists ( "/tmp/nodeapp_nginx_modified " ) ) {
315
+ $ content = file_get_contents ( "/tmp/nodeapp_nginx_modified " );
316
+ if ( strpos ( $ content , "$ user $ domain " ) === false ) {
317
+ file_put_contents ( "/tmp/nodeapp_nginx_modified " , "$ user $ domain \n" );
318
+ }
319
+ }else {
320
+ file_put_contents ("/tmp/nodeapp_nginx_modified " , "$ user $ domain \n" , FILE_APPEND );
321
+ }
314
322
}
315
323
316
324
/**
@@ -409,8 +417,9 @@ public function hcpp_add_webapp_xpath( $xpath ) {
409
417
*/
410
418
public function hcpp_invoke_plugin ( $ args ) {
411
419
global $ hcpp ;
412
- if ( count ( $ args ) < 2 ) return $ args ;
413
- $ username = preg_replace ( "/[^a-zA-Z0-9-_]+/ " , "" , $ args [1 ] ); // Sanitized username
420
+ if ( isset ( $ args [1 ] ) ) {
421
+ $ username = preg_replace ( "/[^a-zA-Z0-9-_]+/ " , "" , $ args [1 ] ); // Sanitized username
422
+ }
414
423
switch ( $ args [0 ] ) {
415
424
case 'nodeapp_get_versions ' :
416
425
$ hcpp ->log ( 'nodeapp_get_versions ' );
@@ -493,7 +502,9 @@ public function hcpp_invoke_plugin( $args ) {
493
502
case 'nodeapp_nginx_modified ' :
494
503
495
504
// Debounce allows use to queue and delay under higher loads
496
- shell_exec ( "nohup " . __DIR__ . "/nodeapp_debounce.sh > /dev/null 2>&1 & " );
505
+ $ hcpp ->log ( $ cmd );
506
+ $ cmd = "nohup " . __DIR__ . "/nodeapp_debounce.sh > /dev/null 2>&1 & " ;
507
+ $ hcpp ->log ( shell_exec ( $ cmd ) );
497
508
break ;
498
509
499
510
case 'nodeapp_debounce ' :
0 commit comments