From 2efc7b72f31d6149303fa0c7d6b48b93031e46ce Mon Sep 17 00:00:00 2001 From: absurdo Date: Mon, 27 Nov 2023 13:56:58 +0100 Subject: [PATCH] Added proc_open for execute commands in php --- vendor/phangoapp/leviathanutils/src/Linux.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/vendor/phangoapp/leviathanutils/src/Linux.php b/vendor/phangoapp/leviathanutils/src/Linux.php index b061086..21da207 100644 --- a/vendor/phangoapp/leviathanutils/src/Linux.php +++ b/vendor/phangoapp/leviathanutils/src/Linux.php @@ -228,7 +228,7 @@ class Linux { if(!isset($original_file[$distro])) { - echo "Sorry, you don't have a patch for this distro\n"; + echo "Sorry, you don't have a patch for this distro\n\n"; exit(1); @@ -244,7 +244,7 @@ class Linux { if(!isset($service[$distro])) { - echo "Sorry, you don't have a service reload for this distro\n"; + echo "Sorry, you don't have a service reload for this distro\n\n"; exit(1); @@ -270,9 +270,17 @@ class Linux { } - static public function sed($str_search, $str_replace, $file_to_replace) { + static public function sed($arr_sed) { + + if(!isset($arr_sed[$distro])) { + + echo "Sorry, you don't have a sed str for this distro\n\n"; + + exit(1); + + } - Linux::exec("sudo sed -i 's/${str_search}/${str_replace}/g' ${file_to_replace}"); + Linux::exec("sudo sed -i 's/${arr_sed[$distro][0]}/${arr_sed[$distro][1]}/g' ${arr_sed[$distro][2]}"); }