src/Core/CoreKernel.php
protected function getDatabaseName()
    {
        // Check globals
        global $database;

        if (!empty($database)) {
            return $this->getDatabasePrefix() . $database . $this->getDatabaseSuffix();
        }

        global $databaseConfig;

        if (!empty($databaseConfig['database'])) {
            return $databaseConfig['database']; // Note: Already includes prefix
        }

        // Check environment
        $database = Environment::getEnv('SS_DATABASE_NAME');

        if ($database) {
            return $this->getDatabasePrefix() . $database . $this->getDatabaseSuffix();
        }

        // Auto-detect name
        $chooseName = Environment::getEnv('SS_DATABASE_CHOOSE_NAME');

        if ($chooseName) {
            // Find directory to build name from
            $loopCount = (int)$chooseName;
            $databaseDir = $this->basePath;
            for ($i = 0; $i < $loopCount-1; $i++) {
                $databaseDir = dirname($databaseDir);
            }

            // Build name
            $database = str_replace('.', '', basename($databaseDir));
            $prefix = $this->getDatabasePrefix();

            if ($prefix) {
                $prefix = 'SS_';
            } else {
                // If no prefix, hard-code prefix into database global
                $prefix = '';
                $database = 'SS_' . $database;
            }

            return $prefix . $database;
        }

        // no DB name (may be optional for some connectors)
        return null;
    }
protected function getDatabaseName()
    {
        // Check globals
        global $database;

        if (!empty($database)) {
            return $this->getDatabasePrefix() . $database . $this->getDatabaseSuffix();
        }

        global $databaseConfig;

        if (!empty($databaseConfig['database'])) {
            return $databaseConfig['database']; // Note: Already includes prefix
        }

        // Check environment
        $database = Environment::getEnv('SS_DATABASE_NAME');

        if ($database) {
            return $this->getDatabasePrefix() . $database . $this->getDatabaseSuffix();
        }

        // Auto-detect name
        $chooseName = Environment::getEnv('SS_DATABASE_CHOOSE_NAME');

        if ($chooseName) {
            // Find directory to build name from
            $loopCount = (int)$chooseName;
            $databaseDir = $this->basePath;
            for ($i = 0; $i < $loopCount-1; $i++) {
                $databaseDir = dirname($databaseDir);
            }

            // Build name
            $database = str_replace('.', '', basename($databaseDir));
            $prefix = $this->getDatabasePrefix();

            if ($prefix) {
                $prefix = 'SS_';
            } else {
                // If no prefix, hard-code prefix into database global
                $prefix = '';
                $database = 'SS_' . $database;
            }

            return $prefix . $database;
        }

        // no DB name (may be optional for some connectors)
        return null;
    }
protected function getDatabaseName ( ) { // Check globals global $ database ; if ( ! empty ( $ database ) ) { return $ this -> getDatabasePrefix ( ) . $ database . $ this -> getDatabaseSuffix ( ) ; } global $ databaseConfig ; if ( ! empty ( $ databaseConfig [ 'database' ] ) ) { return $ databaseConfig [ 'database' ] ; // Note: Already includes prefix } // Check environment $ database = Environment :: getEnv ( 'SS_DATABASE_NAME' ) ; if ( $ database ) { return $ this -> getDatabasePrefix ( ) . $ database . $ this -> getDatabaseSuffix ( ) ; } // Auto-detect name $ chooseName = Environment :: getEnv ( 'SS_DATABASE_CHOOSE_NAME' ) ; if ( $ chooseName ) { // Find directory to build name from $ loopCount = ( int ) $ chooseName ; $ databaseDir = $ this -> basePath ; for ( $ i = 0 ; $ i < $ loopCount - 1 ; $ i ++ ) { $ databaseDir = dirname ( $ databaseDir ) ; } // Build name $ database = str_replace ( '.' , '' , basename ( $ databaseDir ) ) ; $ prefix = $ this -> getDatabasePrefix ( ) ; if ( $ prefix ) { $ prefix = 'SS_' ; } else { // If no prefix, hard-code prefix into database global $ prefix = '' ; $ database = 'SS_' . $ database ; } return $ prefix . $ database ; } // no DB name (may be optional for some connectors) return null ; }
Get name of database

@return string
Get name of database