Merge "Show copyright based on $output->hasCopyright()"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 3 Oct 2018 18:04:15 +0000 (18:04 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 3 Oct 2018 18:04:15 +0000 (18:04 +0000)
includes/OutputPage.php
includes/skins/SkinTemplate.php

index 2bfccda..dd2f5ac 100644 (file)
@@ -85,6 +85,9 @@ class OutputPage extends ContextSource {
        /** @var bool Stores "article flag" toggle. */
        private $mIsArticleRelated = true;
 
+       /** @var bool Is the content subject to copyright */
+       private $mHasCopyright = false;
+
        /**
         * @var bool We have to set isPrintable(). Some pages should
         * never be printed (ex: redirections).
@@ -1261,6 +1264,28 @@ class OutputPage extends ContextSource {
                return $this->mIsArticleRelated;
        }
 
+       /**
+        * Set whether the standard copyright should be shown for the current page.
+        *
+        * @param bool $hasCopyright
+        */
+       public function setCopyright( $hasCopyright ) {
+               $this->mHasCopyright = $hasCopyright;
+       }
+
+       /**
+        * Return whether the standard copyright should be shown for the current page.
+        * By default, it is true for all articles but other pages
+        * can signal it by using setCopyright( true ).
+        *
+        * Used by SkinTemplate to decided whether to show the copyright.
+        *
+        * @return bool
+        */
+       public function showsCopyright() {
+               return $this->isArticle() || $this->mHasCopyright;
+       }
+
        /**
         * Add new language links
         *
@@ -3997,4 +4022,5 @@ class OutputPage extends ContextSource {
                }
                return $this->CSPNonce;
        }
+
 }
index 564220c..c29c996 100644 (file)
@@ -385,16 +385,20 @@ 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 ) {
+                                               $tpl->set( 'credits', Action::factory( 'credits', $this->getWikiPage(),
+                                                       $this->getContext() )->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() );