Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -77,7 +77,7 @@ class cli
|
||||
|
||||
if ( \IPSUtf8\Session::i()->has_archive )
|
||||
{
|
||||
if ( ! count( \IPSUtf8\Convert\Archive::i()->getNonUtf8Tables ) )
|
||||
if ( ! \count( \IPSUtf8\Convert\Archive::i()->getNonUtf8Tables ) )
|
||||
{
|
||||
\IPSUtf8\Output\Cli::i()->sendOutput( "You have an archive table in a different database, and it is UTF8 and collations are correct." );
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class cli
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! count( \IPSUtf8\Session::i()->tables ) )
|
||||
if ( ! \count( \IPSUtf8\Session::i()->tables ) )
|
||||
{
|
||||
\IPSUtf8\Output\Cli::i()->sendOutput("No tables found for processing. Please check to ensure the correct database name and prefix are being used.");
|
||||
exit();
|
||||
@@ -114,7 +114,7 @@ class cli
|
||||
if ( $convertClass::i()->databaseIsUtf8() )
|
||||
{
|
||||
/* Check collations */
|
||||
if ( ! count( $convertClass::i()->getNonUtf8CollationTables() ) )
|
||||
if ( ! \count( $convertClass::i()->getNonUtf8CollationTables() ) )
|
||||
{
|
||||
/* We're golden! */
|
||||
\IPSUtf8\Output\Cli::i()->sendOutput("The database is set to UTF-8, collations are correct and doesn't need converting.\n<choice>[x] Enter 'x' to exit the conversion (RECOMMENDED).\n[y] Enter 'y' to perform a full conversion anyway</choice>", 100 );
|
||||
@@ -141,29 +141,15 @@ class cli
|
||||
}
|
||||
}
|
||||
|
||||
\IPSUtf8\Output\Cli::i()->sendOutput( "\n" . count( $convertClass::i()->getNonUtf8Tables() ) . " table(s) are not UTF-8 and need converting.\n");
|
||||
\IPSUtf8\Output\Cli::i()->sendOutput( "\n" . \count( $convertClass::i()->getNonUtf8Tables() ) . " table(s) are not UTF-8 and need converting.\n");
|
||||
$origUtf8Charset = \IPSUtf8\Db::i('utf8')->getCharset();
|
||||
$canMb4 = (bool) \IPSUtf8\Db::i('utf8')->set_charset( 'utf8mb4' );
|
||||
\IPSUtf8\Db::i('utf8')->set_charset( $origUtf8Charset );
|
||||
if ( version_compare( \IPSUtf8\Db::i()->server_info, '5.5.3', '>=' ) AND $canMb4 !== FALSE )
|
||||
{
|
||||
\IPSUtf8\Output\Cli::i()->sendOutput("Use 4-byte UTF-8 Encoding (utf8mb4)?\nSome non-common symbols (such as historical scripts, music symbols and Emoji) require more space in the database to be stored. If you choose 'no', users will not be able to use these symbols on your site. If 'yes', these characters will be able to be used, but the database will use more disk space.\n<choice>[y] Enter 'y' for Yes\n[n] Enter 'n' for No\n[x] Enter 'x' to exit</choice>", 100 );
|
||||
|
||||
$sessionData = \IPSUtf8\Session::i()->json;
|
||||
|
||||
if ( \IPSUtf8\Output\Cli::i()->response === 'y' )
|
||||
{
|
||||
$sessionData['use_utf8mb4'] = 1;
|
||||
}
|
||||
else if ( \IPSUtf8\Output\Cli::i()->response === 'n' )
|
||||
{
|
||||
$sessionData['use_utf8mb4'] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
$sessionData['use_utf8mb4'] = 1;
|
||||
|
||||
\IPSUtf8\Session::i()->json = $sessionData;
|
||||
\IPSUtf8\Session::i()->save();
|
||||
}
|
||||
@@ -179,7 +165,7 @@ class cli
|
||||
else
|
||||
{
|
||||
$date = date('D j F Y', \IPSUtf8\Session::i()->updated );
|
||||
$count = count( array_keys( \IPSUtf8\Session::i()->completed_json ) );
|
||||
$count = \count( array_keys( \IPSUtf8\Session::i()->completed_json ) );
|
||||
$pcent = round( ( \IPSUtf8\Session::i()->json['convertedCount'] / $convertClass::i()->getTotalRowsToConvert() * 100 ) );
|
||||
|
||||
$more = "<warning>You have a conversion session unfinished. The session was last updated on " . $date . " and has processed " . $count . " tables (" . $pcent . "%) so far.</warning>";
|
||||
@@ -230,7 +216,7 @@ class cli
|
||||
{
|
||||
$convertClass = static::$convertClass;
|
||||
|
||||
\IPSUtf8\Output\Cli::i()->sendOutput("The database is set to UTF-8 and all tables are UTF-8 but " . count( $convertClass::i()->getNonUtf8CollationTables() ) . " table(s) have incorrect collations and need fixing.\n<choice>[f] Enter 'f' to fix table and field collations (RECOMMENDED)\n[y] Enter 'y' to perform a full conversion\n[x] Enter 'x' to exit the conversion</choice>", 100 );
|
||||
\IPSUtf8\Output\Cli::i()->sendOutput("The database is set to UTF-8 and all tables are UTF-8 but " . \count( $convertClass::i()->getNonUtf8CollationTables() ) . " table(s) have incorrect collations and need fixing.\n<choice>[f] Enter 'f' to fix table and field collations (RECOMMENDED)\n[y] Enter 'y' to perform a full conversion\n[x] Enter 'x' to exit the conversion</choice>", 100 );
|
||||
|
||||
if ( \IPSUtf8\Output\Cli::i()->response === 'x' )
|
||||
{
|
||||
@@ -297,7 +283,7 @@ class cli
|
||||
|
||||
$convertClass::i()->renameTables();
|
||||
|
||||
if ( count( $convertClass::i()->getNonUtf8CollationTables() ) )
|
||||
if ( \count( $convertClass::i()->getNonUtf8CollationTables() ) )
|
||||
{
|
||||
\IPSUtf8\Output\Cli::i()->sendOutput( "Checking and fixing collations." );
|
||||
$convertClass::i()->fixCollation();
|
||||
@@ -407,7 +393,7 @@ class cli
|
||||
|
||||
$toConvert = $convertClass::i()->getNonUtf8Tables();
|
||||
|
||||
if ( ! count( $toConvert ) )
|
||||
if ( ! \count( $toConvert ) )
|
||||
{
|
||||
\IPSUtf8\Output\Cli::i()->sendOutput("Nothing to convert!");
|
||||
exit();
|
||||
|
||||
Reference in new issue
Block a user