Merge "update.php: Don't check for mbstring extension"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 15 Jun 2016 10:33:15 +0000 (10:33 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 15 Jun 2016 10:33:15 +0000 (10:33 +0000)
includes/parser/Parser.php
includes/specialpage/SpecialPage.php
includes/specials/SpecialNewpages.php
includes/specials/SpecialRecentchanges.php
maintenance/Maintenance.php
maintenance/install.php
resources/src/startup.js
tests/qunit/data/testrunner.js

index 63a297b..6c84623 100644 (file)
@@ -3125,6 +3125,7 @@ class Parser {
                                        && $this->mOptions->getAllowSpecialInclusion()
                                        && $this->ot['html']
                                ) {
+                                       $specialPage = SpecialPageFactory::getPage( $title->getDBkey() );
                                        // Pass the template arguments as URL parameters.
                                        // "uselang" will have no effect since the Language object
                                        // is forced to the one defined in ParserOptions.
@@ -3143,7 +3144,12 @@ class Parser {
                                        $context = new RequestContext;
                                        $context->setTitle( $title );
                                        $context->setRequest( new FauxRequest( $pageArgs ) );
-                                       $context->setUser( $this->getUser() );
+                                       if ( $specialPage && $specialPage->maxIncludeCacheTime() === 0 ) {
+                                               $context->setUser( $this->getUser() );
+                                       } else {
+                                               // If this page is cached, then we better not be per user.
+                                               $context->setUser( User::newFromName( '127.0.0.1', false ) );
+                                       }
                                        $context->setLanguage( $this->mOptions->getUserLangObj() );
                                        $ret = SpecialPageFactory::capturePath( $title, $context );
                                        if ( $ret ) {
@@ -3151,7 +3157,9 @@ class Parser {
                                                $this->mOutput->addOutputPageMetadata( $context->getOutput() );
                                                $found = true;
                                                $isHTML = true;
-                                               $this->disableCache();
+                                               if ( $specialPage && $specialPage->maxIncludeCacheTime() !== false ) {
+                                                       $this->mOutput->updateCacheExpiry( $specialPage->maxIncludeCacheTime() );
+                                               }
                                        }
                                } elseif ( MWNamespace::isNonincludable( $title->getNamespace() ) ) {
                                        $found = false; # access denied
index 408c726..6624414 100644 (file)
@@ -175,6 +175,25 @@ class SpecialPage {
                return $this->mIncludable;
        }
 
+       /**
+        * How long to cache page when it is being included.
+        *
+        * @note If cache time is not 0, then the current user becomes an anon
+        *   if you want to do any per-user customizations, than this method
+        *   must be overriden to return 0.
+        * @since 1.26
+        * @return int Time in seconds, 0 to disable caching altogether,
+        *  false to use the parent page's cache settings
+        */
+       public function maxIncludeCacheTime() {
+               global $wgMiserMode;
+               if ( !$wgMiserMode ) {
+                       return 0;
+               } else {
+                       return 60*60;
+               }
+       }
+
        /**
         * Whether the special page is being evaluated via transclusion
         * @param bool $x
index c24b054..ff9a899 100644 (file)
@@ -478,4 +478,18 @@ class SpecialNewpages extends IncludableSpecialPage {
        protected function getGroupName() {
                return 'changes';
        }
+
+       /**
+        * How long to cache page when it is being included.
+        *
+        * @return int Time in seconds, 0 to disable caching altogether
+        */
+       public function maxIncludeCacheTime() {
+               global $wgMiserMode;
+               if ( !$wgMiserMode ) {
+                       return 0;
+               } else {
+                       return 60*5;
+               }
+       }
 }
index b6398cb..36ccd4a 100644 (file)
@@ -794,4 +794,19 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
        public function isIncludable() {
                return true;
        }
+
+       /**
+        * How long to cache page when it is being included.
+        *
+        * @return int|bool Time in seconds, 0 to disable caching altogether
+        */
+       public function maxIncludeCacheTime() {
+               global $wgMiserMode;
+               if ( !$wgMiserMode ) {
+                       return 0;
+               } else {
+                       return 60*5;
+               }
+       }
+
 }
index a08297a..27d8161 100644 (file)
  */
 
 // Bail on old versions of PHP, or if composer has not been run yet to install
-// dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
-// @codingStandardsIgnoreStart MediaWiki.Usage.DirUsage.FunctionFound
-require_once dirname( __FILE__ ) . '/../includes/PHPVersionCheck.php';
-// @codingStandardsIgnoreEnd
+// dependencies.
+require_once __DIR__ . '/../includes/PHPVersionCheck.php';
 wfEntryPointCheck( 'cli' );
 
 /**
index ae3074a..3e632f0 100644 (file)
  * @ingroup Maintenance
  */
 
-// Checking for old versions of PHP is done in Maintenance.php
-// We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+
-// @codingStandardsIgnoreStart MediaWiki.Usage.DirUsage.FunctionFound
-require_once dirname( __FILE__ ) . '/Maintenance.php';
-// @codingStandardsIgnoreEnd
+require_once __DIR__ . '/Maintenance.php';
 
 define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' );
 define( 'MEDIAWIKI_INSTALL', true );
index 312e745..62ee94e 100644 (file)
@@ -3,7 +3,7 @@
  *
  * This file is where we decide whether to initialise the modern run-time.
  */
-/*jshint unused: false, evil: true */
+/*jshint unused: false */
 /*globals mw, RLQ: true, NORLQ: true, $VARS, $CODE, performance */
 
 var mediaWikiLoadStart = ( new Date() ).getTime(),
index 1091d09..79f37dc 100644 (file)
@@ -1,5 +1,4 @@
 /*global CompletenessTest, sinon */
-/*jshint evil: true */
 ( function ( $, mw, QUnit ) {
        'use strict';