Merge "Added "maxPartitionsTry" option to JobQueueFederated"
[lhc/web/wiklou.git] / includes / OutputPage.php
index 0df28a8..7f0454f 100644 (file)
@@ -255,6 +255,11 @@ class OutputPage extends ContextSource {
         */
        private $mTarget = null;
 
+       /**
+        * @var bool: Whether output should contain table of contents
+        */
+       private $mEnableTOC = true;
+
        /**
         * Constructor for OutputPage. This should not be called directly.
         * Instead a new RequestContext should be created and it will implicitly create
@@ -669,7 +674,7 @@ class OutputPage extends ContextSource {
         *
         * @param $timestamp string
         *
-        * @return Boolean: true iff cache-ok headers was sent.
+        * @return Boolean: true if cache-ok headers was sent.
         */
        public function checkLastModified( $timestamp ) {
                global $wgCachePages, $wgCacheEpoch, $wgUseSquid, $wgSquidMaxage;
@@ -1606,6 +1611,7 @@ class OutputPage extends ContextSource {
         */
        function addParserOutput( &$parserOutput ) {
                $this->addParserOutputNoText( $parserOutput );
+               $parserOutput->setTOCEnabled( $this->mEnableTOC );
                $text = $parserOutput->getText();
                wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) );
                $this->addHTML( $text );
@@ -1721,6 +1727,7 @@ class OutputPage extends ContextSource {
                                array(
                                        "{$wgCookiePrefix}Token",
                                        "{$wgCookiePrefix}LoggedOut",
+                                       "forceHTTPS",
                                        session_name()
                                ),
                                $wgCacheVaryCookies
@@ -2481,10 +2488,6 @@ $templates
                $userdir = $this->getLanguage()->getDir();
                $sitedir = $wgContLang->getDir();
 
-               if ( $sk->commonPrintStylesheet() ) {
-                       $this->addModuleStyles( 'mediawiki.legacy.wikiprintable' );
-               }
-
                $ret = Html::htmlHeader( array( 'lang' => $this->getLanguage()->getHtmlCode(), 'dir' => $userdir, 'class' => 'client-nojs' ) );
 
                if ( $this->getHTMLTitle() == '' ) {
@@ -2969,24 +2972,24 @@ $templates
        public function getJSVars() {
                global $wgContLang;
 
-               $latestRevID = 0;
-               $pageID = 0;
-               $canonicalName = false; # bug 21115
+               $curRevisionId = 0;
+               $articleId = 0;
+               $canonicalSpecialPageName = false; # bug 21115
 
                $title = $this->getTitle();
                $ns = $title->getNamespace();
-               $nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
+               $canonicalNamespace = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
 
                // Get the relevant title so that AJAX features can use the correct page name
                // when making API requests from certain special pages (bug 34972).
                $relevantTitle = $this->getSkin()->getRelevantTitle();
 
                if ( $ns == NS_SPECIAL ) {
-                       list( $canonicalName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
+                       list( $canonicalSpecialPageName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
                } elseif ( $this->canUseWikiPage() ) {
                        $wikiPage = $this->getWikiPage();
-                       $latestRevID = $wikiPage->getLatest();
-                       $pageID = $wikiPage->getId();
+                       $curRevisionId = $wikiPage->getLatest();
+                       $articleId = $wikiPage->getId();
                }
 
                $lang = $title->getPageLanguage();
@@ -3008,13 +3011,14 @@ $templates
                $user = $this->getUser();
 
                $vars = array(
-                       'wgCanonicalNamespace' => $nsname,
-                       'wgCanonicalSpecialPageName' => $canonicalName,
+                       'wgCanonicalNamespace' => $canonicalNamespace,
+                       'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
                        'wgNamespaceNumber' => $title->getNamespace(),
                        'wgPageName' => $title->getPrefixedDBkey(),
                        'wgTitle' => $title->getText(),
-                       'wgCurRevisionId' => $latestRevID,
-                       'wgArticleId' => $pageID,
+                       'wgCurRevisionId' => $curRevisionId,
+                       'wgRevisionId' => (int)$this->getRevisionId(),
+                       'wgArticleId' => $articleId,
                        'wgIsArticle' => $this->isArticle(),
                        'wgIsRedirect' => $title->isRedirect(),
                        'wgAction' => Action::getActionName( $this->getContext() ),
@@ -3650,4 +3654,20 @@ $templates
                return array();
        }
 
+       /**
+        * Enables/disables TOC, doesn't override __NOTOC__
+        * @param bool $flag
+        * @since 1.22
+        */
+       public function enableTOC( $flag = true ) {
+               $this->mEnableTOC = $flag;
+       }
+
+       /**
+        * @return bool
+        * @since 1.22
+        */
+       public function isTOCEnabled() {
+               return $this->mEnableTOC;
+       }
 }