Chad has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177283

Change subject: Deprecated $wgProfilePerHost
......................................................................

Deprecated $wgProfilePerHost

Change-Id: I2af28cd3083228136789cff5feadd7b16c509e5b
---
M includes/DefaultSettings.php
M includes/profiler/output/ProfilerOutputDb.php
2 files changed, 19 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/83/177283/1

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 7e23763..ca41088 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -5378,8 +5378,10 @@
 
 /**
  * Should application server host be put into profiling table
+ *
+ * @deprecated set $wgProfiler['perhost'] = true instead
  */
-$wgProfilePerHost = false;
+$wgProfilePerHost = null;
 
 /**
  * Host for UDP profiler.
diff --git a/includes/profiler/output/ProfilerOutputDb.php 
b/includes/profiler/output/ProfilerOutputDb.php
index f988238..ab42802 100644
--- a/includes/profiler/output/ProfilerOutputDb.php
+++ b/includes/profiler/output/ProfilerOutputDb.php
@@ -28,19 +28,28 @@
  * @since 1.25
  */
 class ProfilerOutputDb extends ProfilerOutput {
+       /** @var bool Whether to store host data with profiling calls */
+       private $perHost = false;
+
+       public function __construct( Profiler $collector, array $params ) {
+               parent::__construct( $collector, $params );
+               global $wgProfilePerHost;
+
+               // Initialize per-host profiling from config, back-compat if 
available
+               if ( isset( $this->params['perHost'] ) ) {
+                       $this->perHost = $this->params['perHost'];
+               } elseif( $wgProfilePerHost ) {
+                       $this->perHost = $wgProfilePerHost;
+               }
+       }
+
        public function canUse() {
                # Do not log anything if database is readonly (bug 5375)
                return !wfReadOnly();
        }
 
        public function log( array $stats ) {
-               global $wgProfilePerHost;
-
-               if ( $wgProfilePerHost ) {
-                       $pfhost = wfHostname();
-               } else {
-                       $pfhost = '';
-               }
+               $pfhost = $this->perHost ? wfHostname() : '';
 
                try {
                        $dbw = wfGetDB( DB_MASTER );

-- 
To view, visit https://gerrit.wikimedia.org/r/177283
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2af28cd3083228136789cff5feadd7b16c509e5b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to