Index: branches/liquidthreads/extensions/LqtModel.php |
— | — | @@ -466,26 +466,16 @@ |
467 | 467 | $this->changeUser = $line->thread_change_user; |
468 | 468 | $this->changeUserText = $line->thread_change_user_text; |
469 | 469 | |
| 470 | + $root_title = Title::makeTitle( $line->page_namespace, $line->page_title ); |
| 471 | + $this->root = new Post($root_title); |
| 472 | + $this->root->loadPageData($line); |
| 473 | + $this->rootRevision = $this->root->mLatest; |
470 | 474 | } |
471 | 475 | |
472 | 476 | function initWithReplies( $children ) { |
473 | 477 | |
474 | 478 | $this->replies = $children; |
475 | 479 | |
476 | | - /* |
477 | | - Root revision is ignored on live threads but will be important when |
478 | | - when we save a historical thread, since by that time an edit will |
479 | | - have already taken place and it will be more difficult to find |
480 | | - the pre-edit revision number. But I hate this. |
481 | | - |
482 | | - (we could do Revision::getPrevious() we just need to know whether or not |
483 | | - there was a new revision saved at save time. make it run then make it right.) |
484 | | - |
485 | | - TODO this is expensive and should be ripped out. |
486 | | - */ |
487 | | - $rev = Revision::newFromTitle( $this->root()->getTitle() ); |
488 | | - $this->rootRevision = $rev->getId(); |
489 | | - |
490 | 480 | $this->double = clone $this; |
491 | 481 | } |
492 | 482 | |
— | — | @@ -839,6 +829,7 @@ |
840 | 830 | $dbr = wfGetDB( DB_SLAVE ); |
841 | 831 | if ( is_array($where) ) $where = $dbr->makeList( $where, LIST_AND ); |
842 | 832 | if ( is_array($options) ) $options = implode(',', $options); |
| 833 | + |
843 | 834 | if( is_array($extra_tables) && count($extra_tables) != 0 ) { |
844 | 835 | $tables = implode(',', $extra_tables) . ', '; |
845 | 836 | } else if ( is_string( $extra_tables ) ) { |
— | — | @@ -857,11 +848,13 @@ |
858 | 849 | $root_test = str_replace( 'thread.', 'children.', $where ); // TODO fragile? |
859 | 850 | |
860 | 851 | $sql = <<< SQL |
861 | | -SELECT children.*, ($root_test) as is_root FROM $tables thread, thread children |
862 | | -WHERE $where AND |
863 | | -children.thread_path LIKE CONCAT(thread.thread_path, "%") |
| 852 | +SELECT children.*, child_page.*, ($root_test) as is_root FROM $tables thread, thread children, page child_page |
| 853 | +WHERE $where |
| 854 | +AND children.thread_path LIKE CONCAT(thread.thread_path, "%") |
| 855 | +AND child_page.page_id = children.thread_root |
864 | 856 | $options |
865 | 857 | SQL; |
| 858 | + echo($sql); |
866 | 859 | $res = $dbr->query($sql); |
867 | 860 | |
868 | 861 | $threads = array(); |
Index: branches/liquidthreads/extensions/LqtBaseView.php |
— | — | @@ -171,9 +171,9 @@ |
172 | 172 | $g->extendQuery('archived', 'recently-archived', |
173 | 173 | array('( thread.thread_timestamp >=' . $recentstartdate->text() . |
174 | 174 | ' OR rev_timestamp >= ' . $recentstartdate->text() . ')', |
175 | | - 'page_id = thread.thread_summary_page', 'page_latest = rev_id'), |
| 175 | + 'summary_page.page_id = thread.thread_summary_page', 'summary_page.page_latest = rev_id'), |
176 | 176 | array(), |
177 | | - array('page', 'revision')); |
| 177 | + array('page summary_page', 'revision')); |
178 | 178 | return $g; |
179 | 179 | } |
180 | 180 | |