r25214 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25213‎ | r25214 | r25215 >
Date:22:10, 27 August 2007
Author:david
Status:old
Tags:
Comment:
fixed history wrong-object-highlighted bug -- with ludicrously bad hack
Modified paths:
  • /branches/liquidthreads/extensions/LqtBaseView.php (modified) (history)
  • /branches/liquidthreads/extensions/LqtModel.php (modified) (history)

Diff [purge]

Index: branches/liquidthreads/extensions/LqtModel.php
@@ -129,8 +129,16 @@
130130 static function fromTextRepresentation($r) {
131131 return unserialize($r);
132132 }
133 - static function create( $t ) {
134 - $tmt = $t->topmostThread();
 133+ private static function setChangeOnDescendents($thread, $change_type, $change_object) {
 134+ $thread->setChangeType($change_type);
 135+ $thread->setChangeObject($change_object);
 136+ foreach($thread->replies() as $r)
 137+ self::setChangeOnDescendents($r, $change_type, $change_object);
 138+ return $thread;
 139+ }
 140+ static function create( $t, $change_type, $change_object ) {
 141+ $tmt_tmp = $t->topmostThread();
 142+ $tmt = self::setChangeOnDescendents( $tmt_tmp, $change_type, $change_object );
135143 $contents = HistoricalThread::textRepresentation($tmt);
136144 $dbr =& wfGetDB( DB_MASTER );
137145 $res = $dbr->insert( 'historical_thread', array(
@@ -262,7 +270,7 @@
263271 $this->changeUserText = $wgUser->getName();
264272
265273 // TODO open a transaction.
266 - HistoricalThread::create( $this->double );
 274+ HistoricalThread::create( $this->double, $change_type, $change_object );
267275
268276 $this->bumpRevisionsOnAncestors($change_type, $change_object);
269277
@@ -438,6 +446,9 @@
439447 return false;
440448 }
441449 }
 450+ function replies() {
 451+ return $this->replies;
 452+ }
442453
443454 function setSuperthread($thread) {
444455 $this->path = $thread->path . '.' . $this->id;
Index: branches/liquidthreads/extensions/LqtBaseView.php
@@ -12,6 +12,15 @@
1313 die( -1 );
1414 }
1515
 16+function efVarDump($output, $value) {
 17+ ob_start();
 18+ var_dump($value);
 19+ $tmp=ob_get_contents();
 20+ ob_end_clean();
 21+ $output->addHTML('<pre>' . htmlspecialchars($tmp,ENT_QUOTES) . '</pre>');
 22+}
 23+
 24+
1625 require_once('LqtModel.php');
1726 require_once('Pager.php');
1827 require_once('PageHistory.php');
@@ -541,10 +550,16 @@
542551 function showThread( $thread ) {
543552 global $wgLang; # TODO global.
544553
545 - $is_changed_thread = $thread->isHistorical() && $thread->changeObject() == $thread->id();
 554+ $is_changed_thread = $thread->isHistorical() && $thread->changeObject()->id() == $thread->id();
546555
547556 $this->showThreadHeading( $thread );
548557
 558+
 559+
 560+/* efVarDump($this->output, $thread->isHistorical());
 561+ efVarDump($this->output, $thread->id());
 562+ efVarDump($this->output, $thread->changeObject()->id());
 563+*/
549564 $this->output->addHTML( "<a name=\"lqt_thread_{$thread->id()}\" ></a>" );
550565
551566 if ($thread->type() == Threads::TYPE_MOVED) {

Status & tagging log