From: Brian Wolff Date: Thu, 6 Jan 2011 02:42:51 +0000 (+0000) Subject: (Bug 25254) cl_timestamp gets updated on null edit where it shouldn't. X-Git-Tag: 1.31.0-rc.0~32776 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=99839bf5f0ea8bc7182a8ed1b41773bb9cf09c71;p=lhc%2Fweb%2Fwiklou.git (Bug 25254) cl_timestamp gets updated on null edit where it shouldn't. Caused by two things: *after the new category collation stuff, the if this category has changed code was comparing the user supplied sortkey, with the collation sortable sortkey, which didn't work. (See also CR for r70415) This is new issue in 1.17 *If the sortkey was too long (long enough to get truncated by DB), then the did this sortkey change code also failed since it was comparing the non-truncated sortkey to the truncated sortkey. This issue is present in older (all previous?) versions of mediawiki. This issue especially affects non-latin wikis that use 3-byte characters. This bug primarily is an issue for people using DPL type extension. I wasn't sure if i should add RELEASE-NOTES, since i'm tagging this 1.17 --- diff --git a/includes/LinksUpdate.php b/includes/LinksUpdate.php index f5fa378646..a391185a1e 100644 --- a/includes/LinksUpdate.php +++ b/includes/LinksUpdate.php @@ -67,6 +67,14 @@ class LinksUpdate { $this->mInterlangs[$key] = $title; } + foreach ( $this->mCategories as $cat => &$sortkey ) { + # If the sortkey is longer then 255 bytes, + # it truncated by DB, and then doesn't get + # matched when comparing existing vs current + # categories, causing bug 25254. + $sortkey = substr( $sortkey, 0, 255 ); + } + $this->mRecursive = $recursive; wfRunHooks( 'LinksUpdateConstructed', array( &$this ) ); @@ -687,11 +695,15 @@ class LinksUpdate { * @private */ function getExistingCategories() { - $res = $this->mDb->select( 'categorylinks', array( 'cl_to', 'cl_sortkey' ), + $res = $this->mDb->select( 'categorylinks', array( 'cl_to', 'cl_sortkey_prefix' ), array( 'cl_from' => $this->mId ), __METHOD__, $this->mOptions ); $arr = array(); foreach ( $res as $row ) { - $arr[$row->cl_to] = $row->cl_sortkey; + if ( $row->cl_sortkey_prefix !== '' ) { + $arr[$row->cl_to] = $row->cl_sortkey_prefix; + } else { + $arr[$row->cl_to] = $this->mTitle->getCategorySortkey(); + } } return $arr; } diff --git a/maintenance/archives/patch-categorylinks-better-collation.sql b/maintenance/archives/patch-categorylinks-better-collation.sql index 606317ded0..c1499c151c 100644 --- a/maintenance/archives/patch-categorylinks-better-collation.sql +++ b/maintenance/archives/patch-categorylinks-better-collation.sql @@ -4,6 +4,10 @@ -- Bugs 164, 1211, 23682. This is the second version of this patch; the -- changes are also incorporated into patch-categorylinks-better-collation2.sql, -- for the benefit of trunk users who applied the original. +-- +-- Due to bug 25254, the length limit of 255 bytes for cl_sortkey_prefix +-- is also enforced in php. If you change the length of that field, make +-- sure to also change the check in LinksUpdate.php. ALTER TABLE /*$wgDBprefix*/categorylinks CHANGE COLUMN cl_sortkey cl_sortkey varbinary(230) NOT NULL default '', ADD COLUMN cl_sortkey_prefix varchar(255) binary NOT NULL default '',