(Bug 25254) cl_timestamp gets updated on null edit where it shouldn't.
authorBrian Wolff <bawolff@users.mediawiki.org>
Thu, 6 Jan 2011 02:42:51 +0000 (02:42 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Thu, 6 Jan 2011 02:42:51 +0000 (02:42 +0000)
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

includes/LinksUpdate.php
maintenance/archives/patch-categorylinks-better-collation.sql

index f5fa378..a391185 100644 (file)
@@ -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;
        }
index 606317d..c1499c1 100644 (file)
@@ -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 '',