Index: branches/liquidthreads/extensions/LqtModel.php |
— | — | @@ -268,15 +268,17 @@ |
269 | 269 | $this->articleId = $new_articleId; |
270 | 270 | $this->articleNamespace = $new_articleNamespace; |
271 | 271 | $this->articleTitle = $new_articleTitle; |
| 272 | + $this->revisionNumber += 1; |
272 | 273 | $this->commitRevision(); |
273 | 274 | |
274 | 275 | if($leave_trace) { |
275 | | - // $this->leaveTrace(); |
| 276 | + $this->leaveTrace(); |
276 | 277 | } |
277 | 278 | } |
278 | 279 | |
279 | 280 | function leaveTrace() { |
280 | 281 | /* Adapted from Title::moveToNewTitle. But now the new title exists on the old talkpage. */ |
| 282 | + $dbw =& wfGetDB( DB_MASTER ); |
281 | 283 | |
282 | 284 | $mwRedir = MagicWord::get( 'redirect' ); |
283 | 285 | $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $this->title()->getPrefixedText() . "]]\n"; |
— | — | @@ -285,30 +287,32 @@ |
286 | 288 | $newid = $redirectArticle->insertOn( $dbw ); |
287 | 289 | $redirectRevision = new Revision( array( |
288 | 290 | 'page' => $newid, |
289 | | - 'comment' => $comment, |
| 291 | + 'comment' => "page moved from here", |
290 | 292 | 'text' => $redirectText ) ); |
291 | 293 | $redirectRevision->insertOn( $dbw ); |
292 | 294 | $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 ); |
293 | | - $linkCache->clearLink( $this->getPrefixedDBkey() ); |
294 | 295 | |
295 | 296 | # Log the move |
296 | 297 | $log = new LogPage( 'move' ); |
297 | | - $log->addEntry( 'move', $this, $reason, array( 1 => $nt->getPrefixedText()) ); |
| 298 | + $log->addEntry( 'move', $this->double->title(), "page moved from here", array( 1 => $this->title()->getPrefixedText()) ); |
298 | 299 | |
299 | 300 | # Purge caches as per article creation |
300 | | - Article::onArticleCreate( $nt ); |
| 301 | + Article::onArticleCreate( $redirectArticle->getTitle() ); |
301 | 302 | |
302 | 303 | # Record the just-created redirect's linking to the page |
303 | 304 | $dbw->insert( 'pagelinks', |
304 | 305 | array( |
305 | 306 | 'pl_from' => $newid, |
306 | | - 'pl_namespace' => $nt->getNamespace(), |
307 | | - 'pl_title' => $nt->getDBkey() ), |
308 | | - $fname ); |
| 307 | + 'pl_namespace' => $redirectArticle->getTitle()->getNamespace(), |
| 308 | + 'pl_title' => $redirectArticle->getTitle()->getDBkey() ), |
| 309 | + __METHOD__ ); |
309 | 310 | |
| 311 | + $thread = Threads::newThread( $redirectArticle, $this->double->article(), null, |
| 312 | + Threads::TYPE_MOVED, $log); |
| 313 | + |
310 | 314 | # Purge old title from squid |
311 | 315 | # The new title, and links to the new title, are purged in Article::onArticleCreate() |
312 | | - $this->purgeSquid(); |
| 316 | +# $this-->purgeSquid(); |
313 | 317 | } |
314 | 318 | |
315 | 319 | |
— | — | @@ -501,9 +505,14 @@ |
502 | 506 | /** Module of factory methods. */ |
503 | 507 | class Threads { |
504 | 508 | |
| 509 | + const TYPE_NORMAL = 0; |
| 510 | + const TYPE_MOVED = 1; |
| 511 | + |
505 | 512 | static $loadedThreads = array(); |
506 | 513 | |
507 | | - static function newThread( $root, $article, $superthread = null ) { |
| 514 | + static function newThread( $root, $article, $superthread = null, |
| 515 | + $type = self::TYPE_NORMAL, $log = null ) { |
| 516 | + /* TODO log is ignored. */ |
508 | 517 | $dbr =& wfGetDB( DB_MASTER ); |
509 | 518 | |
510 | 519 | if( $article->exists() ) { |
— | — | @@ -515,7 +524,8 @@ |
516 | 525 | |
517 | 526 | $res = $dbr->insert('thread', |
518 | 527 | array('thread_root' => $root->getID(), |
519 | | - 'thread_timestamp' => wfTimestampNow()) + $aclause, |
| 528 | + 'thread_timestamp' => wfTimestampNow(), |
| 529 | + 'thread_type' => $type) + $aclause, |
520 | 530 | __METHOD__); |
521 | 531 | |
522 | 532 | $newid = $dbr->insertId(); |