Merge "Support non-replicating DB clusters for static datasets"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 24 May 2016 23:59:24 +0000 (23:59 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 24 May 2016 23:59:24 +0000 (23:59 +0000)
1  2 
includes/DefaultSettings.php
includes/db/loadbalancer/LoadBalancer.php

@@@ -1902,6 -1902,7 +1902,7 @@@ $wgSharedSchema = false
   *                                    if available
   *
   *   - max lag:     (optional) Maximum replication lag before a slave will taken out of rotation
+  *   - is static:   (optional) Set to true if the dataset is static and no replication is used.
   *
   *   These and any other user-defined properties will be assigned to the mLBInfo member
   *   variable of the Database object.
@@@ -4261,13 -4262,7 +4262,13 @@@ $wgDebugTidy = false
  $wgRawHtml = false;
  
  /**
 - * Set a default target for external links, e.g. _blank to pop up a new window
 + * Set a default target for external links, e.g. _blank to pop up a new window.
 + *
 + * This will also set the "noreferrer" and "noopener" link rel to prevent the
 + * attack described at https://mathiasbynens.github.io/rel-noopener/ .
 + * Some older browsers may not support these link attributes, hence
 + * setting $wgExternalLinkTarget to _blank may represent a security risk
 + * to some of your users.
   */
  $wgExternalLinkTarget = false;
  
@@@ -4545,40 -4540,9 +4546,40 @@@ $wgAuthManagerAutoConfig = 
  ];
  
  /**
 - * If it has been this long since the last authentication, recommend
 - * re-authentication before security-sensitive operations (e.g. password or
 - * email changes). Set negative to disable.
 + * Time frame for re-authentication.
 + *
 + * With only password-based authentication, you'd just ask the user to re-enter
 + * their password to verify certain operations like changing the password or
 + * changing the account's email address. But under AuthManager, the user might
 + * not have a password (you might even have to redirect the browser to a
 + * third-party service or something complex like that), you might want to have
 + * both factors of a two-factor authentication, and so on. So, the options are:
 + * - Incorporate the whole multi-step authentication flow within everything
 + *   that needs to do this.
 + * - Consider it good if they used Special:UserLogin during this session within
 + *   the last X seconds.
 + * - Come up with a third option.
 + *
 + * MediaWiki currently takes the second option. This setting configures the
 + * "X seconds".
 + *
 + * This allows for configuring different time frames for different
 + * "operations". The operations used in MediaWiki core include:
 + * - LinkAccounts
 + * - UnlinkAccount
 + * - ChangeCredentials
 + * - RemoveCredentials
 + * - ChangeEmail
 + *
 + * Additional operations may be used by extensions, either explicitly by
 + * calling AuthManager::securitySensitiveOperationStatus(),
 + * ApiAuthManagerHelper::securitySensitiveOperation() or
 + * SpecialPage::checkLoginSecurityLevel(), or implicitly by overriding
 + * SpecialPage::getLoginSecurityLevel() or by subclassing
 + * AuthManagerSpecialPage.
 + *
 + * The key 'default' is used if a requested operation isn't defined in the array.
 + *
   * @since 1.27
   * @var int[] operation => time in seconds. A 'default' key must always be provided.
   */
@@@ -4587,18 -4551,8 +4588,18 @@@ $wgReauthenticateTime = 
  ];
  
  /**
 - * Whether to allow security-sensitive operations when authentication is not possible.
 + * Whether to allow security-sensitive operations when re-authentication is not possible.
 + *
 + * If AuthManager::canAuthenticateNow() is false (e.g. the current
 + * SessionProvider is not able to change users, such as when OAuth is in use),
 + * AuthManager::securitySensitiveOperationStatus() cannot sensibly return
 + * SEC_REAUTH. Setting an operation true here will have it return SEC_OK in
 + * that case, while setting it false will have it return SEC_FAIL.
 + *
 + * The key 'default' is used if a requested operation isn't defined in the array.
 + *
   * @since 1.27
 + * @see $wgReauthenticateTime
   * @var bool[] operation => boolean. A 'default' key must always be provided.
   */
  $wgAllowSecuritySensitiveOperationIfCannotReauthenticate = [
@@@ -7098,7 -7052,6 +7099,7 @@@ $wgExtensionCredits = []
  /**
   * Authentication plugin.
   * @var $wgAuth AuthPlugin
 + * @deprecated since 1.27 use $wgAuthManagerConfig instead
   */
  $wgAuth = null;
  
@@@ -1334,7 -1334,7 +1334,7 @@@ class LoadBalancer 
  
                $lagTimes = $this->getLagTimes( $wiki );
                foreach ( $lagTimes as $i => $lag ) {
 -                      if ( $lag > $maxLag ) {
 +                      if ( $this->mLoads[$i] > 0 && $lag > $maxLag ) {
                                $maxLag = $lag;
                                $host = $this->mServers[$i]['host'];
                                $maxIndex = $i;
                }
  
                $pos = $pos ?: $this->getConnection( DB_MASTER )->getMasterPos();
-               if ( !$pos ) {
+               if ( !( $pos instanceof DBMasterPos ) ) {
                        return false; // something is misconfigured
                }