Merge pull request #3390 from annando/1704-cleaned_install
Added a PDO check in the install routine and cleaned it up
This commit is contained in:
commit
4493f37af3
3 changed files with 65 additions and 102 deletions
|
@ -28,7 +28,7 @@ Requirements
|
||||||
* Apache with mod-rewrite enabled and "Options All" so you can use a local .htaccess file
|
* Apache with mod-rewrite enabled and "Options All" so you can use a local .htaccess file
|
||||||
* PHP 5.4+.
|
* PHP 5.4+.
|
||||||
* PHP *command line* access with register_argc_argv set to true in the php.ini file
|
* PHP *command line* access with register_argc_argv set to true in the php.ini file
|
||||||
* curl, gd, mysql, hash and openssl extensions
|
* Curl, GD, PDO, MySQLi, hash and OpenSSL extensions
|
||||||
* some form of email server or email gateway such that PHP mail() works
|
* some form of email server or email gateway such that PHP mail() works
|
||||||
* Mysql 5.5.3+ or an equivalant alternative for MySQL (MariaDB, Percona Server etc.)
|
* Mysql 5.5.3+ or an equivalant alternative for MySQL (MariaDB, Percona Server etc.)
|
||||||
* the ability to schedule jobs with cron (Linux/Mac) or Scheduled Tasks (Windows) (Note: other options are presented in Section 7 of this document.)
|
* the ability to schedule jobs with cron (Linux/Mac) or Scheduled Tasks (Windows) (Note: other options are presented in Section 7 of this document.)
|
||||||
|
|
|
@ -24,7 +24,7 @@ Wir planen, diese Einschränkung in einer zukünftigen Version zu beheben.
|
||||||
- Apache mit einer aktiverten mod-rewrite-Funktion und dem Eintrag "Options All", so dass du die lokale .htaccess-Datei nutzen kannst
|
- Apache mit einer aktiverten mod-rewrite-Funktion und dem Eintrag "Options All", so dass du die lokale .htaccess-Datei nutzen kannst
|
||||||
- PHP 5.2+. Je neuer, desto besser. Du benötigst 5.3 für die Authentifizierung untereinander. In einer Windows-Umgebung arbeitet die Version 5.2+ möglicherweise nicht, da die Funktion dns_get_record() erst ab Version 5.3 verfügbar ist.
|
- PHP 5.2+. Je neuer, desto besser. Du benötigst 5.3 für die Authentifizierung untereinander. In einer Windows-Umgebung arbeitet die Version 5.2+ möglicherweise nicht, da die Funktion dns_get_record() erst ab Version 5.3 verfügbar ist.
|
||||||
- PHP *Kommandozeilen*-Zugang mit register_argc_argv auf "true" gesetzt in der php.ini-Datei
|
- PHP *Kommandozeilen*-Zugang mit register_argc_argv auf "true" gesetzt in der php.ini-Datei
|
||||||
- curl, gd, mysql und openssl-Erweiterung
|
- Curl, GD, PDO, MySQLi und OpenSSL-Erweiterung
|
||||||
- etwas in der Art eines Email-Servers oder eines Gateways wie PHP mail()
|
- etwas in der Art eines Email-Servers oder eines Gateways wie PHP mail()
|
||||||
- Mysql 5.x
|
- Mysql 5.x
|
||||||
- die Möglichkeit, wiederkehrende Aufgaben mit cron (Linux/Mac) oder "Scheduled Tasks" einzustellen (Windows) [Beachte: andere Optionen sind in Abschnitt 7 dieser Dokumentation zu finden]
|
- die Möglichkeit, wiederkehrende Aufgaben mit cron (Linux/Mac) oder "Scheduled Tasks" einzustellen (Windows) [Beachte: andere Optionen sind in Abschnitt 7 dieser Dokumentation zu finden]
|
||||||
|
|
|
@ -43,26 +43,7 @@ function install_post(App $a) {
|
||||||
require_once("include/dba.php");
|
require_once("include/dba.php");
|
||||||
unset($db);
|
unset($db);
|
||||||
$db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true);
|
$db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true);
|
||||||
/*if(get_db_errno()) {
|
if (!$db->connected) {
|
||||||
unset($db);
|
|
||||||
$db = new dba($dbhost, $dbuser, $dbpass, '', true);
|
|
||||||
|
|
||||||
if(! get_db_errno()) {
|
|
||||||
$r = q("CREATE DATABASE '%s' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci",
|
|
||||||
dbesc($dbdata)
|
|
||||||
);
|
|
||||||
if ($r) {
|
|
||||||
unset($db);
|
|
||||||
$db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true);
|
|
||||||
} else {
|
|
||||||
$a->data['db_create_failed']=true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$a->data['db_conn_failed']=true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
if (get_db_errno()) {
|
|
||||||
$a->data['db_conn_failed'] = true;
|
$a->data['db_conn_failed'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,14 +98,6 @@ function install_post(App $a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_db_errno() {
|
|
||||||
if (class_exists('mysqli')) {
|
|
||||||
return mysqli_connect_errno();
|
|
||||||
} else {
|
|
||||||
return mysql_errno();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function install_content(App $a) {
|
function install_content(App $a) {
|
||||||
|
|
||||||
global $install_wizard_pass, $db;
|
global $install_wizard_pass, $db;
|
||||||
|
@ -342,7 +315,7 @@ function check_php(&$phpath, &$checks) {
|
||||||
$help = "";
|
$help = "";
|
||||||
if (!$passed) {
|
if (!$passed) {
|
||||||
$help .= t('Could not find a command line version of PHP in the web server PATH.'). EOL;
|
$help .= t('Could not find a command line version of PHP in the web server PATH.'). EOL;
|
||||||
$help .= t("If you don't have a command line version of PHP installed on server, you will not be able to run background polling via cron. See <a href='https://github.com/friendica/friendica/blob/master/doc/Install.md#set-up-the-poller'>'Setup the poller'</a>") . EOL ;
|
$help .= t("If you don't have a command line version of PHP installed on server, you will not be able to run the background processing. See <a href='https://github.com/friendica/friendica/blob/master/doc/Install.md#set-up-the-poller'>'Setup the poller'</a>") . EOL;
|
||||||
$help .= EOL . EOL;
|
$help .= EOL . EOL;
|
||||||
$tpl = get_markup_template('field_input.tpl');
|
$tpl = get_markup_template('field_input.tpl');
|
||||||
$help .= replace_macros($tpl, array(
|
$help .= replace_macros($tpl, array(
|
||||||
|
@ -413,7 +386,7 @@ function check_funcs(&$checks) {
|
||||||
check_add($ck_funcs, t('libCurl PHP module'), true, true, "");
|
check_add($ck_funcs, t('libCurl PHP module'), true, true, "");
|
||||||
check_add($ck_funcs, t('GD graphics PHP module'), true, true, "");
|
check_add($ck_funcs, t('GD graphics PHP module'), true, true, "");
|
||||||
check_add($ck_funcs, t('OpenSSL PHP module'), true, true, "");
|
check_add($ck_funcs, t('OpenSSL PHP module'), true, true, "");
|
||||||
check_add($ck_funcs, t('mysqli PHP module'), true, true, "");
|
check_add($ck_funcs, t('PDO or MySQLi PHP module'), true, true, "");
|
||||||
check_add($ck_funcs, t('mb_string PHP module'), true, true, "");
|
check_add($ck_funcs, t('mb_string PHP module'), true, true, "");
|
||||||
check_add($ck_funcs, t('XML PHP module'), true, true, "");
|
check_add($ck_funcs, t('XML PHP module'), true, true, "");
|
||||||
check_add($ck_funcs, t('iconv module'), true, true, "");
|
check_add($ck_funcs, t('iconv module'), true, true, "");
|
||||||
|
@ -438,9 +411,13 @@ function check_funcs(&$checks) {
|
||||||
$ck_funcs[2]['status'] = false;
|
$ck_funcs[2]['status'] = false;
|
||||||
$ck_funcs[2]['help'] = t('Error: openssl PHP module required but not installed.');
|
$ck_funcs[2]['help'] = t('Error: openssl PHP module required but not installed.');
|
||||||
}
|
}
|
||||||
if (! function_exists('mysqli_connect')){
|
if (! function_exists('mysqli_connect') && !class_exists('pdo')) {
|
||||||
$ck_funcs[3]['status'] = false;
|
$ck_funcs[3]['status'] = false;
|
||||||
$ck_funcs[3]['help']= t('Error: mysqli PHP module required but not installed.');
|
$ck_funcs[3]['help'] = t('Error: PDO or MySQLi PHP module required but not installed.');
|
||||||
|
}
|
||||||
|
if (!function_exists('mysqli_connect') && class_exists('pdo') && !in_array('mysql', PDO::getAvailableDrivers())) {
|
||||||
|
$ck_funcs[3]['status'] = false;
|
||||||
|
$ck_funcs[3]['help'] = t('Error: The MySQL driver for PDO is not installed.');
|
||||||
}
|
}
|
||||||
if (! function_exists('mb_strlen')) {
|
if (! function_exists('mb_strlen')) {
|
||||||
$ck_funcs[4]['status'] = false;
|
$ck_funcs[4]['status'] = false;
|
||||||
|
@ -559,18 +536,6 @@ function load_database($db) {
|
||||||
require_once("include/dbstructure.php");
|
require_once("include/dbstructure.php");
|
||||||
$errors = update_structure(false, true);
|
$errors = update_structure(false, true);
|
||||||
|
|
||||||
/* $str = file_get_contents('database.sql');
|
|
||||||
$arr = explode(';',$str);
|
|
||||||
$errors = false;
|
|
||||||
foreach($arr as $a) {
|
|
||||||
if(strlen(trim($a))) {
|
|
||||||
$r = @$db->q(trim($a));
|
|
||||||
if(false === $r) {
|
|
||||||
$errors .= t('Errors encountered creating database tables.') . $a . EOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,5 +549,3 @@ function what_next() {
|
||||||
.t("Go to your new Friendica node <a href='$baseurl/register'>registration page</a> and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.")
|
.t("Go to your new Friendica node <a href='$baseurl/register'>registration page</a> and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.")
|
||||||
."</p>";
|
."</p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue