Merge "Do not suppress php notices in SpecialPageFatalTest"
[lhc/web/wiklou.git] / includes / skins / SkinTemplate.php
index 564220c..a9c0993 100644 (file)
@@ -171,6 +171,9 @@ class SkinTemplate extends Skin {
                return $languageLinks;
        }
 
+       /**
+        * @return QuickTemplate
+        */
        protected function setupTemplateForOutput() {
                $request = $this->getRequest();
                $user = $this->getUser();
@@ -385,16 +388,23 @@ class SkinTemplate extends Skin {
                $tpl->set( 'lastmod', false );
                $tpl->set( 'credits', false );
                $tpl->set( 'numberofwatchingusers', false );
-               if ( $out->isArticle() && $title->exists() ) {
-                       if ( $this->isRevisionCurrent() ) {
-                               if ( $wgMaxCredits != 0 ) {
-                                       $tpl->set( 'credits', Action::factory( 'credits', $this->getWikiPage(),
-                                               $this->getContext() )->getCredits( $wgMaxCredits, $wgShowCreditsIfMax ) );
-                               } else {
-                                       $tpl->set( 'lastmod', $this->lastModified() );
+               if ( $title->exists() ) {
+                       if ( $out->isArticle() ) {
+                               if ( $this->isRevisionCurrent() ) {
+                                       if ( $wgMaxCredits != 0 ) {
+                                               /** @var CreditsAction $action */
+                                               $action = Action::factory(
+                                                       'credits', $this->getWikiPage(), $this->getContext() );
+                                               $tpl->set( 'credits',
+                                                       $action->getCredits( $wgMaxCredits, $wgShowCreditsIfMax ) );
+                                       } else {
+                                               $tpl->set( 'lastmod', $this->lastModified() );
+                                       }
                                }
                        }
-                       $tpl->set( 'copyright', $this->getCopyright() );
+                       if ( $out->showsCopyright() ) {
+                               $tpl->set( 'copyright', $this->getCopyright() );
+                       }
                }
 
                $tpl->set( 'copyrightico', $this->getCopyrightIcon() );
@@ -522,7 +532,9 @@ class SkinTemplate extends Skin {
                $html = '';
 
                if ( $personalTools === null ) {
-                       $personalTools = $tpl->getPersonalTools();
+                       $personalTools = ( $tpl instanceof BaseTemplate )
+                               ? $tpl->getPersonalTools()
+                               : [];
                }
 
                foreach ( $personalTools as $key => $item ) {
@@ -543,7 +555,7 @@ class SkinTemplate extends Skin {
                $tpl = $this->setupTemplateForOutput();
                $tpl->set( 'personal_urls', $this->buildPersonalUrls() );
 
-               return $tpl->getPersonalTools();
+               return ( $tpl instanceof BaseTemplate ) ? $tpl->getPersonalTools() : [];
        }
 
        /**