src/db/Migration.php
public function checkCollation ($encoding = 'utf8', $exception = true)
		{
			$variables = [
				'character_set_client',
				'character_set_connection',
				'character_set_database',
				'character_set_results',
				'character_set_server',
				'character_set_system',
				'collation_connection',
				'collation_database',
				'collation_server'
			];
			foreach ($variables as $variable)
			{
				$sql = "show variables like '" . $variable . "'";
				$value = $this->db->createCommand($sql)->queryOne();
				$pos = StringHelper::pos($value[ 'Value' ], $encoding);
				if ($pos !== 0)
				{
					if (!$exception)
						return false;
					else
						throw new InvalidConfigException ("Parameter $variable does not match $encoding.");
				}
			}

			return true;
		}
public function checkCollation ($encoding = 'utf8', $exception = true)
		{
			$variables = [
				'character_set_client',
				'character_set_connection',
				'character_set_database',
				'character_set_results',
				'character_set_server',
				'character_set_system',
				'collation_connection',
				'collation_database',
				'collation_server'
			];
			foreach ($variables as $variable)
			{
				$sql = "show variables like '" . $variable . "'";
				$value = $this->db->createCommand($sql)->queryOne();
				$pos = StringHelper::pos($value[ 'Value' ], $encoding);
				if ($pos !== 0)
				{
					if (!$exception)
						return false;
					else
						throw new InvalidConfigException ("Parameter $variable does not match $encoding.");
				}
			}

			return true;
		}
public function checkCollation ( $ encoding = 'utf8' , $ exception = true ) { $ variables = [ 'character_set_client' , 'character_set_connection' , 'character_set_database' , 'character_set_results' , 'character_set_server' , 'character_set_system' , 'collation_connection' , 'collation_database' , 'collation_server' ] ; foreach ( $ variables as $ variable ) { $ sql = "show variables like '" . $ variable . "'" ; $ value = $ this -> db -> createCommand ( $ sql ) -> queryOne ( ) ; $ pos = StringHelper :: pos ( $ value [ 'Value' ] , $ encoding ) ; if ( $ pos !== 0 ) { if ( ! $ exception ) return false ; else throw new InvalidConfigException ( "Parameter $variable does not match $encoding." ) ; } } return true ; }
Server encoding checking

@param string $encoding
@param bool   $exception

@return bool
@throws InvalidConfigException
Server encoding checking