XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
install_checkDB.inc.php
1<?php
11
12include_once '../mainfile.php';
13include_once './class/dbmanager.php';
14
15$dbm = new db_manager();
16$title = _INSTALL_L104;
17
18if ( ! $dbm->isConnectable() ) {
19 $wizard->addArray( 'checks', _NGIMG . _INSTALL_L106 );
20 $wizard->addArray( 'msgs', '<div class="confirmError">'. _INSTALL_L107 .'</div' );
21 $wizard->setBack( [ 'start', _INSTALL_L103 ] );
22 $wizard->setReload( true );
23} else {
24 // Check connection to Database
25 $wizard->addArray( 'checks', _OKIMG . _INSTALL_L108 );
26
27 // DB
28 if ( ! $dbm->dbExists() ) {
29 $wizard->addArray( 'checks', _NGIMG . sprintf( _INSTALL_L109 , XOOPS_DB_NAME ) );
30 $wizard->addArray( 'msgs', '<div class="confirmError">'. _INSTALL_L21 . '<br><code>' . XOOPS_DB_NAME . '</code></div>' );
31 $wizard->addArray( 'msgs', '<div class="confirmInfo">'._INSTALL_L22. '</div>' );
32 } else {
33
34 $wizard->addArray( 'checks', _OKIMG . sprintf( _INSTALL_L110, '<code>'.XOOPS_DB_NAME.'</code>' ) );
35 // Detect Table Users
36 if ( ! $dbm->tableExists( 'users' ) ) {
37 $wizard->addArray( 'msgs', '<div class="confirmOk">'._INSTALL_L111.'</div>' );
38 $wizard->setNext( [ 'createTables', _INSTALL_L40 ] );
39
40 }elseif ( $dbm->tableExists( 'users' ) ) {
41 $wizard->addArray('msgs', '<div class="confirmError">'._INSTALL_L130.'</div>');
42 $wizard->setBack( [ 'start', _INSTALL_L103 ] );
43 // Force might duplicate results in DB tables eg. groups
44 $wizard->setNext( [ 'createTables', _INSTALL_L40 ] );
45 } elseif ( ! $dbm->tableExists( 'config' ) ) {
46 $wizard->addArray( 'msgs', '<div class="confirmError">'._INSTALL_L130.'</div>' );
47 // Attempt to update previous versions
48 $wizard->setNext( [ 'updateTables', _INSTALL_L14 ] );
49 $wizard->setReload( true );
50 } else {
51 $wizard->addArray( 'checks', _NGIMG . _INSTALL_L131 );
52 $wizard->addArray( 'msgs', '<div class="confirmError">'. _INSTALL_L131 .'</div>' );
53 $wizard->setBack( [ 'start', _INSTALL_L103 ] );
54 }
55 }
56}
57
58$wizard->render( 'install_checkDB.tpl.php' );