Merge "Add tests for WikiMap and WikiReference"
[lhc/web/wiklou.git] / includes / Title.php
index 1ab88a6..b347edb 100644 (file)
@@ -1939,7 +1939,6 @@ class Title {
         *   - quick  : does cheap permission checks from slaves (usable for GUI creation)
         *   - full   : does cheap and expensive checks possibly from a slave
         *   - secure : does cheap and expensive checks, using the master as needed
-        * @param bool $short Set this to true to stop after the first permission error.
         * @param array $ignoreErrors Array of Strings Set this to a list of message keys
         *   whose corresponding errors may be ignored.
         * @return array Array of arguments to wfMessage to explain permissions problems.
@@ -4547,15 +4546,17 @@ class Title {
        public function isValidRedirectTarget() {
                global $wgInvalidRedirectTargets;
 
-               // invalid redirect targets are stored in a global array, but explicitly disallow Userlogout here
-               if ( $this->isSpecial( 'Userlogout' ) ) {
-                       return false;
-               }
-
-               foreach ( $wgInvalidRedirectTargets as $target ) {
-                       if ( $this->isSpecial( $target ) ) {
+               if ( $this->isSpecialPage() ) {
+                       // invalid redirect targets are stored in a global array, but explicitly disallow Userlogout here
+                       if ( $this->isSpecial( 'Userlogout' ) ) {
                                return false;
                        }
+
+                       foreach ( $wgInvalidRedirectTargets as $target ) {
+                               if ( $this->isSpecial( $target ) ) {
+                                       return false;
+                               }
+                       }
                }
 
                return true;
@@ -4759,4 +4760,26 @@ class Title {
                Hooks::run( 'TitleGetEditNotices', array( $this, $oldid, &$notices ) );
                return $notices;
        }
+
+       /**
+        * @return array
+        */
+       public function __sleep() {
+               return array(
+                       'mNamespace',
+                       'mDbkeyform',
+                       'mFragment',
+                       'mInterwiki',
+                       'mLocalInterwiki',
+                       'mUserCaseDBKey',
+                       'mDefaultNamespace',
+               );
+       }
+
+       public function __wakeup() {
+               $this->mArticleID = ( $this->mNamespace >= 0 ) ? -1 : 0;
+               $this->mUrlform = wfUrlencode( $this->mDbkeyform );
+               $this->mTextform = strtr( $this->mDbkeyform, '_', ' ' );
+       }
+
 }