aboutsummaryrefslogtreecommitdiffstats
path: root/mod/install.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2010-11-18 02:59:59 -0800
committerFriendika <info@friendika.com>2010-11-18 02:59:59 -0800
commitabc6199c175986c6d3f7b8b7944f1c3c1ec26163 (patch)
treed0cbb01228f693e35dc1039c47fa82484fd41d24 /mod/install.php
parentb4c277da22442cdb2d424490eee9ed9fcedf2c76 (diff)
downloadvolse-hubzilla-abc6199c175986c6d3f7b8b7944f1c3c1ec26163.tar.gz
volse-hubzilla-abc6199c175986c6d3f7b8b7944f1c3c1ec26163.tar.bz2
volse-hubzilla-abc6199c175986c6d3f7b8b7944f1c3c1ec26163.zip
more pre-install checks, try and create db if doesn't exist
Diffstat (limited to 'mod/install.php')
-rw-r--r--mod/install.php35
1 files changed, 31 insertions, 4 deletions
diff --git a/mod/install.php b/mod/install.php
index 2a791b98c..86edc4c28 100644
--- a/mod/install.php
+++ b/mod/install.php
@@ -17,11 +17,21 @@ function install_post(&$a) {
$db = new dba($dbhost, $dbuser, $dbpass, $dbdata, $true);
if(mysqli_connect_errno()) {
- notice( t('Could not connect to database.') . EOL);
- return;
+ $db = new dba($dbhost, $dbuser, $dbpass, '', true);
+ if(! mysql_connect_errno()) {
+ $r = q("CREATE DATABASE '%s'",
+ dbesc($dbdata)
+ );
+ if($r)
+ $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, $true);
+ }
+ if(mysqli_connect_errno()) {
+ notice( t('Could not create/connect to database.') . EOL);
+ return;
+ }
}
- else
- notice( t('Connected to database.') . EOL);
+
+ notice( t('Connected to database.') . EOL);
$tpl = load_view_file('view/htconfig.tpl');
$txt = replace_macros($tpl,array(
@@ -67,8 +77,13 @@ function install_post(&$a) {
function install_content(&$a) {
+ $o = '';
+
notice( t('Welcome to Friendika.') . EOL);
+
+ check_funcs();
+
$o .= check_htconfig();
if(strlen($o))
return $o;
@@ -106,6 +121,18 @@ function check_php(&$phpath) {
return $o;
}
+function check_funcs() {
+ if(! function_exists('curl_init'))
+ notice( t('Error: libCURL PHP module required but not installed.') . EOL);
+ if(! function_exists('imagecreatefromjpeg'))
+ notice( t('Error: GD graphics PHP module with JPEG support required but not installed.') . EOL);
+ if(! function_exists('openssl_public_encrypt'))
+ notice( t('Error: openssl PHP module required but not installed.') . EOL);
+ if(! function_exists('mysqli_connect'))
+ notice( t('Error: mysqli PHP module required but not installed.') . EOL);
+}
+
+
function check_htconfig() {
if(((file_exists('.htconfig.php')) && (! is_writable('.htconfig.php')))