*/
use Friendica\App;
-use Friendica\Core\L10n;
use Friendica\Core\Install;
+use Friendica\Core\L10n;
use Friendica\Core\System;
-use Friendica\Database\DBM;
+use Friendica\Database\DBA;
use Friendica\Util\Temporal;
$install_wizard_pass = 1;
$a->setConfigValue('system', 'value', '../install');
$a->theme['stylesheet'] = System::baseUrl()."/view/install/style.css";
- Install::setInstallMode();
-
global $install_wizard_pass;
if (x($_POST, 'pass')) {
$install_wizard_pass = intval($_POST['pass']);
$phpath = notags(trim($_POST['phpath']));
require_once("include/dba.php");
- if (!dba::connect($dbhost, $dbuser, $dbpass, $dbdata)) {
+ if (!DBA::connect($dbhost, $dbuser, $dbpass, $dbdata)) {
$a->data['db_conn_failed'] = true;
}
$adminmail = notags(trim($_POST['adminmail']));
// connect to db
- dba::connect($dbhost, $dbuser, $dbpass, $dbdata);
+ DBA::connect($dbhost, $dbuser, $dbpass, $dbdata);
- Install::install($urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $phpath, $timezone, $language, $adminmail);
+ $errors = Install::createConfig($urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $phpath, $timezone, $language, $adminmail);
+
+ if ($errors) {
+ $a->data['db_failed'] = $errors;
+ return;
+ }
+
+ $errors = Install::installDatabaseStructure();
+
+ if ($errors) {
+ $a->data['db_failed'] = $errors;
+ } else {
+ $a->data['db_installed'] = true;
+ }
return;
break;
$db_return_text .= $txt;
}
- if (dba::$connected) {
+ if (DBA::$connected) {
$r = q("SELECT COUNT(*) as `total` FROM `user`");
- if (DBM::is_result($r) && $r[0]['total']) {
+ if (DBA::isResult($r) && $r[0]['total']) {
$tpl = get_markup_template('install.tpl');
return replace_macros($tpl, [
'$title' => $install_title,
case 2: { // Database config
- $dbhost = ((x($_POST, 'dbhost')) ? notags(trim($_POST['dbhost'])) : 'localhost');
- $dbuser = notags(trim($_POST['dbuser']));
- $dbpass = notags(trim($_POST['dbpass']));
- $dbdata = notags(trim($_POST['dbdata']));
- $phpath = notags(trim($_POST['phpath']));
-
- $adminmail = notags(trim($_POST['adminmail']));
+ $dbhost = notags(trim(defaults($_POST, 'dbhost' , 'localhost')));
+ $dbuser = notags(trim(defaults($_POST, 'dbuser' , '' )));
+ $dbpass = notags(trim(defaults($_POST, 'dbpass' , '' )));
+ $dbdata = notags(trim(defaults($_POST, 'dbdata' , '' )));
+ $phpath = notags(trim(defaults($_POST, 'phpath' , '' )));
+ $adminmail = notags(trim(defaults($_POST, 'adminmail', '' )));
$tpl = get_markup_template('install_db.tpl');
$o .= replace_macros($tpl, [
'$dbdata' => ['dbdata', L10n::t('Database Name'), $dbdata, '', 'required'],
'$adminmail' => ['adminmail', L10n::t('Site administrator email address'), $adminmail, L10n::t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'],
-
-
'$lbl_10' => L10n::t('Please select a default timezone for your website'),
'$baseurl' => System::baseUrl(),
'$phpath' => $phpath,
'$submit' => L10n::t('Submit'),
-
]);
return $o;
}; break;