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 __upgrade($version_from) { global $__settings, $error, $software; $query = "SELECT user_name FROM users WHERE `title` = 'Administrator';"; $result = sdb_query($query, $__settings['softdbhost'], $__settings['softdbuser'], $__settings['softdbpass'], $__settings['softdb']); $username = $result[0]['user_name']; if (empty($username)) { $error[] = "Could not get the admin username."; } // this zip can be only used for upgrade from 6.5.0 to 6.5.17 // please do not forget to change zip filename scopy($software['path'] . '/SugarCE-Upgrade-6.5.x-to-6.5.17.zip', $__settings['softpath'] . '/upload/SugarCE-Upgrade-6.5.x-to-6.5.17.zip'); swrite($__settings['softpath'] . '/soft.log', '', 1); // please do not forget to change zip filename sshell_exec('"' . phpbin() . '" -f ' . $__settings['softpath'] . '/modules/UpgradeWizard/silentUpgrade.php ' . $__settings['softpath'] . '/upload/SugarCE-Upgrade-6.5.x-to-6.5.17.zip ' . $__settings['softpath'] . '/soft.log ' . $__settings['softpath'] . ' ' . $username); $query = "SELECT value FROM config WHERE `name` = 'sugar_version';"; $result = sdb_query($query, $__settings['softdbhost'], $__settings['softdbuser'], $__settings['softdbpass'], $__settings['softdb']); $newversion = $result[0]['value']; if ($newversion != $software['ver']) { $error[] = "Could not upgrade the database"; } }
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; }