Table of contents ▼▲
Bug 17 - Diff comments showing next to wrong revision
Howto Fix: function _diff_diff()
{
$aTemp = array();
$cnt = 0;
$lFile = API::GetPageAttr('FileLoc');
$aXML = API::LoadXMLFile($lFile);
$aWiki = $aXML['wiki:wiki'][0];
if (@array_key_exists('wiki:diff', $aWiki))
{
$aDiff = $aWiki['wiki:diff'];
krsort($aDiff);
foreach ($aDiff as $key => $val)
{
$aTemp[$cnt]['TEXT'] = date("j-M-Y G:i:s", $val['attrib']['time']);
$aTemp[$cnt]['TIME'] = $val['attrib']['time'];
$aTemp[$cnt]['IP'] = $val['attrib']['ip'];
$aTemp[$cnt]['COMMENT'] = trim($val['wiki:comment'][0]['value']);
if ($cnt == 1)
$aTemp[$cnt]['TGTCHK'] = "checked";
$cnt++;
} //foreach ($aDiff as $key => $val)
$aTemp[0]['SRCCHK'] = "checked";
$aTemp[0]['TGTCHK'] = "checked";
$aTemp[0]['TEXT'] = "Current";
$aTemp[0]['TIME'] = 0;
} //if (array_key_exists('wiki:diff', $aWiki))
if ($aTemp)
API::SetTemplateField('DIFF_TEXT', $aTemp);
} //function _diff_diff()
actually, this puts the diffs out of step. compares do not work correctly once applied.. darren
Solution
The solution is simply to change the original _diff_diff function in plugins/action_diff.php as below
$aTemp[$cnt]['COMMENT'] = trim($val['wiki:comment'][0]['value']);
$aTemp[$cnt - 1]['COMMENT'] = trim($val['wiki:comment'][0]['value']);