Index: trunk/extensions/LiquidThreads/LiquidThreads.php |
— | — | @@ -87,3 +87,10 @@ |
88 | 88 | |
89 | 89 | /* Number of days a thread needs to be inactive to be considered for summarizing and archival */ |
90 | 90 | $wgLqtThreadArchiveInactiveDays = 5; |
| 91 | + |
| 92 | +/* Allows activation of LiquidThreads on individual pages */ |
| 93 | +$wgLqtPages = array(); |
| 94 | + |
| 95 | +/* Allows switching LiquidThreads off for regular talk pages |
| 96 | + (intended for testing and transition) */ |
| 97 | +$wgLqtTalkPages = true; |
Index: trunk/extensions/LiquidThreads/classes/LqtThreads.php |
— | — | @@ -115,7 +115,7 @@ |
116 | 116 | * will show up blue instead of red. For use upon new thread creation. |
117 | 117 | */ |
118 | 118 | protected static function createTalkpageIfNeeded( $subjectPage ) { |
119 | | - $talkpage_t = $subjectPage->getTitle()->getTalkpage(); |
| 119 | + $talkpage_t = $subjectPage->getTitle(); |
120 | 120 | $talkpage = new Article( $talkpage_t ); |
121 | 121 | if ( ! $talkpage->exists() ) { |
122 | 122 | try { |
Index: trunk/extensions/LiquidThreads/classes/LqtDispatch.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | static function talkpageMain( &$output, &$talk_article, &$title, &$user, &$request ) { |
20 | 20 | // We are given a talkpage article and title. Find the associated |
21 | 21 | // non-talk article and pass that to the view. |
22 | | - $article = new Article( $title->getSubjectPage() ); |
| 22 | + $article = new Article( $title ); |
23 | 23 | |
24 | 24 | if ( $title->getSubjectPage()->getNamespace() == NS_LQT_THREAD ) { |
25 | 25 | // Threads don't have talk pages; redirect to the thread page. |
— | — | @@ -89,7 +89,12 @@ |
90 | 90 | * as needed and return True. If it's a normal, non-liquid page, return false. |
91 | 91 | */ |
92 | 92 | static function tryPage( $output, $article, $title, $user, $request ) { |
93 | | - if ( $title->isTalkPage() ) { |
| 93 | + global $wgLqtPages, $wgLqtTalkPages; |
| 94 | + |
| 95 | + $isTalkPage = ($title->isTalkPage() && $wgLqtTalkPages) || |
| 96 | + in_array( $title->getPrefixedText(), $wgLqtPages ); |
| 97 | + |
| 98 | + if ( $isTalkPage ) { |
94 | 99 | return self::talkpageMain ( $output, $article, $title, $user, $request ); |
95 | 100 | } else if ( $title->getNamespace() == NS_LQT_THREAD ) { |
96 | 101 | return self::threadPermalinkMain( $output, $article, $title, $user, $request ); |
— | — | @@ -121,7 +126,7 @@ |
122 | 127 | return true; |
123 | 128 | |
124 | 129 | // Talkpages without headers -- check existance of threads. |
125 | | - $article = new Article( $nt->getSubjectPage() ); |
| 130 | + $article = new Article( $nt ); |
126 | 131 | $threads = Threads::where( Threads::articleClause( $article ), "LIMIT 1" ); |
127 | 132 | if ( count( $threads ) == 0 ) { |
128 | 133 | // We want it to look like a broken link, but not have action=edit, since that |
— | — | @@ -152,7 +157,7 @@ |
153 | 158 | // It's a talkpage without a header. Get rid of action=edit always, |
154 | 159 | // color as apropriate. |
155 | 160 | $query = ""; |
156 | | - $article = new Article( $title->getSubjectPage() ); |
| 161 | + $article = new Article( $title ); |
157 | 162 | $threads = Threads::where( Threads::articleClause( $article ), "LIMIT 1" ); |
158 | 163 | if ( count( $threads ) != 0 ) { |
159 | 164 | $i = array_search( 'new', $classes ); if ( $i !== false ) { |
— | — | @@ -210,7 +215,7 @@ |
211 | 216 | array(), array(), array( 'known' ) ); |
212 | 217 | |
213 | 218 | $talkpage_link = $changeslist->skin->link( |
214 | | - $thread->article()->getTitle()->getTalkPage(), |
| 219 | + $thread->article()->getTitle(), |
215 | 220 | null, |
216 | 221 | array(), array(), array( 'known' ) ); |
217 | 222 | |
Index: trunk/extensions/LiquidThreads/classes/LqtThread.php |
— | — | @@ -339,14 +339,15 @@ |
340 | 340 | // if we always use Threads::withId instead of returning $this, |
341 | 341 | // the historical revision is not incremented and we get a |
342 | 342 | // duplicate key. |
343 | | - if ( $this->ancestorId == $this->id ) |
| 343 | + if ( $this->isTopmostThread() ) { |
344 | 344 | return $this; |
345 | | - else |
| 345 | + } else { |
346 | 346 | return Threads::withId( $this->ancestorId ); |
| 347 | + } |
347 | 348 | } |
348 | 349 | |
349 | 350 | function isTopmostThread() { |
350 | | - return $this->ancestorId == $this->id; |
| 351 | + return $this->ancestorId == $this->id || intval($this->ancestorId) === 0; |
351 | 352 | } |
352 | 353 | |
353 | 354 | function setArticle( $a ) { |
— | — | @@ -563,7 +564,7 @@ |
564 | 565 | if ( $this->hasSuperthread() ) { |
565 | 566 | $parent_restrictions = $this->superthread()->root()->getTitle()->getRestrictions( $action ); |
566 | 567 | } else { |
567 | | - $parent_restrictions = $this->article()->getTitle()->getTalkPage()->getRestrictions( $action ); |
| 568 | + $parent_restrictions = $this->article()->getTitle()->getRestrictions( $action ); |
568 | 569 | } |
569 | 570 | |
570 | 571 | // TODO this may not be the same as asking "are the parent restrictions more restrictive than |
Index: trunk/extensions/LiquidThreads/pages/SpecialDeleteThread.php |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | |
27 | 27 | $form_action = $this->title->getLocalURL() . '/' . $this->thread->title()->getPrefixedURL(); |
28 | 28 | $thread_name = $this->thread->title()->getPrefixedText(); |
29 | | - $article_name = $this->thread->article()->getTitle()->getTalkPage()->getPrefixedText(); |
| 29 | + $article_name = $this->thread->article()->getTitle()->getPrefixedText(); |
30 | 30 | |
31 | 31 | $deleting = $this->thread->type() != Threads::TYPE_DELETED; |
32 | 32 | |
— | — | @@ -92,7 +92,7 @@ |
93 | 93 | function showSuccessMessage( $is_deleted_already ) { |
94 | 94 | wfLoadExtensionMessages( 'LiquidThreads' ); |
95 | 95 | // TODO talkpageUrl should accept threads, and look up their talk pages. |
96 | | - $talkpage_url = LqtView::talkpageUrl( $this->thread->article()->getTitle()->getTalkpage() ); |
| 96 | + $talkpage_url = LqtView::talkpageUrl( $this->thread->article()->getTitle() ); |
97 | 97 | $message = $is_deleted_already ? wfMsg( 'lqt_delete_undeleted' ) : wfMsg( 'lqt_delete_deleted' ); |
98 | 98 | $message .= wfMsg( 'word-separator' ); |
99 | 99 | $message .= wfMsg( 'lqt_delete_return', '<a href="' . $talkpage_url . '">' . wfMsg( 'lqt_delete_return_link' ) . '</a>' ); |
Index: trunk/extensions/LiquidThreads/pages/SpecialMoveThread.php |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | wfLoadExtensionMessages( 'LiquidThreads' ); |
24 | 24 | $form_action = $this->getTitle()->getLocalURL() . '/' . $this->thread->title()->getPrefixedURL(); |
25 | 25 | $thread_name = $this->thread->title()->getPrefixedText(); |
26 | | - $article_name = $this->thread->article()->getTitle()->getTalkPage()->getPrefixedText(); |
| 26 | + $article_name = $this->thread->article()->getTitle()->getPrefixedText(); |
27 | 27 | $edit_url = LqtView::permalinkUrl( $this->thread, 'edit', $this->thread ); |
28 | 28 | $wfMsg = 'wfMsg'; // functions can only be called within string expansion by variable name. |
29 | 29 | // FIXME: awkward message usage and fixed parameter formatting. Would be nicer if all formatting |
— | — | @@ -84,14 +84,14 @@ |
85 | 85 | $this->redisplayForm( array( 'lqt_move_thread_target_title' ), wfMsg( 'lqt_move_nodestination' ) ); |
86 | 86 | return; |
87 | 87 | } |
88 | | - $newtitle = Title::newFromText( $tmp )->getSubjectPage(); |
| 88 | + $newtitle = Title::newFromText( $tmp ); |
89 | 89 | |
90 | 90 | $reason = $this->request->getVal( 'lqt_move_thread_reason', wfMsg( 'lqt_noreason' ) ); |
91 | 91 | |
92 | 92 | // TODO no status code from this method. |
93 | 93 | $this->thread->moveToSubjectPage( $newtitle, $reason, true ); |
94 | 94 | |
95 | | - $this->showSuccessMessage( $newtitle->getTalkPage() ); |
| 95 | + $this->showSuccessMessage( $newtitle ); |
96 | 96 | } |
97 | 97 | |
98 | 98 | function showSuccessMessage( $target_title ) { |
Index: trunk/extensions/LiquidThreads/pages/TalkpageView.php |
— | — | @@ -181,7 +181,7 @@ |
182 | 182 | // Why is a hook added here? |
183 | 183 | $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
184 | 184 | |
185 | | - $this->output->setPageTitle( $this->title->getTalkpage()->getPrefixedText() ); |
| 185 | + $this->output->setPageTitle( $this->title->getPrefixedText() ); |
186 | 186 | self::addJSandCSS(); |
187 | 187 | $article = new Article( $this->title ); // Added in r29715 sorting. Why? |
188 | 188 | |
Index: trunk/extensions/LiquidThreads/pages/TalkpageArchiveView.php |
— | — | @@ -200,7 +200,7 @@ |
201 | 201 | global $wgHooks; |
202 | 202 | $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
203 | 203 | |
204 | | - $this->output->setPageTitle( $this->title->getTalkpage()->getPrefixedText() ); |
| 204 | + $this->output->setPageTitle( $this->title->getPrefixedText() ); |
205 | 205 | self::addJSandCSS(); |
206 | 206 | wfLoadExtensionMessages( 'LiquidThreads' ); |
207 | 207 | |
Index: trunk/extensions/LiquidThreads/pages/ThreadPermalinkView.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | // the access key for the talk tab doesn't work. |
14 | 14 | if ($this->thread) { |
15 | 15 | $article_t = $this->thread->article()->getTitle(); |
16 | | - $talk_t = $this->thread->article()->getTitle()->getTalkPage(); |
| 16 | + $talk_t = $this->thread->article()->getTitle(); |
17 | 17 | } |
18 | 18 | efInsertIntoAssoc( 'article', array( |
19 | 19 | 'text' => wfMsg( $article_t->getNamespaceKey() ), |
— | — | @@ -74,7 +74,7 @@ |
75 | 75 | $query = ''; |
76 | 76 | else |
77 | 77 | $query = 'lqt_archive_month=' . substr( $this->thread->modified(), 0, 6 ); |
78 | | - $talkpage = $this->thread->article()->getTitle()->getTalkpage(); |
| 78 | + $talkpage = $this->thread->article()->getTitle(); |
79 | 79 | $talkpage_link = $this->user->getSkin()->makeKnownLinkObj( $talkpage, '', $query ); |
80 | 80 | if ( $this->thread->hasSuperthread() ) { |
81 | 81 | return wfMsg( 'lqt_fragment', "<a href=\"{$this->permalinkUrl($this->thread->topmostThread())}\">" . wfMsg( 'lqt_discussion_link' ) . "</a>", $talkpage_link ); |