add tests for {{#special:}}
[lhc/web/wiklou.git] / includes / SpecialBooksources.php
index 47e70dc..960f622 100644 (file)
@@ -53,13 +53,15 @@ class BookSourceList {
                # First, see if we have a custom list setup in
                # [[Wikipedia:Book sources]] or equivalent.
                $bstitle = Title::makeTitleSafe( NS_PROJECT, wfMsg( "booksources" ) );
-               $bsarticle = new Article( $bstitle );
-               if( $bsarticle->exists() ) {
-                       $bstext = $bsarticle->getContent( false );
-                       if( $bstext ) {
-                               $bstext = str_replace( "MAGICNUMBER", $this->mIsbn, $bstext );
-                               $wgOut->addWikiText( $bstext );
-                               return;
+               if( $bstitle ) {
+                       $revision = Revision::newFromTitle( $bstitle );
+                       if( $revision ) {
+                               $bstext = $revision->getText();
+                               if( $bstext ) {
+                                       $bstext = str_replace( "MAGICNUMBER", $this->mIsbn, $bstext );
+                                       $wgOut->addWikiText( $bstext );
+                                       return;
+                               }
                        }
                }