Merge "Deprecated $wgUDPProfilerHost, $wgUDPProfilerPort and $wgUDPProfilerFormatString"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 3 Dec 2014 20:59:11 +0000 (20:59 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 3 Dec 2014 20:59:11 +0000 (20:59 +0000)
docs/scripts.txt
includes/OutputPage.php
includes/installer/DatabaseUpdater.php
includes/installer/MysqlUpdater.php
includes/installer/SqliteUpdater.php
profileinfo.php
tests/phpunit/includes/db/DatabaseSqliteTest.php

index c6fa674..178bb15 100644 (file)
@@ -34,7 +34,7 @@ Primary scripts:
     To save the profiling information in the database (required to use this
     script), you have to modify StartProfiler.php to use the Profiler class and
     not the stub profiler which is enabled by default.
-    You will also need to set $wgProfileToDatabase to true in LocalSettings.php
+    You will also need to set $wgProfiler['output'] to 'db' in LocalSettings.php
     to force the profiler to save the informations in the database and apply the
     maintenance/archives/patch-profiling.sql patch to the database.
 
index 2936ca3..fb2d6f4 100644 (file)
@@ -366,6 +366,16 @@ class OutputPage extends ContextSource {
                array_push( $this->mMetatags, array( $name, $val ) );
        }
 
+       /**
+        * Returns the current <meta> tags
+        *
+        * @since 1.25
+        * @return array
+        */
+       public function getMetaTags() {
+               return $this->mMetatags;
+       }
+
        /**
         * Add a new \<link\> tag to the page header.
         *
@@ -377,6 +387,16 @@ class OutputPage extends ContextSource {
                array_push( $this->mLinktags, $linkarr );
        }
 
+       /**
+        * Returns the current <link> tags
+        *
+        * @since 1.25
+        * @return array
+        */
+       public function getLinkTags() {
+               return $this->mLinktags;
+       }
+
        /**
         * Add a new \<link\> with "rel" attribute set to "meta"
         *
@@ -398,6 +418,17 @@ class OutputPage extends ContextSource {
                $this->mCanonicalUrl = $url;
        }
 
+       /**
+        * Returns the URL to be used for the <link rel=canonical> if
+        * one is set.
+        *
+        * @since 1.25
+        * @return bool|string
+        */
+       public function getCanonicalUrl() {
+               return $this->mCanonicalUrl;
+       }
+
        /**
         * Get the value of the "rel" attribute for metadata links
         *
index dac4337..a5540db 100644 (file)
@@ -1058,6 +1058,31 @@ abstract class DatabaseUpdater {
                }
        }
 
+       /**
+        * Enable profiling table when it's turned on
+        */
+       protected function doEnableProfiling() {
+               global $wgProfiler;
+
+               if ( !$this->doTable( 'profiling' ) ) {
+                       return true;
+               }
+
+               $profileToDb = false;
+               if ( isset( $wgProfiler['output'] ) ) {
+                       $out = $wgProfiler['output'];
+                       if ( $out === 'db' ) {
+                               $profileToDb = true;
+                       } elseif( is_array( $out ) && in_array( 'db', $out ) ) {
+                               $profileToDb = true;
+                       }
+               }
+
+               if ( $profileToDb && !$this->db->tableExists( 'profiling', __METHOD__ ) ) {
+                       $this->applyPatch( 'patch-profiling.sql', false, 'Add profiling table' );
+               }
+       }
+
        /**
         * Rebuilds the localisation cache
         */
index 990b5b0..c3dedbc 100644 (file)
@@ -924,18 +924,6 @@ class MysqlUpdater extends DatabaseUpdater {
                }
        }
 
-       protected function doEnableProfiling() {
-               global $wgProfileToDatabase;
-
-               if ( !$this->doTable( 'profiling' ) ) {
-                       return true;
-               }
-
-               if ( $wgProfileToDatabase === true && !$this->db->tableExists( 'profiling', __METHOD__ ) ) {
-                       $this->applyPatch( 'patch-profiling.sql', false, 'Add profiling table' );
-               }
-       }
-
        protected function doMaybeProfilingMemoryUpdate() {
                if ( !$this->doTable( 'profiling' ) ) {
                        return true;
index ab5ab7d..91cbb04 100644 (file)
@@ -168,11 +168,4 @@ class SqliteUpdater extends DatabaseUpdater {
                        $this->output( "...fulltext search table appears to be in order.\n" );
                }
        }
-
-       protected function doEnableProfiling() {
-               global $wgProfileToDatabase;
-               if ( $wgProfileToDatabase === true && !$this->db->tableExists( 'profiling', __METHOD__ ) ) {
-                       $this->applyPatch( 'patch-profiling.sql', false, 'Add profiling table' );
-               }
-       }
 }
index b930f42..4e3fb5a 100644 (file)
@@ -27,7 +27,7 @@
 
 ini_set( 'zlib.output_compression', 'off' );
 
-$wgEnableProfileInfo = $wgProfileToDatabase = false;
+$wgEnableProfileInfo = false;
 require __DIR__ . '/includes/WebStart.php';
 
 header( 'Content-Type: text/html; charset=utf-8' );
@@ -149,8 +149,8 @@ $dbr = wfGetDB( DB_SLAVE );
 
 if ( !$dbr->tableExists( 'profiling' ) ) {
        echo '<p>No <code>profiling</code> table exists, so we can\'t show you anything.</p>'
-               . '<p>If you want to log profiling data, enable <code>$wgProfileToDatabase</code>'
-               . ' in your LocalSettings.php and run <code>maintenance/update.php</code> to'
+               . '<p>If you want to log profiling data, enable <code>$wgProfiler[\'output\'] = \'db\'</code>'
+               . ' in your StartProfiler.php and run <code>maintenance/update.php</code> to'
                . ' create the profiling table.'
                . '</body></html>';
        exit( 1 );
index 98b4ca0..588e544 100644 (file)
@@ -272,7 +272,7 @@ class DatabaseSqliteTest extends MediaWikiTestCase {
         * @todo Currently only checks list of tables
         */
        public function testUpgrades() {
-               global $IP, $wgVersion, $wgProfileToDatabase;
+               global $IP, $wgVersion, $wgProfiler;
 
                // Versions tested
                $versions = array(
@@ -291,7 +291,18 @@ class DatabaseSqliteTest extends MediaWikiTestCase {
 
                $currentDB = new DatabaseSqliteStandalone( ':memory:' );
                $currentDB->sourceFile( "$IP/maintenance/tables.sql" );
-               if ( $wgProfileToDatabase ) {
+
+               $profileToDb = false;
+               if ( isset( $wgProfiler['output'] ) ) {
+                       $out = $wgProfiler['output'];
+                       if ( $out === 'db' ) {
+                               $profileToDb = true;
+                       } elseif( is_array( $out ) && in_array( 'db', $out ) ) {
+                               $profileToDb = true;
+                       }
+               }
+
+               if ( $profileToDb ) {
                        $currentDB->sourceFile( "$IP/maintenance/sqlite/archives/patch-profiling.sql" );
                }
                $currentTables = $this->getTables( $currentDB );