Index: trunk/extensions/LiquidThreads/pages/TalkpageView.php |
— | — | @@ -30,18 +30,16 @@ |
31 | 31 | $sk = $wgUser->getSkin(); |
32 | 32 | |
33 | 33 | $article = new Article( $this->title ); |
34 | | - $revision = Revision::newFromId( $article->getLatest() ); |
35 | | - if ( $revision ) $article_text = $revision->getRawText(); |
36 | 34 | |
37 | 35 | $oldid = $this->request->getVal( 'oldid', null ); |
38 | 36 | |
39 | 37 | wfLoadExtensionMessages( 'LiquidThreads' ); |
40 | 38 | // If $article_text == "", the talkpage was probably just created |
41 | 39 | // when the first thread was posted to make the links blue. |
42 | | - if ( $article->exists() && $article_text != "" ) { |
| 40 | + if ( $article->exists() && $article->getContent() ) { |
43 | 41 | $html = ''; |
44 | 42 | |
45 | | - $html .= $this->showPostBody( $article, $oldid ); |
| 43 | + $article->view(); |
46 | 44 | |
47 | 45 | $actionLinks = array(); |
48 | 46 | $actionLinks[] = $sk->link( $this->title, |
Index: trunk/extensions/LiquidThreads/classes/LqtThread.php |
— | — | @@ -339,8 +339,11 @@ |
340 | 340 | // Preload subthreads |
341 | 341 | $thread_ids = array(); |
342 | 342 | $pageIds = array(); |
343 | | - $replies_by_id = array(); |
344 | 343 | |
| 344 | + if (!is_array(self::$replyCacheById)) { |
| 345 | + self::$replyCacheById = array(); |
| 346 | + } |
| 347 | + |
345 | 348 | foreach( $rows as $row ) { |
346 | 349 | $thread_ids[] = $row->thread_id; |
347 | 350 | |
— | — | @@ -363,16 +366,17 @@ |
364 | 367 | if ($row->thread_summary_page) |
365 | 368 | $pageIds[] = $row->thread_summary_page; |
366 | 369 | |
367 | | - if (!isset( $replies_by_id[$row->thread_parent] ) ) { |
368 | | - $replies_by_id[$row->thread_parent] = array(); |
| 370 | + if ( !is_null($row->thread_parent) ) { |
| 371 | + if ( !isset( self::$replyCacheById[$row->thread_parent] ) ) { |
| 372 | + self::$replyCacheById[$row->thread_parent] = array(); |
| 373 | + } |
| 374 | + |
| 375 | + self::$replyCacheById[$row->thread_parent][$row->thread_id] = |
| 376 | + new Thread( $row, null ); |
369 | 377 | } |
370 | | - |
371 | | - $replies_by_id[$row->thread_parent][] = new Thread( $row, null ); |
372 | 378 | } |
373 | 379 | } |
374 | 380 | |
375 | | - self::$replyCacheById = array_merge( self::$replyCacheById, $replies_by_id ); |
376 | | - |
377 | 381 | // Preload page data in one swoop. |
378 | 382 | if ( count($pageIds) ) { |
379 | 383 | $res = $dbr->select( 'page', '*', array( 'page_id' => $pageIds ), __METHOD__ ); |
— | — | @@ -544,6 +548,7 @@ |
545 | 549 | return false; |
546 | 550 | } |
547 | 551 | } |
| 552 | + |
548 | 553 | function replies() { |
549 | 554 | if ( !is_null($this->replies) ) { |
550 | 555 | return $this->replies; |
— | — | @@ -551,8 +556,7 @@ |
552 | 557 | |
553 | 558 | // Check cache |
554 | 559 | if ( isset( self::$replyCacheById[$this->id()] ) ) { |
555 | | - $this->replies = self::$replyCacheById[$this->id()]; |
556 | | - return $this->replies; |
| 560 | + return self::$replyCacheById[$this->id()]; |
557 | 561 | } |
558 | 562 | |
559 | 563 | $this->replies = array(); |