r57220 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57219‎ | r57220 | r57221 >
Date:14:23, 1 October 2009
Author:werdna
Status:deferred
Tags:
Comment:
Merge r57219
Modified paths:
  • /branches/wmf-deployment/extensions/LiquidThreads (modified) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/classes/DeletionController.php (modified) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/classes/Thread.php (modified) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/classes/View.php (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/extensions/LiquidThreads/classes/View.php
@@ -561,12 +561,10 @@
562562 'enabled' => true, 'icon' => 'reply.png', 'showlabel' => 1,
563563 'tooltip' => wfMsg( 'lqt_reply' ) );
564564
565 - if ($thread->title()) {
566 - $commands['link'] = array( 'label' => wfMsgExt( 'lqt_permalink', 'parseinline' ),
567 - 'href' => $thread->title()->getFullURL(),
568 - 'enabled' => true, 'icon' => 'link.png',
569 - 'tooltip' => wfMsgExt( 'lqt_permalink', 'parseinline' ) );
570 - }
 565+ $commands['link'] = array( 'label' => wfMsgExt( 'lqt_permalink', 'parseinline' ),
 566+ 'href' => $thread->title()->getFullURL(),
 567+ 'enabled' => true, 'icon' => 'link.png',
 568+ 'tooltip' => wfMsgExt( 'lqt_permalink', 'parseinline' ) );
571569
572570 if ( $thread->root()->getTitle()->quickUserCan( 'edit' ) ) {
573571 $commands['edit'] = array( 'label' => wfMsgExt( 'edit', 'parseinline' ),
Index: branches/wmf-deployment/extensions/LiquidThreads/classes/DeletionController.php
@@ -26,9 +26,7 @@
2727 wfLoadExtensionMessages( 'LiquidThreads' );
2828 if ( $thread->replies() && $thread->isTopmostThread() ) {
2929 $reason = wfMsg('lqt-delete-parent-deleted', $reason );
30 - foreach( $thread->replies() as $reply ) {
31 - $reply->root()->doDeleteArticle( $reason, false, $reply->root()->getId() );
32 - }
 30+ self::recursivelyDeleteReplies( $thread, $reason );
3331 global $wgOut;
3432 $wgOut->addWikiMsg( 'lqt-delete-replies-done' );
3533 } elseif ( $thread->replies() ) {
@@ -41,6 +39,14 @@
4240 return true;
4341 }
4442
 43+ static function recursivelyDeleteReplies( $thread, $reason ) {
 44+ foreach( $thread->replies() as $reply ) {
 45+ $reply->root()->doDeleteArticle( $reason, false, $reply->root()->getId() );
 46+ $reply->delete( $reason );
 47+ self::recursivelyDeleteReplies( $reply, $reason );
 48+ }
 49+ }
 50+
4551 static function onArticleRevisionUndeleted( &$title, $revision, $page_id ) {
4652 if ( $title->getNamespace() == NS_LQT_THREAD ) {
4753 self::$pageids_to_revive[$page_id] = $title;
Index: branches/wmf-deployment/extensions/LiquidThreads/classes/Thread.php
@@ -149,7 +149,7 @@
150150
151151 $this->modified = wfTimestampNow();
152152 $this->updateEditedness( $change_type );
153 - $this->save();
 153+ $this->save( __METHOD__ . "/" . wfGetCaller());
154154
155155 $topmost = $this->topmostThread();
156156 $topmost->modified = wfTimestampNow();
@@ -181,15 +181,21 @@
182182 }
183183
184184 /** Unless you know what you're doing, you want commitRevision */
185 - function save() {
 185+ function save( $fname = null ) {
186186 $this->dieIfHistorical();
187187
188188 $dbr = wfGetDB( DB_MASTER );
189189
 190+ if ( !$fname ) {
 191+ $fname = __METHOD__ . "/" . wfGetCaller();
 192+ } else {
 193+ $fname = __METHOD__ . "/" . $fname;
 194+ }
 195+
190196 $res = $dbr->update( 'thread',
191197 /* SET */ $this->getRow(),
192198 /* WHERE */ array( 'thread_id' => $this->id, ),
193 - __METHOD__ );
 199+ $fname );
194200
195201 // Touch the root
196202 if ($this->root()) {
@@ -262,7 +268,7 @@
263269 }
264270 }
265271
266 - function undelete( $reason ) {
 272+ function undelete( $reason ) {
267273 $this->type = Threads::TYPE_NORMAL;
268274 $this->commitRevision( Threads::CHANGE_UNDELETED, $this, $reason );
269275
@@ -432,7 +438,9 @@
433439 // pre-initialise the reply cache, and stash the row object for later use.
434440 if ( count($thread_ids) ) {
435441 $dbr = wfGetDB( DB_SLAVE );
436 - $res = $dbr->select( 'thread', '*', array( 'thread_ancestor' => $thread_ids ),
 442+ $res = $dbr->select( 'thread', '*',
 443+ array( 'thread_ancestor' => $thread_ids,
 444+ 'thread_type != ' . $dbr->addQuotes( Threads::TYPE_DELETED ) ),
437445 __METHOD__ );
438446
439447 while( $row = $dbr->fetchObject($res) ) {
@@ -749,7 +757,9 @@
750758 $dbr = wfGetDB( DB_SLAVE );
751759
752760 $res = $dbr->select( 'thread', '*',
753 - array( 'thread_parent' => $this->id() ), __METHOD__ );
 761+ array( 'thread_parent' => $this->id(),
 762+ 'thread_type != '.$dbr->addQuotes( Threads::TYPE_DELETED ) ),
 763+ __METHOD__ );
754764
755765 $rows = array();
756766 while ( $row = $dbr->fetchObject($res) ) {
Property changes on: branches/wmf-deployment/extensions/LiquidThreads
___________________________________________________________________
Name: svn:mergeinfo
757767 - /branches/REL1_15/phase3/extensions/LiquidThreads:51646
/trunk/extensions/LiquidThreads:56151-57116,57130-57134,57169,57193,57195,57198,57200-57206,57215
/trunk/phase3/extensions/LiquidThreads:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350
758768 + /branches/REL1_15/phase3/extensions/LiquidThreads:51646
/trunk/extensions/LiquidThreads:56151-57116,57130-57134,57169,57193,57195,57198,57200-57206,57215,57219
/trunk/phase3/extensions/LiquidThreads:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r57219LiquidThreads deletion fixes:...werdna14:22, 1 October 2009

Status & tagging log