concrete/src/Database/CharacterSetCollation/Manager.php
public function apply($characterSet, $collation, $connectionName = '', $environment = '', callable $messageCallback = null, ErrorList $warnings = null)
    {
        if ($messageCallback === null) {
            $messageCallback = function ($message) { };
        }
        if ((string) $connectionName === '') {
            $connectionName = $this->databaseManager->getDefaultConnection();
        }
        $connection = $this->databaseManager->connection($connectionName);
        list($characterSet, $collation) = $this->resolver
            ->setCharacterSet((string) $characterSet)
            ->setCollation((string) $collation)
            ->resolveCharacterSetAndCollation($connection)
        ;
        $messageCallback(t('Setting character set "%1$s" and collation "%2$s" for connection "%3$s"', $characterSet, $collation, $connectionName));
        $this->convertTables($connection, $characterSet, $collation, $messageCallback, $warnings);
        $messageCallback(t('Saving connection configuration.'));
        $this->persistConfiguration($connectionName, $environment, $characterSet, $collation, $warnings);
        $connection->refreshCharactersetCollation($characterSet, $collation);
    }
public function apply($characterSet, $collation, $connectionName = '', $environment = '', callable $messageCallback = null, ErrorList $warnings = null)
    {
        if ($messageCallback === null) {
            $messageCallback = function ($message) { };
        }
        if ((string) $connectionName === '') {
            $connectionName = $this->databaseManager->getDefaultConnection();
        }
        $connection = $this->databaseManager->connection($connectionName);
        list($characterSet, $collation) = $this->resolver
            ->setCharacterSet((string) $characterSet)
            ->setCollation((string) $collation)
            ->resolveCharacterSetAndCollation($connection)
        ;
        $messageCallback(t('Setting character set "%1$s" and collation "%2$s" for connection "%3$s"', $characterSet, $collation, $connectionName));
        $this->convertTables($connection, $characterSet, $collation, $messageCallback, $warnings);
        $messageCallback(t('Saving connection configuration.'));
        $this->persistConfiguration($connectionName, $environment, $characterSet, $collation, $warnings);
        $connection->refreshCharactersetCollation($characterSet, $collation);
    }
public function apply ( $ characterSet , $ collation , $ connectionName = '' , $ environment = '' , callable $ messageCallback = null , ErrorList $ warnings = null ) { if ( $ messageCallback === null ) { $ messageCallback = function ( $ message ) { } ; } if ( ( string ) $ connectionName === '' ) { $ connectionName = $ this -> databaseManager -> getDefaultConnection ( ) ; } $ connection = $ this -> databaseManager -> connection ( $ connectionName ) ; list ( $ characterSet , $ collation ) = $ this -> resolver -> setCharacterSet ( ( string ) $ characterSet ) -> setCollation ( ( string ) $ collation ) -> resolveCharacterSetAndCollation ( $ connection ) ; $ messageCallback ( t ( 'Setting character set "%1$s" and collation "%2$s" for connection "%3$s"' , $ characterSet , $ collation , $ connectionName ) ) ; $ this -> convertTables ( $ connection , $ characterSet , $ collation , $ messageCallback , $ warnings ) ; $ messageCallback ( t ( 'Saving connection configuration.' ) ) ; $ this -> persistConfiguration ( $ connectionName , $ environment , $ characterSet , $ collation , $ warnings ) ; $ connection -> refreshCharactersetCollation ( $ characterSet , $ collation ) ; }
Apply the character set and collation to a connection.

@param string $characterSet the character set to be applied (if empty, we'll derive it from the collation)
@param string $collation the collation to be applied (if empty, we'll use the character set default one)
@param string $connectionName the name of the connection (if empty, we'll use the default connection)
@param string $environment
@param callable|null $messageCallback a callback function that will receive progress messages
@param \Concrete\Core\Error\ErrorList\ErrorList|null $warnings if specified, conversion errors will be added to this ErrorList

@throws \Exception
Apply the character set and collation to a connection .