Fix in Linux
This commit is contained in:
parent
6827724ee0
commit
334139cd25
1 changed files with 10 additions and 4 deletions
14
vendor/phangoapp/cuchuluphputils/src/Linux.php
vendored
14
vendor/phangoapp/cuchuluphputils/src/Linux.php
vendored
|
|
@ -5,6 +5,8 @@ namespace PhangoApp\CuchuluPHPUtils;
|
|||
|
||||
class Linux {
|
||||
|
||||
static public $distros=['debian', 'ubuntu', 'fedora', 'arch'];
|
||||
|
||||
static public function shell_command($arr_command, $exit_if_error=1) {
|
||||
|
||||
$error=0;
|
||||
|
|
@ -240,19 +242,23 @@ class Linux {
|
|||
|
||||
}
|
||||
|
||||
static public function sed($arr_sed) {
|
||||
static public function sed($arr_sed, $yes_error=1) {
|
||||
|
||||
$distro=Linux::get_linux_distro();
|
||||
|
||||
if(!isset($arr_sed[$distro])) {
|
||||
|
||||
echo "Sorry, you don't have a sed str for this distro\n\n";
|
||||
if($yes_error) {
|
||||
|
||||
exit(1);
|
||||
echo "Sorry, you don't have a sed str for this distro\n\n";
|
||||
|
||||
exit(1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Linux::shell_command(["sudo sed -i", "\"s/".$arr_sed[$distro][0]."/".$arr_sed[$distro][1]."/g\" ".$arr_sed[$distro][2]]);
|
||||
return Linux::shell_command(["sudo sed -i", "\"s/".addslashes($arr_sed[$distro][0])."/".addslashes($arr_sed[$distro][1])."/g\" ".$arr_sed[$distro][2]]);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue