From: Brion Vibber Date: Fri, 11 Jan 2008 20:52:54 +0000 (+0000) Subject: * (bug 12584) Don't reset cl_timestamp when auto-updating sort key on move X-Git-Tag: 1.31.0-rc.0~50057 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=51d607c83ad3209e3508307b25227b50507888b0;p=lhc%2Fweb%2Fwiklou.git * (bug 12584) Don't reset cl_timestamp when auto-updating sort key on move Also cleaned up comment and ugly manual query --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 69b8fe3ba9..5e1e32f47a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -296,6 +296,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 12553) Fixed invalid XHTML in edit conflict screen * (bug 12505) Fixed section=0 with action=raw * Do not log user rights change that didn't change anything +* (bug 12584) Don't reset cl_timestamp when auto-updating sort key on move + == Parser changes in 1.12 == diff --git a/includes/Title.php b/includes/Title.php index 84143cceb7..da7ccea41d 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2350,13 +2350,26 @@ class Title { } $redirid = $this->getArticleID(); - # Fixing category links (those without piped 'alternate' names) to be sorted under the new title + // Category memberships include a sort key which may be customized. + // If it's left as the default (the page title), we need to update + // the sort key to match the new title. + // + // Be careful to avoid resetting cl_timestamp, which may disturb + // time-based lists on some sites. + // + // Warning -- if the sort key is *explicitly* set to the old title, + // we can't actually distinguish it from a default here, and it'll + // be set to the new title even though it really shouldn't. + // It'll get corrected on the next edit, but resetting cl_timestamp. $dbw = wfGetDB( DB_MASTER ); - $categorylinks = $dbw->tableName( 'categorylinks' ); - $sql = "UPDATE $categorylinks SET cl_sortkey=" . $dbw->addQuotes( $nt->getPrefixedText() ) . - " WHERE cl_from=" . $dbw->addQuotes( $pageid ) . - " AND cl_sortkey=" . $dbw->addQuotes( $this->getPrefixedText() ); - $dbw->query( $sql, 'SpecialMovepage::doSubmit' ); + $dbw->update( 'categorylinks', + array( + 'cl_sortkey' => $nt->getPrefixedText(), + 'cl_timestamp=cl_timestamp' ), + array( + 'cl_from' => $pageid, + 'cl_sortkey' => $this->getPrefixedText() ), + __METHOD__ ); # Update watchlists