X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=mod%2Finstall.php;h=27cc6af840e654d10e6f1758120bd70876af415c;hb=df7702709b07560af1d469f0835586af317f39b0;hp=dc91f848e6c74ea99f31b662ae7ee880a4a974ad;hpb=f3005918aff04fc435d0f526bf235bd95468294c;p=friendica.git diff --git a/mod/install.php b/mod/install.php index dc91f848e6..27cc6af840 100644 --- a/mod/install.php +++ b/mod/install.php @@ -12,19 +12,23 @@ function install_post(&$a) { $dbdata = notags(trim($_POST['dbdata'])); $timezone = notags(trim($_POST['timezone'])); $phpath = notags(trim($_POST['phpath'])); + $adminmail = notags(trim($_POST['adminmail'])); require_once("dba.php"); - + unset($db); $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true); if(mysqli_connect_errno()) { + unset($db); $db = new dba($dbhost, $dbuser, $dbpass, '', true); if(! mysqli_connect_errno()) { $r = q("CREATE DATABASE '%s'", dbesc($dbdata) ); - if($r) + if($r) { + unset($db); $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true); + } } if(mysqli_connect_errno()) { notice( t('Could not create/connect to database.') . EOL); @@ -32,9 +36,9 @@ function install_post(&$a) { } } - notice( t('Connected to database.') . EOL); + info( t('Connected to database.') . EOL); - $tpl = load_view_file('view/htconfig.tpl'); + $tpl = get_intltext_template('htconfig.tpl'); $txt = replace_macros($tpl,array( '$dbhost' => $dbhost, '$dbuser' => $dbuser, @@ -42,46 +46,59 @@ function install_post(&$a) { '$dbdata' => $dbdata, '$timezone' => $timezone, '$urlpath' => $urlpath, - '$phpath' => $phpath + '$phpath' => $phpath, + '$adminmail' => $adminmail )); + $result = file_put_contents('.htconfig.php', $txt); if(! $result) { $a->data = $txt; } $errors = load_database($db); - if(! $errors) { - // Our sessions normally are stored in the database. But as we have only managed - // to get it bootstrapped milliseconds ago, we have to apply a bit of trickery so - // that you'll see the following important notice (which is stored in the session). - - session_write_close(); - - require_once('session.php'); - session_start(); - session_regenerate_id(); - $_SESSION['sysmsg'] = ''; + if($errors) + $a->data['db_failed'] = true; + else + $a->data['db_installed'] = true; - notice( t('Database import succeeded.') . EOL - . t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.') . EOL - . t('Please see the file "INSTALL.txt".') . EOL ); - goaway($a->get_baseurl() . '/register' ); - } - else { - $db = null; // start fresh - notice( t('Database import failed.') . EOL - . t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . EOL - . t('Please see the file "INSTALL.txt".') . EOL ); - } + return; } function install_content(&$a) { + global $db; $o = ''; + + if(x($a->data,'db_installed')) { + $o .= '
';
+ $o .= t('Your Friendika site database has been installed.') . EOL;
+ $o .= t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.') . EOL ;
+ $o .= t('Please see the file "INSTALL.txt".') . EOL ;
+ $o .= '
';
+ $o .= '' . t('Proceed to registration') . '' ;
+ $o .= '