Commit 682b4a5d authored by tbrehm's avatar tbrehm
Browse files

Updated patch script.

parent ee4c5aca
#!/usr/bin/php
<?php
/*
......@@ -77,6 +78,15 @@ function simple_query($query, $answers, $default)
return $answer;
}
function is_installed($appname) {
exec('which '.escapeshellcmd($appname).' 2> /dev/null',$out,$returncode);
if(isset($out[0]) && stristr($out[0],$appname) && $returncode == 0) {
return true;
} else {
return false;
}
}
echo "\n\n".str_repeat('-',80)."\n";
echo " _____ ___________ _____ __ _
|_ _/ ___| ___ \ / __ \ / _(_)
......@@ -90,11 +100,15 @@ echo "\n".str_repeat('-',80)."\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(!is_installed('patch')) {
swriteln("The program 'patch' is missing on your server. Please install it and try again.");
}
$patch_id = simple_query('Enter patch id', false, '');
if($patch_id == '') {
swriteln("Patch terminated by user.\n");
die();
} elseif(preg_match('/^[a-zA-Z0-9_\-\.]+$/', $patch_id) == false) {
} elseif(preg_match('/^[a-zA-Z0-9_\-]+$/', $patch_id) == false) {
swriteln("Invalid patch id.\n");
die();
}
......
#!/bin/bash
php -q /usr/local/ispconfig/server/scripts/ispconfig_patch.php
\ No newline at end of file
Markdown is supported
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