public function install()
    {
        define('GL_INSTALL', true);
        $this->init();
        echo '<pre>';
        $fail = false;
        $db = new DatabaseManager();
        if ($db->connectAndSelect()) {
            $this->setDatabase($db);
            $this->log('Connection to database ok');

            $this->log('Installing Database...');
            $models = $this->getModels();
            foreach ($models as $model) {
                $instance = new $model(null);
                if ($instance instanceof Model) {
                    $diff = $instance->getStructureDifferences($db, isset($_GET['drop']));
                    $this->log('Installing table \'' . $instance->getTableName() . '\' generated by ' . get_class($instance) . '...',
                        2);
                    foreach ($diff as $action) {
                        $this->log('Action: ' . $action['sql'] . '...', 3, false);

                        if (isset($_GET['exec'])) {
                            try {
                                DBStructure::runAction($db, $instance, $action);
                                $this->log('[OK]', 0);
                            } catch (\Exception $ex) {
                                $this->log('[FAIL]', 0);
                                $fail = true;
                            }
                        }
                        echo "\n";
                    }
                }
            }
            if (!isset($_GET['exec'])) {
                $this->log('Please <a href="?exec">click here</a> to make this changes in the database.');
            } else {
                $db2 = new DBStructure();
                $db2->setDatabaseUpdate();
                $this->log('All done site ready for develop/production!');
            }
        } else {
            if ($db->getConnection() !== null) {
                if (isset($_GET['create_database'])) {
                    if ($db->exec('CREATE DATABASE ' . $this->config['database']['database'])) {
                        echo 'Database created successful! Please reload the navigator';
                    } else {
                        echo 'Can not create the database!';
                    }
                } else {
                    echo 'Can\'t select the database <a href="install.php?create_database">Try to create database</a>';
                }
            } else {
                echo 'Cannot connect to database';
            }
        }
    }
public function install()
    {
        define('GL_INSTALL', true);
        $this->init();
        echo '<pre>';
        $fail = false;
        $db = new DatabaseManager();
        if ($db->connectAndSelect()) {
            $this->setDatabase($db);
            $this->log('Connection to database ok');

            $this->log('Installing Database...');
            $models = $this->getModels();
            foreach ($models as $model) {
                $instance = new $model(null);
                if ($instance instanceof Model) {
                    $diff = $instance->getStructureDifferences($db, isset($_GET['drop']));
                    $this->log('Installing table \'' . $instance->getTableName() . '\' generated by ' . get_class($instance) . '...',
                        2);
                    foreach ($diff as $action) {
                        $this->log('Action: ' . $action['sql'] . '...', 3, false);

                        if (isset($_GET['exec'])) {
                            try {
                                DBStructure::runAction($db, $instance, $action);
                                $this->log('[OK]', 0);
                            } catch (\Exception $ex) {
                                $this->log('[FAIL]', 0);
                                $fail = true;
                            }
                        }
                        echo "\n";
                    }
                }
            }
            if (!isset($_GET['exec'])) {
                $this->log('Please <a href="?exec">click here</a> to make this changes in the database.');
            } else {
                $db2 = new DBStructure();
                $db2->setDatabaseUpdate();
                $this->log('All done site ready for develop/production!');
            }
        } else {
            if ($db->getConnection() !== null) {
                if (isset($_GET['create_database'])) {
                    if ($db->exec('CREATE DATABASE ' . $this->config['database']['database'])) {
                        echo 'Database created successful! Please reload the navigator';
                    } else {
                        echo 'Can not create the database!';
                    }
                } else {
                    echo 'Can\'t select the database <a href="install.php?create_database">Try to create database</a>';
                }
            } else {
                echo 'Cannot connect to database';
            }
        }
    }
public function install ( ) { define ( 'GL_INSTALL' , true ) ; $ this -> init ( ) ; echo '<pre>' ; $ fail = false ; $ db = new DatabaseManager ( ) ; if ( $ db -> connectAndSelect ( ) ) { $ this -> setDatabase ( $ db ) ; $ this -> log ( 'Connection to database ok' ) ; $ this -> log ( 'Installing Database...' ) ; $ models = $ this -> getModels ( ) ; foreach ( $ models as $ model ) { $ instance = new $ model ( null ) ; if ( $ instance instanceof Model ) { $ diff = $ instance -> getStructureDifferences ( $ db , isset ( $ _GET [ 'drop' ] ) ) ; $ this -> log ( 'Installing table \'' . $ instance -> getTableName ( ) . '\' generated by ' . get_class ( $ instance ) . '...' , 2 ) ; foreach ( $ diff as $ action ) { $ this -> log ( 'Action: ' . $ action [ 'sql' ] . '...' , 3 , false ) ; if ( isset ( $ _GET [ 'exec' ] ) ) { try { DBStructure :: runAction ( $ db , $ instance , $ action ) ; $ this -> log ( '[OK]' , 0 ) ; } catch ( \ Exception $ ex ) { $ this -> log ( '[FAIL]' , 0 ) ; $ fail = true ; } } echo "\n" ; } } } if ( ! isset ( $ _GET [ 'exec' ] ) ) { $ this -> log ( 'Please <a href="?exec">click here</a> to make this changes in the database.' ) ; } else { $ db2 = new DBStructure ( ) ; $ db2 -> setDatabaseUpdate ( ) ; $ this -> log ( 'All done site ready for develop/production!' ) ; } } else { if ( $ db -> getConnection ( ) !== null ) { if ( isset ( $ _GET [ 'create_database' ] ) ) { if ( $ db -> exec ( 'CREATE DATABASE ' . $ this -> config [ 'database' ] [ 'database' ] ) ) { echo 'Database created successful! Please reload the navigator' ; } else { echo 'Can not create the database!' ; } } else { echo 'Can\'t select the database <a href="install.php?create_database">Try to create database</a>' ; } } else { echo 'Cannot connect to database' ; } } }
Instala la base de datos con los modelos actualmente cargados en el init

@deprecated Since 0.2.0
@throws \Exception
Instala la base de datos con los modelos actualmente cargados en el init