more pre-install checks, try and create db if doesn't exist
This commit is contained in:
parent
b4c277da22
commit
abc6199c17
2 changed files with 37 additions and 8 deletions
|
@ -17,11 +17,21 @@ function install_post(&$a) {
|
||||||
$db = new dba($dbhost, $dbuser, $dbpass, $dbdata, $true);
|
$db = new dba($dbhost, $dbuser, $dbpass, $dbdata, $true);
|
||||||
|
|
||||||
if(mysqli_connect_errno()) {
|
if(mysqli_connect_errno()) {
|
||||||
notice( t('Could not connect to database.') . EOL);
|
$db = new dba($dbhost, $dbuser, $dbpass, '', true);
|
||||||
return;
|
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');
|
$tpl = load_view_file('view/htconfig.tpl');
|
||||||
$txt = replace_macros($tpl,array(
|
$txt = replace_macros($tpl,array(
|
||||||
|
@ -67,8 +77,13 @@ function install_post(&$a) {
|
||||||
|
|
||||||
function install_content(&$a) {
|
function install_content(&$a) {
|
||||||
|
|
||||||
|
$o = '';
|
||||||
|
|
||||||
notice( t('Welcome to Friendika.') . EOL);
|
notice( t('Welcome to Friendika.') . EOL);
|
||||||
|
|
||||||
|
|
||||||
|
check_funcs();
|
||||||
|
|
||||||
$o .= check_htconfig();
|
$o .= check_htconfig();
|
||||||
if(strlen($o))
|
if(strlen($o))
|
||||||
return $o;
|
return $o;
|
||||||
|
@ -106,6 +121,18 @@ function check_php(&$phpath) {
|
||||||
return $o;
|
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() {
|
function check_htconfig() {
|
||||||
|
|
||||||
if(((file_exists('.htconfig.php')) && (! is_writable('.htconfig.php')))
|
if(((file_exists('.htconfig.php')) && (! is_writable('.htconfig.php')))
|
||||||
|
|
|
@ -205,9 +205,11 @@ function register_post(&$a) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('include/Photo.php');
|
$use_gravatar = ((get_config('system','no_gravatar')) ? false : true);
|
||||||
$nograv = get_config('system','no_gravatar');
|
if($use_gravatar) {
|
||||||
if(! $nograv) {
|
|
||||||
|
require_once('include/Photo.php');
|
||||||
|
|
||||||
$photo = gravatar_img($email);
|
$photo = gravatar_img($email);
|
||||||
$photo_failure = false;
|
$photo_failure = false;
|
||||||
|
|
||||||
|
@ -246,6 +248,7 @@ function register_post(&$a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $a->config['register_policy'] == REGISTER_OPEN ) {
|
if( $a->config['register_policy'] == REGISTER_OPEN ) {
|
||||||
$email_tpl = load_view_file("view/register_open_eml.tpl");
|
$email_tpl = load_view_file("view/register_open_eml.tpl");
|
||||||
$email_tpl = replace_macros($email_tpl, array(
|
$email_tpl = replace_macros($email_tpl, array(
|
||||||
|
@ -302,7 +305,6 @@ function register_post(&$a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue