Always give sane output for Title::getUserCaseDBkey()
authorBrian Wolff <bawolff+wn@gmail.com>
Wed, 11 Dec 2013 23:06:57 +0000 (16:06 -0700)
committerBrian Wolff <bawolff+wn@gmail.com>
Wed, 11 Dec 2013 23:06:57 +0000 (16:06 -0700)
Sometimes (e.g. via Title::makeTitle), the usercase db key is
not set. If that happens we should fallback to the normal db key.

This fixes file redirects on repos where initialCapital is set
to false.

Change-Id: I38bc4ebeb41b06f5c718cf5f64da158e6c1a9f49

includes/Title.php

index a949ac3..924027e 100644 (file)
@@ -769,7 +769,12 @@ class Title {
         * @return String DB key
         */
        function getUserCaseDBKey() {
-               return $this->mUserCaseDBKey;
+               if ( !is_null( $this->mUserCaseDBKey ) ) {
+                       return $this->mUserCaseDBKey;
+               } else {
+                       // If created via makeTitle(), $this->mUserCaseDBKey is not set.
+                       return $this->mDbkeyform;
+               }
        }
 
        /**