Skip to content

Commit 737c7ca

Browse files
committed
v 3.6.67
Fix for collations update for servers with smaller limits on index length Remove event detail state column from finder plugin
1 parent ef844fc commit 737c7ca

File tree

8 files changed

+111
-12
lines changed

8 files changed

+111
-12
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313
/component/media/css/jevcustom.css
1414
/component/site/views/clean/
1515
component/site/views/clean
16+
component/admin/install.php
17+
component/admin/manifest.xml

changelogs/3.6.67.php

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
$version = "3.6.67";
3+
$date = "2023-09-26";
4+
$extension = "package_jevents";
5+
$changelog[$extension][$version] = array();
6+
$changelog[$extension][$version]["date"] = $date;
7+
$changelog[$extension][$version]["features"] = array();
8+
$changelog[$extension][$version]["bugfixes"] = array();
9+
10+
$changelog[$extension][$version]["features"][] = "";
11+
12+
$changelog[$extension][$version]["bugfixes"][] = "Fix for collations update for servers with smaller limits on index length";
13+
$changelog[$extension][$version]["bugfixes"][] = "";
14+
$changelog[$extension][$version]["bugfixes"][] = "";
15+
$changelog[$extension][$version]["bugfixes"][] = "";

component/admin/controllers/cpanel.php

+52-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function __construct($config = array())
4444
function cpanel()
4545
{
4646

47-
$app = Factory::getApplication();
47+
$app = Factory::getApplication();
4848
$db = Factory::getDbo();
4949

5050
// Make sure RSVP Pro and RSVP are not both enabled
@@ -1027,9 +1027,32 @@ public function checkcollations()
10271027
$db->setQuery("SHOW TABLE STATUS LIKE '" . $db->getPrefix() . "jev%'");
10281028
$tables = $db->loadObjectList('Name');
10291029

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+
10301042
$fixtables = false;
10311043
foreach ($tables as $tablename => $table)
10321044
{
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+
*/
10331056
if ($force || $table->Collation != $collation)
10341057
{
10351058
$fixtables = true;
@@ -1044,12 +1067,13 @@ public function checkcollations()
10441067
$fixtables = true;
10451068
break;
10461069
}
1047-
}http://ubu.j41.net/administrator/index.php?option=com_jevents&task=params.edit&component=com_jevents&view=component
1070+
}
10481071
}
10491072
if ($fixtables)
10501073
{
10511074
$app->enqueueMessage(Text::_("COM_JEVENTS_COLLATIONS_NEED_UPDATING" ) , "warning" );
10521075
}
1076+
10531077
}
10541078

10551079
public function fixcollations()
@@ -1076,14 +1100,37 @@ public function fixcollations()
10761100
$db->setQuery("SHOW TABLE STATUS LIKE '" . $db->getPrefix() . "jev%'");
10771101
$tables = $db->loadObjectList('Name');
10781102

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+
10791115
if ($input->getInt("ft", 0))
10801116
{
10811117
foreach ($tables as $tablename => $table)
10821118
{
10831119
if ($force || $table->Collation != $collation)
10841120
{
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+
}
10871134
}
10881135
}
10891136

@@ -1103,6 +1150,7 @@ public function fixcollations()
11031150
}
11041151
$db->setQuery("SHOW FULL COLUMNS FROM $tablename");
11051152
$columndata = $db->loadObjectList('Field');
1153+
11061154
foreach ($columndata as $columnname => $columndata)
11071155
{
11081156
if ($columndata->Collation && ($force || $columndata->Collation != $collation))

component/install.php

+37-4
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class varchar(10) NOT NULL default "",
223223
noendtime tinyint(3) NOT NULL default 0,
224224
225225
PRIMARY KEY (evdet_id),
226-
INDEX (location(240))
226+
INDEX (location(190))
227227
) $charset;
228228
SQL;
229229
$db->setQuery($sql);
@@ -451,7 +451,7 @@ class varchar(10) NOT NULL default "",
451451
name varchar(255) $rowcharset NOT NULL default "",
452452
md5 VARCHAR(255) NOT NULL,
453453
PRIMARY KEY (fid),
454-
INDEX (md5)
454+
INDEX (md5(190))
455455
) $charset;
456456
SQL;
457457
$db->setQuery($sql);
@@ -611,7 +611,7 @@ private function updateTables()
611611
$db->setQuery($sql);
612612
@$db->execute();
613613

614-
$sql = "ALTER TABLE #__jevents_vevdetail ADD INDEX location (location (240))";
614+
$sql = "ALTER TABLE #__jevents_vevdetail ADD INDEX location (location (190))";
615615
$db->setQuery($sql);
616616
@$db->execute();
617617
}
@@ -689,10 +689,24 @@ private function updateTables()
689689

690690
if (!array_key_exists("location", $indexcols))
691691
{
692-
$sql = "ALTER TABLE #__jevents_vevdetail ADD INDEX location (location (240))";
692+
$sql = "ALTER TABLE #__jevents_vevdetail ADD INDEX location (location (190))";
693693
$db->setQuery($sql);
694694
@$db->execute();
695695
}
696+
else
697+
{
698+
$index = $indexcols["location"];
699+
if ( isset($index->Sub_part) && intval($index->Sub_part) > 190)
700+
{
701+
$sql = "alter table #__jevents_vevdetail drop index location";
702+
$db->setQuery( $sql );
703+
@$db->execute();
704+
705+
$sql = "ALTER TABLE #__jevents_vevdetail ADD INDEX location (location (190))";
706+
$db->setQuery( $sql );
707+
@$db->execute();
708+
}
709+
}
696710

697711
if (!array_key_exists("multiday", $indexcols))
698712
{
@@ -731,6 +745,10 @@ private function updateTables()
731745
$db->setQuery($sql);
732746
$cols = @$db->loadObjectList("Field");
733747

748+
$sql = "SHOW INDEX FROM #__jevents_filtermap";
749+
$db->setQuery($sql);
750+
$indexcols = @$db->loadObjectList("Key_name");
751+
734752
if (!array_key_exists("andor", $cols))
735753
{
736754
$sql = "ALTER TABLE #__jevents_filtermap ADD COLUMN andor tinyint(3) NOT NULL default 0";
@@ -752,6 +770,21 @@ private function updateTables()
752770
@$db->execute();
753771
}
754772

773+
if (array_key_exists("md5", $indexcols))
774+
{
775+
$index = $indexcols["md5"];
776+
if ( isset($index->Sub_part) && intval($index->Sub_part) > 190)
777+
{
778+
$sql = "alter table #__jevents_filtermap drop index md5";
779+
$db->setQuery( $sql );
780+
@$db->execute();
781+
782+
$sql = "ALTER TABLE #__jevents_filtermap ADD INDEX md5 (location (190))";
783+
$db->setQuery( $sql );
784+
@$db->execute();
785+
}
786+
}
787+
755788
$sql = "SHOW INDEX FROM #__jevents_repetition";
756789
$db->setQuery($sql);
757790
$cols = @$db->loadObjectList("Key_name");

modules/mod_jevents_cal/tmpl/ext/calendar.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function _displayCalendarMod($time, $startday, $linkString, &$day_name, $monthMu
138138
}
139139
else
140140
{
141-
$scriptlinks['linkprevious'] = "";
141+
$scriptlinks['linkprevious'] = $linkprevious = "";
142142
}
143143

144144
if ($this->minical_actmonth == 1)
@@ -169,7 +169,7 @@ function _displayCalendarMod($time, $startday, $linkString, &$day_name, $monthMu
169169
}
170170
else
171171
{
172-
$scriptlinks['linknext'] = "";
172+
$scriptlinks['linknext'] = $linknext = "";
173173
}
174174

175175
$content = <<<START

package/install.php

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
jimport('joomla.filesystem.file');
2323
jimport('joomla.application.component.helper');
2424

25+
#[\AllowDynamicProperties]
2526
class Pkg_JeventsInstallerScript
2627
{
2728
public function preflight($type, $parent)

package/pkg_jevents.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<extension type="package" version="2.5" method="upgrade">
33
<name>JEV_PACKAGE_TITLE</name>
44
<packagename>jevents</packagename>
5-
<version>3.6.66</version>
5+
<version>3.6.67</version>
66
<url>http://www.jevents.net</url>
77
<creationDate>September 2023</creationDate>
88
<author>GWE Systems Ltd</author>

plugins/finder/jevents/jevents4.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ protected function getListQuery($query = null, $type = 'list')
526526
// Check if we can use the supplied SQL query.
527527
$sql = $db->getQuery(true);
528528
$sql->select('det.evdet_id, det.summary as title, det.description AS summary, det.description AS body');
529-
$sql->select('det.state, det.modified ');
529+
$sql->select('det.modified ');
530530
$sql->select('rpt.rp_id, rpt.eventid ');
531531
$sql->select('evt.catid, evt.icsid, evt.created_by, evt.access ');
532532
$sql->select('c.title AS category, c.published AS cat_state, c.access AS cat_access');

0 commit comments

Comments
 (0)