X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialBooksources.php;h=8e528dc3f6e7d46fb6632e7d778a713391bb3a8d;hb=9362bb6c56691822a687dea0a17975dcdeb0b407;hp=87ba0cb1a6868c905731c695d51756dea905fed1;hpb=6915f4a0ac2238fec3f3d381c8b0bdfef61f0d62;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialBooksources.php b/includes/specials/SpecialBooksources.php index 87ba0cb1a6..8e528dc3f6 100644 --- a/includes/specials/SpecialBooksources.php +++ b/includes/specials/SpecialBooksources.php @@ -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 ) { @@ -143,9 +143,18 @@ class SpecialBookSources extends SpecialPage { $page = $this->msg( 'booksources' )->inContentLanguage()->text(); $title = Title::makeTitleSafe( NS_PROJECT, $page ); # Show list in content language if( is_object( $title ) && $title->exists() ) { - $rev = Revision::newFromTitle( $title, false, Revision::AVOID_MASTER ); - $this->getOutput()->addWikiText( str_replace( 'MAGICNUMBER', $this->isbn, $rev->getText() ) ); - return true; + $rev = Revision::newFromTitle( $title, false, Revision::READ_NORMAL ); + $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