From a1fb3b5306354c011bfbc22f9cef75c874a97f56 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 1 Jun 2005 02:31:45 +0000 Subject: [PATCH] * (bug 2275) Update search index more or less right on page move --- RELEASE-NOTES | 1 + docs/hooks.txt | 4 ++-- includes/SearchUpdate.php | 2 +- includes/Title.php | 12 +++++++----- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ab9c2f7f2c..30d06b2659 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -232,6 +232,7 @@ Various bugfixes, small features, and a few experimental things: that does both numeric and named chars: Sanitizer::decodeCharReferences * Removed some obsolete UTF-8 converter functions * Fix function comment in debug dump of SQL statements +* (bug 2275) Update search index more or less right on page move === Caveats === diff --git a/docs/hooks.txt b/docs/hooks.txt index c64425b378..ecf6ca1226 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -303,8 +303,8 @@ $text: text of the mail $old: old title $nt: new title $user: user who did the move -$oldid: old article database ID -$newid: new article database ID +$pageid: database ID of the page that's been moved +$redirid: database ID of the created redirect 'UnknownAction': An unknown "action" has occured (useful for defining your own actions) diff --git a/includes/SearchUpdate.php b/includes/SearchUpdate.php index be7a4c41b6..dc383fe188 100644 --- a/includes/SearchUpdate.php +++ b/includes/SearchUpdate.php @@ -41,7 +41,7 @@ class SearchUpdate { $search =& SearchEngine::create(); $lc = $search->legalSearchChars() . '&#;'; - if( $this->mText == false ) { + if( $this->mText === false ) { $search->updateTitle($this->mId, Title::indexTitle( $this->mNamespace, $this->mTitle )); wfProfileOut( $fname ); diff --git a/includes/Title.php b/includes/Title.php index e2c527e659..0bc30afc3e 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1532,18 +1532,20 @@ class Title { if( is_string( $err ) ) { return $err; } + + $pageid = $this->getArticleID(); if( $nt->exists() ) { $this->moveOverExistingRedirect( $nt, $reason ); } else { # Target didn't exist, do normal move. $this->moveToNewTitle( $nt, $newid, $reason ); } + $redirid = $this->getArticleID(); # Fixing category links (those without piped 'alternate' names) to be sorted under the new title - $dbw =& wfGetDB( DB_MASTER ); $categorylinks = $dbw->tableName( 'categorylinks' ); $sql = "UPDATE $categorylinks SET cl_sortkey=" . $dbw->addQuotes( $nt->getPrefixedText() ) . - " WHERE cl_from=" . $dbw->addQuotes( $this->getArticleID() ) . + " WHERE cl_from=" . $dbw->addQuotes( $pageid ) . " AND cl_sortkey=" . $dbw->addQuotes( $this->getPrefixedText() ); $dbw->query( $sql, 'SpecialMovepage::doSubmit' ); @@ -1559,12 +1561,12 @@ class Title { } # Update search engine - $u = new SearchUpdate( $oldid, $nt->getPrefixedDBkey() ); + $u = new SearchUpdate( $pageid, $nt->getPrefixedDBkey() ); $u->doUpdate(); - $u = new SearchUpdate( $newid, $this->getPrefixedDBkey(), '' ); + $u = new SearchUpdate( $redirid, $this->getPrefixedDBkey(), '' ); $u->doUpdate(); - wfRunHooks( 'TitleMoveComplete', array(&$this, &$nt, &$wgUser, $oldid, $newid) ); + wfRunHooks( 'TitleMoveComplete', array( &$this, &$nt, &$wgUser, $pageid, $redirid ) ); return true; } -- 2.20.1