function simple_query($query, $answers, $default) { $finished = false; do { $answers_str = implode(',', $answers); swrite($query . ' (' . $answers_str . ') [' . $default . ']: '); $input = sread(); //* Stop the installation if ($input == 'quit') { swriteln("Installation terminated by user.\n"); die; } //* Select the default if ($input == '') { $answer = $default; $finished = true; } //* Set answer id valid if (in_array($input, $answers)) { $answer = $input; $finished = true; } } while ($finished == false); swriteln(); return $answer; }
public function free_query($query, $default) { swrite($this->lng($query) . ' [' . $default . ']: '); $input = sread(); //* Stop the installation if ($input == 'quit') { swriteln($this->lng("Installation terminated by user.\n")); die; } $answer = $input == '' ? $default : $input; swriteln(); return $answer; }
function checkDbHealth() { global $conf; //* Array containing non OK tables (can be repaired, crashed, corrupt) $notok = array(); echo "Checking ISPConfig database .. "; exec("mysqlcheck -h " . escapeshellarg($conf['mysql']['host']) . " -u " . escapeshellarg($conf['mysql']['admin_user']) . " -p" . escapeshellarg($conf['mysql']['admin_password']) . " -r " . escapeshellarg($conf["mysql"]["database"]), $result); for ($i = 0; $i < sizeof($result); $i++) { if (substr($result[$i], -2) != "OK") { $notok[] = $result[$i]; } } if (sizeof($notok) > 0) { echo "\nSome tables where not 'OK'. Please check the list below.\n\n"; foreach ($notok as $key => $value) { echo "{$value}\n"; } echo "\nPress enter to continue or CTRL-C to cancel the installation .."; sread(); } else { echo "OK\n"; } }
public function free_query($query, $default, $name = '') { global $autoinstall; if ($name != '' && $autoinstall[$name] != '') { if ($autoinstall[$name] == 'default') { $input = $default; } else { $input = $autoinstall[$name]; } } else { swrite($this->lng($query) . ' [' . $default . ']: '); $input = sread(); } //* Stop the installation if ($input == 'quit') { swriteln($this->lng("Installation terminated by user.\n")); die; } $answer = $input == '' ? $default : $input; swriteln(); return $answer; }