Merge "Floor slave lag before display"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 29 Aug 2016 23:16:54 +0000 (23:16 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 29 Aug 2016 23:16:54 +0000 (23:16 +0000)
1  2 
includes/OutputPage.php

diff --combined includes/OutputPage.php
@@@ -2547,6 -2547,7 +2547,7 @@@ class OutputPage extends ContextSource 
        public function showLagWarning( $lag ) {
                $config = $this->getConfig();
                if ( $lag >= $config->get( 'SlaveLagWarning' ) ) {
+                       $lag = floor( $lag ); // floor to avoid nano seconds to display
                        $message = $lag < $config->get( 'SlaveLagCritical' )
                                ? 'lag-warn-normal'
                                : 'lag-warn-high';
                                                        // Special case in buildExemptModules()
                                                        return false;
                                                }
 -                                              if ( $name === 'site.styles' ) {
 -                                                      // HACK: Technically, 'site.styles' isn't in a separate request group.
 -                                                      // But, in order to ensure its styles are in the right position,
 -                                                      // pretend it's in a group called 'site'.
 -                                                      $group = 'site';
 -                                              }
                                                if ( isset( $exemptGroups[$group] ) ) {
                                                        $exemptStates[$name] = 'ready';
                                                        if ( !$module->isKnownEmpty( $context ) ) {
  
        private function isUserJsPreview() {
                return $this->getConfig()->get( 'AllowUserJs' )
 -                      && $this->getUser()->isLoggedIn()
                        && $this->getTitle()
                        && $this->getTitle()->isJsSubpage()
                        && $this->userCanPreview();
  
        private function isUserCssPreview() {
                return $this->getConfig()->get( 'AllowUserCss' )
 -                      && $this->getUser()->isLoggedIn()
                        && $this->getTitle()
                        && $this->getTitle()->isCssSubpage()
                        && $this->userCanPreview();
                }
  
                $user = $this->getUser();
 +
 +              if ( !$user->isLoggedIn() ) {
 +                      // Anons have predictable edit tokens
 +                      return false;
 +              }
                if ( !$user->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) {
                        return false;
                }