Merge "OutputPage.php: Remove misleading comment"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 11 Feb 2016 04:06:13 +0000 (04:06 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 11 Feb 2016 04:06:13 +0000 (04:06 +0000)
1  2 
includes/OutputPage.php

diff --combined includes/OutputPage.php
@@@ -1573,42 -1573,11 +1573,42 @@@ class OutputPage extends ContextSource 
         * @return ParserOptions
         */
        public function parserOptions( $options = null ) {
 +              if ( $options !== null && !empty( $options->isBogus ) ) {
 +                      // Someone is trying to set a bogus pre-$wgUser PO. Check if it has
 +                      // been changed somehow, and keep it if so.
 +                      $anonPO = ParserOptions::newFromAnon();
 +                      $anonPO->setEditSection( false );
 +                      if ( !$options->matches( $anonPO ) ) {
 +                              wfLogWarning( __METHOD__ . ': Setting a changed bogus ParserOptions: ' . wfGetAllCallers( 5 ) );
 +                              $options->isBogus = false;
 +                      }
 +              }
 +
                if ( !$this->mParserOptions ) {
 +                      if ( !$this->getContext()->getUser()->isSafeToLoad() ) {
 +                              // $wgUser isn't unstubbable yet, so don't try to get a
 +                              // ParserOptions for it. And don't cache this ParserOptions
 +                              // either.
 +                              $po = ParserOptions::newFromAnon();
 +                              $po->setEditSection( false );
 +                              $po->isBogus = true;
 +                              if ( $options !== null ) {
 +                                      $this->mParserOptions = empty( $options->isBogus ) ? $options : null;
 +                              }
 +                              return $po;
 +                      }
 +
                        $this->mParserOptions = ParserOptions::newFromContext( $this->getContext() );
                        $this->mParserOptions->setEditSection( false );
                }
 -              return wfSetVar( $this->mParserOptions, $options );
 +
 +              if ( $options !== null && !empty( $options->isBogus ) ) {
 +                      // They're trying to restore the bogus pre-$wgUser PO. Do the right
 +                      // thing.
 +                      return wfSetVar( $this->mParserOptions, null, true );
 +              } else {
 +                      return wfSetVar( $this->mParserOptions, $options );
 +              }
        }
  
        /**
         */
        public function addStyle( $style, $media = '', $condition = '', $dir = '' ) {
                $options = array();
-               // Even though we expect the media type to be lowercase, but here we
-               // force it to lowercase to be safe.
                if ( $media ) {
                        $options['media'] = $media;
                }
                        'oojs-ui.styles.textures',
                        'mediawiki.widgets.styles',
                ) );
 +              // Used by 'skipFunction' of the four 'oojs-ui.styles.*' modules. Please don't treat this as a
 +              // public API or you'll be severely disappointed when T87871 is fixed and it disappears.
 +              $this->addMeta( 'X-OOUI-PHP', '1' );
        }
  }