Changed install page to add options for databases

This commit is contained in:
alvarenga.milton 2019-04-01 21:48:56 -03:00
parent cc599a1036
commit 36eef86b41

View File

@ -49,6 +49,14 @@ $autocomplete = array(
'dbtype' => 'mysql', 'dbtype' => 'mysql',
); );
//Valid databases Codiad is able to use
$aValidDBType = [
'mysql'
,'postgresql'
,'sqlite'
];
if (!empty($query)) { if (!empty($query)) {
$params = explode('&', $query); $params = explode('&', $query);
foreach ($params as $param) { foreach ($params as $param) {
@ -111,12 +119,21 @@ if ($newrelic) {
<label><?php i18n("Dependencies"); ?></label> <label><?php i18n("Dependencies"); ?></label>
<div id="dependencies"> <div id="dependencies">
<?php foreach (array("ZIP", "OpenSSL", "MBString") as $dep) { <?php foreach ([
"ZIP"=>"required",
"OpenSSL"=>"required",
"MBString"=>"required",
"MySQL"=>"",
"PGSQL"=>"",
"SQLite3"=>""
] as $dep=>$status) {
if (extension_loaded(strtolower($dep))) { ?> if (extension_loaded(strtolower($dep))) { ?>
<div class="success"><span class="icon-check"></span> <?=$dep?></div> <div class="success"><span class="icon-check"></span> <?=$dep?></div>
<?php <?php
} else { ?> } else {
<div class="error"><span class="icon-cancel"></span> <?=$dep?></div> $class_name = ($status == 'required') ? 'error' : 'warning';
?>
<div class="<?php echo $class_name; ?>"><span class="icon-cancel"></span> <?=$dep?></div>
<?php <?php
} }
} ?> } ?>
@ -166,7 +183,20 @@ if ($newrelic) {
<label><?php i18n("Database Pass"); ?></label> <label><?php i18n("Database Pass"); ?></label>
<input type="text" name="dbpass" value="<?php echo($autocomplete['dbpass']); ?>"> <input type="text" name="dbpass" value="<?php echo($autocomplete['dbpass']); ?>">
<label><?php i18n("Database Type"); ?></label> <label><?php i18n("Database Type"); ?></label>
<input type="text" name="dbtype" value="<?php echo($autocomplete['dbtype']); ?>"> <select name="dbtype">
<?php
foreach ($aValidDBType as $pos => $key) {
if ($autocomplete['dbtype'] == $key) {
$select_dbtypes .= '<option selected="selected" value="' . $key . '">' . $key . '</option>';
} else {
$select_dbtypes .= '<option value="' . $key . '">' . $key . '</option>';
}
}
echo($select_dbtypes);
unset($select_dbtypes);
?>
</select>
<hr> <hr>
<?php <?php
$location = array( $location = array(
@ -266,6 +296,7 @@ if ($newrelic) {
<label><?php i18n("Timezone"); ?></label> <label><?php i18n("Timezone"); ?></label>
<select name="timezone"> <select name="timezone">
<?php <?php
$timezones = "";
foreach ($location as $key => $city) { foreach ($location as $key => $city) {
if ($autocomplete['timezone'] == $key) { if ($autocomplete['timezone'] == $key) {
$timezones .= '<option selected="selected" value="' . $key . '">' . $city . '</option>'; $timezones .= '<option selected="selected" value="' . $key . '">' . $city . '</option>';
@ -273,7 +304,8 @@ if ($newrelic) {
$timezones .= '<option value="' . $key . '">' . $city . '</option>'; $timezones .= '<option value="' . $key . '">' . $city . '</option>';
} }
} }
echo($timezones); echo($timezones);
unset($timezones);
?> ?>
</select> </select>
<button><?php i18n("Install"); ?></button> <button><?php i18n("Install"); ?></button>