Index: branches/liquidthreads/extensions/LqtModel.php |
— | — | @@ -129,8 +129,16 @@ |
130 | 130 | static function fromTextRepresentation($r) { |
131 | 131 | return unserialize($r); |
132 | 132 | } |
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 ); |
135 | 143 | $contents = HistoricalThread::textRepresentation($tmt); |
136 | 144 | $dbr =& wfGetDB( DB_MASTER ); |
137 | 145 | $res = $dbr->insert( 'historical_thread', array( |
— | — | @@ -262,7 +270,7 @@ |
263 | 271 | $this->changeUserText = $wgUser->getName(); |
264 | 272 | |
265 | 273 | // TODO open a transaction. |
266 | | - HistoricalThread::create( $this->double ); |
| 274 | + HistoricalThread::create( $this->double, $change_type, $change_object ); |
267 | 275 | |
268 | 276 | $this->bumpRevisionsOnAncestors($change_type, $change_object); |
269 | 277 | |
— | — | @@ -438,6 +446,9 @@ |
439 | 447 | return false; |
440 | 448 | } |
441 | 449 | } |
| 450 | + function replies() { |
| 451 | + return $this->replies; |
| 452 | + } |
442 | 453 | |
443 | 454 | function setSuperthread($thread) { |
444 | 455 | $this->path = $thread->path . '.' . $this->id; |
Index: branches/liquidthreads/extensions/LqtBaseView.php |
— | — | @@ -12,6 +12,15 @@ |
13 | 13 | die( -1 ); |
14 | 14 | } |
15 | 15 | |
| 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 | + |
16 | 25 | require_once('LqtModel.php'); |
17 | 26 | require_once('Pager.php'); |
18 | 27 | require_once('PageHistory.php'); |
— | — | @@ -541,10 +550,16 @@ |
542 | 551 | function showThread( $thread ) { |
543 | 552 | global $wgLang; # TODO global. |
544 | 553 | |
545 | | - $is_changed_thread = $thread->isHistorical() && $thread->changeObject() == $thread->id(); |
| 554 | + $is_changed_thread = $thread->isHistorical() && $thread->changeObject()->id() == $thread->id(); |
546 | 555 | |
547 | 556 | $this->showThreadHeading( $thread ); |
548 | 557 | |
| 558 | + |
| 559 | + |
| 560 | +/* efVarDump($this->output, $thread->isHistorical()); |
| 561 | + efVarDump($this->output, $thread->id()); |
| 562 | + efVarDump($this->output, $thread->changeObject()->id()); |
| 563 | +*/ |
549 | 564 | $this->output->addHTML( "<a name=\"lqt_thread_{$thread->id()}\" ></a>" ); |
550 | 565 | |
551 | 566 | if ($thread->type() == Threads::TYPE_MOVED) { |