bin/php/updatesearchindexsolr.php
protected function initializeDB()
    {
        $dbUser = $this->Options['db-user'] ? $this->Options['db-user'] : false;
        $dbPassword = $this->Options['db-password'] ? $this->Options['db-password'] : false;
        $dbHost = $this->Options['db-host'] ? $this->Options['db-host'] : false;
        $dbName = $this->Options['db-database'] ? $this->Options['db-database'] : false;
        $dbImpl = $this->Options['db-driver'] ? $this->Options['db-driver'] : false;
        $showSQL = $this->Options['sql'] ? true : false;

        // Forcing creation of new instance to avoid mysql wait_timeout to kill
        // the connection before it's done
        $db = eZDB::instance( false, false, true );

        if ( $dbHost or $dbName or $dbUser or $dbImpl )
        {
            $params = array();
            if ( $dbHost !== false )
                $params['server'] = $dbHost;
            if ( $dbUser !== false )
            {
                $params['user'] = $dbUser;
                $params['password'] = '';
            }
            if ( $dbPassword !== false )
                $params['password'] = $dbPassword;
            if ( $dbName !== false )
                $params['database'] = $dbName;
            $db = eZDB::instance( $dbImpl, $params, true );
            eZDB::setInstance( $db );
        }

        $db->setIsSQLOutputEnabled( $showSQL );
    }
protected function initializeDB()
    {
        $dbUser = $this->Options['db-user'] ? $this->Options['db-user'] : false;
        $dbPassword = $this->Options['db-password'] ? $this->Options['db-password'] : false;
        $dbHost = $this->Options['db-host'] ? $this->Options['db-host'] : false;
        $dbName = $this->Options['db-database'] ? $this->Options['db-database'] : false;
        $dbImpl = $this->Options['db-driver'] ? $this->Options['db-driver'] : false;
        $showSQL = $this->Options['sql'] ? true : false;

        // Forcing creation of new instance to avoid mysql wait_timeout to kill
        // the connection before it's done
        $db = eZDB::instance( false, false, true );

        if ( $dbHost or $dbName or $dbUser or $dbImpl )
        {
            $params = array();
            if ( $dbHost !== false )
                $params['server'] = $dbHost;
            if ( $dbUser !== false )
            {
                $params['user'] = $dbUser;
                $params['password'] = '';
            }
            if ( $dbPassword !== false )
                $params['password'] = $dbPassword;
            if ( $dbName !== false )
                $params['database'] = $dbName;
            $db = eZDB::instance( $dbImpl, $params, true );
            eZDB::setInstance( $db );
        }

        $db->setIsSQLOutputEnabled( $showSQL );
    }
protected function initializeDB ( ) { $ dbUser = $ this -> Options [ 'db-user' ] ? $ this -> Options [ 'db-user' ] : false ; $ dbPassword = $ this -> Options [ 'db-password' ] ? $ this -> Options [ 'db-password' ] : false ; $ dbHost = $ this -> Options [ 'db-host' ] ? $ this -> Options [ 'db-host' ] : false ; $ dbName = $ this -> Options [ 'db-database' ] ? $ this -> Options [ 'db-database' ] : false ; $ dbImpl = $ this -> Options [ 'db-driver' ] ? $ this -> Options [ 'db-driver' ] : false ; $ showSQL = $ this -> Options [ 'sql' ] ? true : false ; // Forcing creation of new instance to avoid mysql wait_timeout to kill // the connection before it's done $ db = eZDB :: instance ( false , false , true ) ; if ( $ dbHost or $ dbName or $ dbUser or $ dbImpl ) { $ params = array ( ) ; if ( $ dbHost !== false ) $ params [ 'server' ] = $ dbHost ; if ( $ dbUser !== false ) { $ params [ 'user' ] = $ dbUser ; $ params [ 'password' ] = '' ; } if ( $ dbPassword !== false ) $ params [ 'password' ] = $ dbPassword ; if ( $ dbName !== false ) $ params [ 'database' ] = $ dbName ; $ db = eZDB :: instance ( $ dbImpl , $ params , true ) ; eZDB :: setInstance ( $ db ) ; } $ db -> setIsSQLOutputEnabled ( $ showSQL ) ; }
Create custom DB connection if DB options provided
Create custom DB connection if DB options provided