@@ -44,7 +44,7 @@ function __construct($config = array())
44
44
function cpanel ()
45
45
{
46
46
47
- $ app = Factory::getApplication ();
47
+ $ app = Factory::getApplication ();
48
48
$ db = Factory::getDbo ();
49
49
50
50
// Make sure RSVP Pro and RSVP are not both enabled
@@ -1027,9 +1027,32 @@ public function checkcollations()
1027
1027
$ db ->setQuery ("SHOW TABLE STATUS LIKE ' " . $ db ->getPrefix () . "jev%' " );
1028
1028
$ tables = $ db ->loadObjectList ('Name ' );
1029
1029
1030
+ foreach ($ tables as $ tablename => $ table )
1031
+ {
1032
+ if (
1033
+ strpos ($ tablename , $ db ->getPrefix () . "jev_customfields " ) === 0
1034
+ || strpos ($ tablename , $ db ->getPrefix () . "jev_tags " ) === 0
1035
+ || strpos ($ tablename , $ db ->getPrefix () . "jevents_filtermap " ) === 0
1036
+ )
1037
+ {
1038
+ unset($ tables [$ tablename ]);
1039
+ }
1040
+ }
1041
+
1030
1042
$ fixtables = false ;
1031
1043
foreach ($ tables as $ tablename => $ table )
1032
1044
{
1045
+ /*
1046
+ $db->setQuery("SHOW INDEX FROM $tablename");
1047
+ $indexdata = $db->loadObjectList();
1048
+ foreach ($indexdata as $index)
1049
+ {
1050
+ if (isset($index->Sub_part) && intval($index->Sub_part) > 200)
1051
+ {
1052
+ $app->enqueueMessage("The index for column '" . $index->Column_name . "' on table '$tablename' May be too long - please report this to the developers" , "warning" );
1053
+ }
1054
+ }
1055
+ */
1033
1056
if ($ force || $ table ->Collation != $ collation )
1034
1057
{
1035
1058
$ fixtables = true ;
@@ -1044,12 +1067,13 @@ public function checkcollations()
1044
1067
$ fixtables = true ;
1045
1068
break ;
1046
1069
}
1047
- }http: //ubu.j41.net/administrator/index.php?option=com_jevents&task=params.edit&component=com_jevents&view=component
1070
+ }
1048
1071
}
1049
1072
if ($ fixtables )
1050
1073
{
1051
1074
$ app ->enqueueMessage (Text::_ ("COM_JEVENTS_COLLATIONS_NEED_UPDATING " ) , "warning " );
1052
1075
}
1076
+
1053
1077
}
1054
1078
1055
1079
public function fixcollations ()
@@ -1076,14 +1100,37 @@ public function fixcollations()
1076
1100
$ db ->setQuery ("SHOW TABLE STATUS LIKE ' " . $ db ->getPrefix () . "jev%' " );
1077
1101
$ tables = $ db ->loadObjectList ('Name ' );
1078
1102
1103
+ foreach ($ tables as $ tablename => $ table )
1104
+ {
1105
+ if (
1106
+ strpos ($ tablename , $ db ->getPrefix () . "jev_customfields " ) === 0
1107
+ || strpos ($ tablename , $ db ->getPrefix () . "jev_tags " ) === 0
1108
+ || strpos ($ tablename , $ db ->getPrefix () . "jevents_filtermap " ) === 0
1109
+ )
1110
+ {
1111
+ unset($ tables [$ tablename ]);
1112
+ }
1113
+ }
1114
+
1079
1115
if ($ input ->getInt ("ft " , 0 ))
1080
1116
{
1081
1117
foreach ($ tables as $ tablename => $ table )
1082
1118
{
1083
1119
if ($ force || $ table ->Collation != $ collation )
1084
1120
{
1085
- $ db ->setQuery ("ALTER TABLE $ tablename convert to character set utf8mb4 collate $ collation " );
1086
- $ db ->execute ();
1121
+
1122
+ $ db ->setQuery ("SHOW FULL COLUMNS FROM $ tablename " );
1123
+ $ columndata = $ db ->loadObjectList ('Field ' );
1124
+
1125
+ $ db ->setQuery ("ALTER TABLE $ tablename convert to character set utf8mb4 collate $ collation " );
1126
+ try
1127
+ {
1128
+ $ db ->execute ();
1129
+ }
1130
+ catch (Throwable $ e )
1131
+ {
1132
+ $ app ->enqueueMessage ($ tablename . " could not be converted : " . $ e ->getMessage () , "error " );
1133
+ }
1087
1134
}
1088
1135
}
1089
1136
@@ -1103,6 +1150,7 @@ public function fixcollations()
1103
1150
}
1104
1151
$ db ->setQuery ("SHOW FULL COLUMNS FROM $ tablename " );
1105
1152
$ columndata = $ db ->loadObjectList ('Field ' );
1153
+
1106
1154
foreach ($ columndata as $ columnname => $ columndata )
1107
1155
{
1108
1156
if ($ columndata ->Collation && ($ force || $ columndata ->Collation != $ collation ))
0 commit comments