From e96aea87488d567876d1c95f4bf2707bd8572f31 Mon Sep 17 00:00:00 2001 From: Achim Ennenbach Date: Thu, 21 Jun 2018 21:23:42 +0200 Subject: [PATCH 1/4] In case the 2 or more join aliases point to the same table, now the first alias get's saved instead of the last one. --- e107_handlers/admin_ui.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index 2ab8383ca..116c4a267 100755 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -3934,7 +3934,7 @@ class e_admin_controller_ui extends e_admin_controller $keys = array(); foreach($matches[1] AS $k=>$v) { - if(varset($matches[3][$k])) + if(varset($matches[3][$k]) && !array_key_exists($v, $this->joinAlias)) { $this->joinAlias[$v] = $matches[3][$k]; // array. eg $this->joinAlias['core_media'] = 'm'; } From 94cb46986239b53d807959283df9d4729261b3ae Mon Sep 17 00:00:00 2001 From: Achim Ennenbach Date: Thu, 21 Jun 2018 21:27:32 +0200 Subject: [PATCH 2/4] Removed the orphaned debug message concerning "legacy forum menu prefs detected. Upgrading ..." as it actually doesn't detect or upgrade anything. --- e107_plugins/forum/forum_class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php index 14ee26b94..5821bf35d 100644 --- a/e107_plugins/forum/forum_class.php +++ b/e107_plugins/forum/forum_class.php @@ -2430,7 +2430,8 @@ class e107forum public function upgradeLegacyPrefs() { - e107::getMessage()->addDebug("Legacy Forum Menu Pref Detected. Upgrading.."); + // Commented out as it is irritating to get this message and nothing is done or has to be done. + //e107::getMessage()->addDebug("Legacy Forum Menu Pref Detected. Upgrading.."); $legacyMenuPrefs = array( 'newforumposts_caption' => 'caption', From 32b844dad37102136462551ed3f9d69c65d62b8a Mon Sep 17 00:00:00 2001 From: Nick Liu Date: Thu, 21 Jun 2018 23:33:46 -0500 Subject: [PATCH 3/4] Grammar correction near previous commit Also cleaned up comments made in previous commit --- e107_plugins/forum/forum_class.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php index 5821bf35d..6bc73b2bc 100644 --- a/e107_plugins/forum/forum_class.php +++ b/e107_plugins/forum/forum_class.php @@ -2430,9 +2430,6 @@ class e107forum public function upgradeLegacyPrefs() { - // Commented out as it is irritating to get this message and nothing is done or has to be done. - //e107::getMessage()->addDebug("Legacy Forum Menu Pref Detected. Upgrading.."); - $legacyMenuPrefs = array( 'newforumposts_caption' => 'caption', 'newforumposts_display' => 'display', @@ -2446,11 +2443,11 @@ class e107forum { if(e107::getMenu()->setParms('forum','newforumposts_menu', $newPrefs) !== false) { - e107::getMessage()->addDebug("Sucessfully Migrated newforumposts prefs from core to menu table. "); + e107::getMessage()->addDebug("Successfully migrated newforumposts prefs from core to menu table."); } else { - e107::getMessage()->addDebug("Legacy Forum Menu Pref Detected. Upgrading.."); + e107::getMessage()->addDebug("Legacy Forum menu pref detected. Upgrading..."); } } From b471626fdb8d95252b33ffe8b4037c75eb7012ca Mon Sep 17 00:00:00 2001 From: Nick Liu Date: Fri, 22 Jun 2018 14:00:13 -0500 Subject: [PATCH 4/4] Fixed missing tree nodes for some tree structures There were two cases that led to missing tree nodes: * If one node at the same depth as another node had a higher primary key ID but showed up in the rows before, the lower primary key ID node will go missing. * If an unmatching row for the current node in moveRowsToTreeNodes appeared between a matching row, the matching row would never be reached and would not be added to the tree. --- e107_handlers/model_class.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php index e7157ac6d..346f325ac 100755 --- a/e107_handlers/model_class.php +++ b/e107_handlers/model_class.php @@ -3456,10 +3456,7 @@ class e_tree_model extends e_front_model $rowParentID = (int) $row[$sort_parent]; // Note: This optimization only works if the SQL query executed was ordered by the sort parent. - if($nodeID !== $rowParentID) - { - break; - } + if($rowParentID > $nodeID) break; $node['_children'][] = &$row; unset($rows[$key]); @@ -3620,7 +3617,7 @@ class e_tree_model extends e_front_model return ""; }, $db_query) // Optimization goes with e_tree_model::moveRowsToTreeNodes() - . " ORDER BY " . $this->getParam('sort_parent'); + . " ORDER BY " . $this->getParam('sort_parent') . "," . $this->getParam('primary_field'); $this->setParam('db_query', $db_query); }