Index: trunk/extensions/LiquidThreads/classes/View.php |
— | — | @@ -561,12 +561,10 @@ |
562 | 562 | 'enabled' => true, 'icon' => 'reply.png', 'showlabel' => 1, |
563 | 563 | 'tooltip' => wfMsg( 'lqt_reply' ) ); |
564 | 564 | |
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' ) ); |
571 | 569 | |
572 | 570 | if ( $thread->root()->getTitle()->quickUserCan( 'edit' ) ) { |
573 | 571 | $commands['edit'] = array( 'label' => wfMsgExt( 'edit', 'parseinline' ), |
Index: trunk/extensions/LiquidThreads/classes/DeletionController.php |
— | — | @@ -26,9 +26,7 @@ |
27 | 27 | wfLoadExtensionMessages( 'LiquidThreads' ); |
28 | 28 | if ( $thread->replies() && $thread->isTopmostThread() ) { |
29 | 29 | $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 ); |
33 | 31 | global $wgOut; |
34 | 32 | $wgOut->addWikiMsg( 'lqt-delete-replies-done' ); |
35 | 33 | } elseif ( $thread->replies() ) { |
— | — | @@ -41,6 +39,14 @@ |
42 | 40 | return true; |
43 | 41 | } |
44 | 42 | |
| 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 | + |
45 | 51 | static function onArticleRevisionUndeleted( &$title, $revision, $page_id ) { |
46 | 52 | if ( $title->getNamespace() == NS_LQT_THREAD ) { |
47 | 53 | self::$pageids_to_revive[$page_id] = $title; |
Index: trunk/extensions/LiquidThreads/classes/Thread.php |
— | — | @@ -149,7 +149,7 @@ |
150 | 150 | |
151 | 151 | $this->modified = wfTimestampNow(); |
152 | 152 | $this->updateEditedness( $change_type ); |
153 | | - $this->save(); |
| 153 | + $this->save( __METHOD__ . "/" . wfGetCaller()); |
154 | 154 | |
155 | 155 | $topmost = $this->topmostThread(); |
156 | 156 | $topmost->modified = wfTimestampNow(); |
— | — | @@ -181,15 +181,21 @@ |
182 | 182 | } |
183 | 183 | |
184 | 184 | /** Unless you know what you're doing, you want commitRevision */ |
185 | | - function save() { |
| 185 | + function save( $fname = null ) { |
186 | 186 | $this->dieIfHistorical(); |
187 | 187 | |
188 | 188 | $dbr = wfGetDB( DB_MASTER ); |
189 | 189 | |
| 190 | + if ( !$fname ) { |
| 191 | + $fname = __METHOD__ . "/" . wfGetCaller(); |
| 192 | + } else { |
| 193 | + $fname = __METHOD__ . "/" . $fname; |
| 194 | + } |
| 195 | + |
190 | 196 | $res = $dbr->update( 'thread', |
191 | 197 | /* SET */ $this->getRow(), |
192 | 198 | /* WHERE */ array( 'thread_id' => $this->id, ), |
193 | | - __METHOD__ ); |
| 199 | + $fname ); |
194 | 200 | |
195 | 201 | // Touch the root |
196 | 202 | if ($this->root()) { |
— | — | @@ -262,7 +268,7 @@ |
263 | 269 | } |
264 | 270 | } |
265 | 271 | |
266 | | - function undelete( $reason ) { |
| 272 | + function undelete( $reason ) { |
267 | 273 | $this->type = Threads::TYPE_NORMAL; |
268 | 274 | $this->commitRevision( Threads::CHANGE_UNDELETED, $this, $reason ); |
269 | 275 | |
— | — | @@ -432,7 +438,9 @@ |
433 | 439 | // pre-initialise the reply cache, and stash the row object for later use. |
434 | 440 | if ( count($thread_ids) ) { |
435 | 441 | $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 ) ), |
437 | 445 | __METHOD__ ); |
438 | 446 | |
439 | 447 | while( $row = $dbr->fetchObject($res) ) { |
— | — | @@ -749,7 +757,9 @@ |
750 | 758 | $dbr = wfGetDB( DB_SLAVE ); |
751 | 759 | |
752 | 760 | $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__ ); |
754 | 764 | |
755 | 765 | $rows = array(); |
756 | 766 | while ( $row = $dbr->fetchObject($res) ) { |