aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Setup.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-04-25 20:12:36 -0700
committerredmatrix <git@macgirvin.com>2016-04-25 20:12:36 -0700
commitd62f4908146f2bdfb396bff06f74afb62995e4a3 (patch)
treedd60d884bae7ef8ffe2c3621b4e8e2d4a0859cf8 /Zotlabs/Module/Setup.php
parent6bf771651846ba2906c4f03600277ebbe2f3b98a (diff)
downloadvolse-hubzilla-d62f4908146f2bdfb396bff06f74afb62995e4a3.tar.gz
volse-hubzilla-d62f4908146f2bdfb396bff06f74afb62995e4a3.tar.bz2
volse-hubzilla-d62f4908146f2bdfb396bff06f74afb62995e4a3.zip
Setup was horked after this commit and I couldn't easily make it right so reverting - will try again at a future date
Revert "remove global db variable" This reverts commit c3b0c0f32a17649503db67f208cce6f9e0cdc322.
Diffstat (limited to 'Zotlabs/Module/Setup.php')
-rw-r--r--Zotlabs/Module/Setup.php38
1 files changed, 31 insertions, 7 deletions
diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php
index 5a4a87866..3ac67e1c0 100644
--- a/Zotlabs/Module/Setup.php
+++ b/Zotlabs/Module/Setup.php
@@ -57,7 +57,7 @@ class Setup extends \Zotlabs\Web\Controller {
* @param[in,out] App &$a
*/
function post() {
-
+ global $db;
switch($this->install_wizard_pass) {
case 1:
@@ -82,14 +82,37 @@ class Setup extends \Zotlabs\Web\Controller {
$siteurl = rtrim($siteurl,'/');
require_once('include/dba/dba_driver.php');
- $db = null;
- $db = \DBA::dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true);
+ unset($db);
+ $db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true);
if(! $db->connected) {
echo 'Database Connect failed: ' . $db->error;
killme();
\App::$data['db_conn_failed']=true;
}
+ /*if(get_db_errno()) {
+ unset($db);
+ $db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, '', true);
+
+ if(! get_db_errno()) {
+ $r = q("CREATE DATABASE '%s'",
+ dbesc($dbdata)
+ );
+ if($r) {
+ unset($db);
+ $db = new dba($dbhost, $dbport, $dbuser, $dbpass, $dbdata, true);
+ } else {
+ \App::$data['db_create_failed']=true;
+ }
+ } else {
+ \App::$data['db_conn_failed']=true;
+ return;
+ }
+ }*/
+ //if(get_db_errno()) {
+
+ //}
+
return;
break;
case 4:
@@ -116,7 +139,7 @@ class Setup extends \Zotlabs\Web\Controller {
}
// connect to db
- $db = \DBA::dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true);
+ $db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true);
if(! $db->connected) {
echo 'CRITICAL: DB not connected.';
@@ -172,6 +195,7 @@ class Setup extends \Zotlabs\Web\Controller {
* @return string parsed HTML output
*/
function get() {
+ global $db;
$o = '';
$wizard_status = '';
@@ -204,7 +228,7 @@ class Setup extends \Zotlabs\Web\Controller {
$txt .= "<pre>".\App::$data['db_failed'] . "</pre>". EOL ;
$db_return_text .= $txt;
}
- if(\DBA::$dba && \DBA::$dba->connected) {
+ if($db && $db->connected) {
$r = q("SELECT COUNT(*) as `total` FROM `account`");
if($r && count($r) && $r[0]['total']) {
$tpl = get_markup_template('install.tpl');
@@ -669,12 +693,12 @@ class Setup extends \Zotlabs\Web\Controller {
function load_database($db) {
- $str = file_get_contents(\DBA::$dba->get_install_script());
+ $str = file_get_contents($db->get_install_script());
$arr = explode(';',$str);
$errors = false;
foreach($arr as $a) {
if(strlen(trim($a))) {
- $r = @\DBA::$dba->q(trim($a));
+ $r = @$db->q(trim($a));
if(! $r) {
$errors .= t('Errors encountered creating database tables.') . $a . EOL;
}