* (bug 2275) Update search index more or less right on page move
This commit is contained in:
parent
0207abde02
commit
a1fb3b5306
4 changed files with 11 additions and 8 deletions
|
|
@ -232,6 +232,7 @@ Various bugfixes, small features, and a few experimental things:
|
||||||
that does both numeric and named chars: Sanitizer::decodeCharReferences
|
that does both numeric and named chars: Sanitizer::decodeCharReferences
|
||||||
* Removed some obsolete UTF-8 converter functions
|
* Removed some obsolete UTF-8 converter functions
|
||||||
* Fix function comment in debug dump of SQL statements
|
* Fix function comment in debug dump of SQL statements
|
||||||
|
* (bug 2275) Update search index more or less right on page move
|
||||||
|
|
||||||
|
|
||||||
=== Caveats ===
|
=== Caveats ===
|
||||||
|
|
|
||||||
|
|
@ -303,8 +303,8 @@ $text: text of the mail
|
||||||
$old: old title
|
$old: old title
|
||||||
$nt: new title
|
$nt: new title
|
||||||
$user: user who did the move
|
$user: user who did the move
|
||||||
$oldid: old article database ID
|
$pageid: database ID of the page that's been moved
|
||||||
$newid: new article database ID
|
$redirid: database ID of the created redirect
|
||||||
|
|
||||||
'UnknownAction': An unknown "action" has occured (useful for defining
|
'UnknownAction': An unknown "action" has occured (useful for defining
|
||||||
your own actions)
|
your own actions)
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class SearchUpdate {
|
||||||
$search =& SearchEngine::create();
|
$search =& SearchEngine::create();
|
||||||
$lc = $search->legalSearchChars() . '&#;';
|
$lc = $search->legalSearchChars() . '&#;';
|
||||||
|
|
||||||
if( $this->mText == false ) {
|
if( $this->mText === false ) {
|
||||||
$search->updateTitle($this->mId,
|
$search->updateTitle($this->mId,
|
||||||
Title::indexTitle( $this->mNamespace, $this->mTitle ));
|
Title::indexTitle( $this->mNamespace, $this->mTitle ));
|
||||||
wfProfileOut( $fname );
|
wfProfileOut( $fname );
|
||||||
|
|
|
||||||
|
|
@ -1532,18 +1532,20 @@ class Title {
|
||||||
if( is_string( $err ) ) {
|
if( is_string( $err ) ) {
|
||||||
return $err;
|
return $err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$pageid = $this->getArticleID();
|
||||||
if( $nt->exists() ) {
|
if( $nt->exists() ) {
|
||||||
$this->moveOverExistingRedirect( $nt, $reason );
|
$this->moveOverExistingRedirect( $nt, $reason );
|
||||||
} else { # Target didn't exist, do normal move.
|
} else { # Target didn't exist, do normal move.
|
||||||
$this->moveToNewTitle( $nt, $newid, $reason );
|
$this->moveToNewTitle( $nt, $newid, $reason );
|
||||||
}
|
}
|
||||||
|
$redirid = $this->getArticleID();
|
||||||
|
|
||||||
# Fixing category links (those without piped 'alternate' names) to be sorted under the new title
|
# Fixing category links (those without piped 'alternate' names) to be sorted under the new title
|
||||||
|
|
||||||
$dbw =& wfGetDB( DB_MASTER );
|
$dbw =& wfGetDB( DB_MASTER );
|
||||||
$categorylinks = $dbw->tableName( 'categorylinks' );
|
$categorylinks = $dbw->tableName( 'categorylinks' );
|
||||||
$sql = "UPDATE $categorylinks SET cl_sortkey=" . $dbw->addQuotes( $nt->getPrefixedText() ) .
|
$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() );
|
" AND cl_sortkey=" . $dbw->addQuotes( $this->getPrefixedText() );
|
||||||
$dbw->query( $sql, 'SpecialMovepage::doSubmit' );
|
$dbw->query( $sql, 'SpecialMovepage::doSubmit' );
|
||||||
|
|
||||||
|
|
@ -1559,12 +1561,12 @@ class Title {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Update search engine
|
# Update search engine
|
||||||
$u = new SearchUpdate( $oldid, $nt->getPrefixedDBkey() );
|
$u = new SearchUpdate( $pageid, $nt->getPrefixedDBkey() );
|
||||||
$u->doUpdate();
|
$u->doUpdate();
|
||||||
$u = new SearchUpdate( $newid, $this->getPrefixedDBkey(), '' );
|
$u = new SearchUpdate( $redirid, $this->getPrefixedDBkey(), '' );
|
||||||
$u->doUpdate();
|
$u->doUpdate();
|
||||||
|
|
||||||
wfRunHooks( 'TitleMoveComplete', array(&$this, &$nt, &$wgUser, $oldid, $newid) );
|
wfRunHooks( 'TitleMoveComplete', array( &$this, &$nt, &$wgUser, $pageid, $redirid ) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue