- $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() );
+ }