miscellaneous doxygen warnings
[lhc/web/wiklou.git] / includes / specials / SpecialBooksources.php
index bf7de3f..8e528dc 100644 (file)
@@ -63,7 +63,7 @@ class SpecialBookSources extends SpecialPage {
 
        /**
         * Returns whether a given ISBN (10 or 13) is valid.  True indicates validity.
-        * @param isbn string ISBN passed for check
+        * @param $isbn string ISBN passed for check
         * @return bool
         */
        public static function isValidISBN( $isbn ) {
@@ -144,8 +144,17 @@ class SpecialBookSources extends SpecialPage {
                $title = Title::makeTitleSafe( NS_PROJECT, $page ); # Show list in content language
                if( is_object( $title ) && $title->exists() ) {
                        $rev = Revision::newFromTitle( $title, false, Revision::READ_NORMAL );
-                       $this->getOutput()->addWikiText( str_replace( 'MAGICNUMBER', $this->isbn, $rev->getText() ) );
-                       return true;
+                       $content = $rev->getContent();
+
+                       if ( $content instanceof TextContent ) {
+                               //XXX: in the future, this could be stored as structured data, defining a list of book sources
+
+                               $text = $content->getNativeData();
+                               $this->getOutput()->addWikiText( str_replace( 'MAGICNUMBER', $this->isbn, $text ) );
+                               return true;
+                       } else {
+                               throw new MWException( "Unexpected content type for book sources: " . $content->getModel() );
+                       }
                }
 
                # Fall back to the defaults given in the language file