We are trying to troubleshoot an issue with our forums that causes a 500 error when trying to merge two topics in the same channel. I have traced the execution path of the web request that causes the error: /ajax/api/node/mergeTopics
forums/core/vb/api/node.php
LINE 730: public function mergeTopics
LINE 552 public function moveNodes
Forums/core/vb/library/node.php
LINE 4600: function moveNodes
LINE 5055: function moveNodesInternal
=== goes back to moveNodes LINE 4807
LINE 90: function clearChildCache
LINE 3583: function fetchClosureChildren
=== ERRORS HERE - line 3615 - query returns 13 million+ rows
Inside fetchClosureChildren
PHP Code:
//Search for what's left
//Note that even if we were passed a parentid we still get the complete ancestry and cache it.
$closureRecs = vB::getDbAssertor()->assertQuery('vBForum:closure', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT,
'parent' => $notfound), array('field' => array('parent', 'depth'),
'direction' => array(vB_dB_Query::SORT_ASC, vB_dB_Query::SORT_DESC)));
The $notfound array includes the node IDs of the two topics being merged, as well as the Channel ID itself. Because the channel ID is included here, that query returns almost 13 millions rows from the closure table. The result is being assign to $closureRecs, so it's likely blowing out the PHP memory limit and causing the error.
Is there a bug here? Is it necessary to include the Channel ID itself along with the two IDs of the topics being merged? Removing the channel ID results in 71 rows being returned instead of 13 million.
-Thanks
Devami...