r25382 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25381‎ | r25382 | r25383 >
Date:23:12, 31 August 2007
Author:david
Status:old
Tags:
Comment:
marginally better handling of non-existant threads
Modified paths:
  • /branches/liquidthreads/extensions/LqtPages.php (modified) (history)

Diff [purge]

Index: branches/liquidthreads/extensions/LqtPages.php
@@ -362,9 +362,6 @@
363363 unset($content_actions['edit']);
364364 unset($content_actions['viewsource']);
365365 unset($content_actions['talk']);
366 -/* unset($content_actions['history']);
367 - unset($content_actions['watch']);
368 - unset($content_actions['move']);*/
369366 if( array_key_exists( 'move', $content_actions ) && $this->thread ) {
370367 $content_actions['move']['href'] =
371368 SpecialPage::getPage('Movethread')->getTitle()->getFullURL() . '/' .
@@ -374,9 +371,7 @@
375372 $content_actions['delete']['href'] =
376373 SpecialPage::getPage('Deletethread')->getTitle()->getFullURL() . '/' .
377374 $this->thread->title()->getPrefixedURL();
378 - }
379 -
380 -
 375+ }
381376 return true;
382377 }
383378
@@ -392,6 +387,10 @@
393388 $this->output->addHTML("There is no such revision of this thread.");
394389 }
395390
 391+ function showMissingThreadPage() {
 392+ $this->output->addHTML("There is no such thread.");
 393+ }
 394+
396395 function __construct(&$output, &$article, &$title, &$user, &$request) {
397396
398397 parent::__construct($output, $article, $title, $user, $request);
@@ -403,10 +402,12 @@
404403
405404 }
406405 $this->thread = $t;
 406+ if( ! $t ) {
 407+ return; // error reporting is handled in show(). this kinda sucks.
 408+ }
407409
408 - // TODO this is a holdover from the special page; not sure what's correct here.
409 - // we now have a real true $this->article that makes some sense.
410 - // but we still want to know about $t->article.
 410+ // $this->article gets saved to thread_article, so we want it to point to the
 411+ // subject page associated with the talkpage, always, not the permalink url.
411412 $this->article = $t->article(); # for creating reply threads.
412413
413414 }
@@ -414,6 +415,11 @@
415416 function show() {
416417 global $wgHooks;
417418 $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
 419+
 420+ if( ! $this->thread ) {
 421+ $this->showMissingThreadPage();
 422+ return false;
 423+ }
418424
419425 // Make a link back to the talk page, including the correct archive month.
420426 // TODO this is obsolete.
@@ -647,18 +653,12 @@
648654 function show() {
649655 global $wgHooks;
650656 $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
651 -
652 -/* var_dump($this->article);
653 - $t = Threads::withRoot( $this->article );
654 - $this->thread = $t;
655 -*/
656 - // TODO this is a holdover from the special page; not sure what's correct here.
657 - // we now have a real true $this->article that makes some sense.
658 - // but we still want to know about $t->article.
659 - // $this->article gets saved to thread_article, so we want it to point to the
660 - // subject page associated with the talkpage, always, not the permalink url.
661 -// $this->article = $t->article(); # for creating reply threads.
662657
 658+ if( ! $this->thread ) {
 659+ $this->showMissingThreadPage();
 660+ return false;
 661+ }
 662+
663663 $this->output->setSubtitle("Viewing a history listing.");
664664
665665 $this->showThreadHeading($this->thread);
@@ -704,6 +704,10 @@
705705 }
706706
707707 function show() {
 708+ if( ! $this->thread ) {
 709+ $this->showMissingThreadPage();
 710+ return false;
 711+ }
708712 $this->showHistoryInfo();
709713 parent::show();
710714 return false;

Status & tagging log