Commit e578ee09 authored by Till Brehm's avatar Till Brehm
Browse files

Merge branch 'stable-3.1' into 'stable-3.1'

add parameter-option to ispconfig_patch for unattended patches

See merge request !905
parents 2d6d9eb4 0c815b56
...@@ -87,6 +87,13 @@ function is_installed($appname) { ...@@ -87,6 +87,13 @@ function is_installed($appname) {
} }
} }
$cmd_opt = getopt('', array('patch_id::'));
$auto = false;
if(isset($cmd_opt['patch_id'])) {
$patch_id = $cmd_opt['patch_id'];
$auto = true;
}
echo "\n\n".str_repeat('-',80)."\n"; echo "\n\n".str_repeat('-',80)."\n";
echo " _____ ___________ _____ __ _ echo " _____ ___________ _____ __ _
|_ _/ ___| ___ \ / __ \ / _(_) |_ _/ ___| ___ \ / __ \ / _(_)
...@@ -98,14 +105,14 @@ echo " _____ ___________ _____ __ _ ...@@ -98,14 +105,14 @@ echo " _____ ___________ _____ __ _
|___/ "; |___/ ";
echo "\n".str_repeat('-',80)."\n"; echo "\n".str_repeat('-',80)."\n";
echo "\n\n>> Patch tool \n\n"; echo "\n\n>> Patch tool \n\n";
echo "Please enter the patch id that you want to be applied to your ISPConfig installation.\nPlease be aware that we take NO responsibility that this will work for you.\nOnly use patches if you know what you are doing.\n\n"; if(!$auto) echo "Please enter the patch id that you want to be applied to your ISPConfig installation.\nPlease be aware that we take NO responsibility that this will work for you.\nOnly use patches if you know what you are doing.\n\n";
if(!is_installed('patch')) { if(!is_installed('patch')) {
swriteln("The program 'patch' is missing on your server. Please install it and try again."); swriteln("The program 'patch' is missing on your server. Please install it and try again.");
exit; exit;
} }
$patch_id = simple_query('Enter patch id', false, ''); if(!$auto) $patch_id = simple_query('Enter patch id', false, '');
if($patch_id == '') { if($patch_id == '') {
swriteln("Patch terminated by user.\n"); swriteln("Patch terminated by user.\n");
die(); die();
...@@ -122,7 +129,7 @@ if(!$patch_data) { ...@@ -122,7 +129,7 @@ if(!$patch_data) {
$patch_text = @file_get_contents('http://ispconfig.org/downloads/patches/' . $patch_id . '.txt'); $patch_text = @file_get_contents('http://ispconfig.org/downloads/patches/' . $patch_id . '.txt');
if($patch_text) { if($patch_text) {
$ok = simple_query("Patch description:\n".str_repeat("-", 80)."\n".$patch_text."\n".str_repeat("-", 80)."\nDo you really want to apply this patch now?", array('y','n'), 'y'); if($auto) $ok = 'y'; else $ok = simple_query("Patch description:\n".str_repeat("-", 80)."\n".$patch_text."\n".str_repeat("-", 80)."\nDo you really want to apply this patch now?", array('y','n'), 'y');
if($ok != 'y') { if($ok != 'y') {
swriteln("Patch terminated by user.\n"); swriteln("Patch terminated by user.\n");
die(); die();
...@@ -140,4 +147,4 @@ unlink($temp_file); ...@@ -140,4 +147,4 @@ unlink($temp_file);
exit; exit;
?> ?>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment