Fix hook documentation for PageRenderingHash
[lhc/web/wiklou.git] / includes / WikiMap.php
index a01f1b6..027ff72 100644 (file)
@@ -148,20 +148,6 @@ class WikiReference {
                $this->mServer = $server === null ? $canonicalServer : $server;
        }
 
-       /**
-        * @return string
-        * @throws MWException
-        */
-       public function getHostname() {
-               $prefixes = array( 'http://', 'https://' );
-               foreach ( $prefixes as $prefix ) {
-                       if ( substr( $this->mCanonicalServer, 0, strlen( $prefix ) ) ) {
-                               return substr( $this->mCanonicalServer, strlen( $prefix ) );
-                       }
-               }
-               throw new MWException( "Invalid hostname for wiki {$this->mMinor}.{$this->mMajor}" );
-       }
-
        /**
         * Get the URL in a way to be displayed to the user
         * More or less Wikimedia specific
@@ -169,13 +155,12 @@ class WikiReference {
         * @return string
         */
        public function getDisplayName() {
-               $url = $this->getUrl( '' );
-               $parsed = wfParseUrl( $url );
+               $parsed = wfParseUrl( $this->mCanonicalServer );
                if ( $parsed ) {
                        return $parsed['host'];
                } else {
-                       // Invalid URL. There's no sane thing to do here, so just return it
-                       return $url;
+                       // Invalid server spec. There's no sane thing to do here, so just return the canonical server name in full
+                       return $this->mCanonicalServer;
                }
        }