Merge "Remove #toc and #toctitle style definitions"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 16 Mar 2018 23:09:41 +0000 (23:09 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 16 Mar 2018 23:09:41 +0000 (23:09 +0000)
includes/libs/rdbms/database/Database.php
includes/user/User.php
tests/phpunit/tests/MediaWikiTestCaseSchemaTest.sql
tests/selenium/wdio.conf.beta.js [new file with mode: 0644]

index 53cf55c..97ea266 100644 (file)
@@ -1590,17 +1590,12 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
        public function estimateRowCount(
                $table, $vars = '*', $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
        ) {
-               $rows = 0;
                $res = $this->select(
                        $table, [ 'rowcount' => 'COUNT(*)' ], $conds, $fname, $options, $join_conds
                );
+               $row = $res ? $this->fetchRow( $res ) : [];
 
-               if ( $res ) {
-                       $row = $this->fetchRow( $res );
-                       $rows = ( isset( $row['rowcount'] ) ) ? (int)$row['rowcount'] : 0;
-               }
-
-               return $rows;
+               return isset( $row['rowcount'] ) ? (int)$row['rowcount'] : 0;
        }
 
        public function selectRowCount(
@@ -2204,9 +2199,9 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                        if ( is_array( $table ) ) {
                                // A parenthesized group
                                if ( count( $table ) > 1 ) {
-                                       $joinedTable = '('
-                                               . $this->tableNamesWithIndexClauseOrJOIN( $table, $use_index, $ignore_index, $join_conds )
-                                               . ')';
+                                       $joinedTable = '(' .
+                                               $this->tableNamesWithIndexClauseOrJOIN(
+                                                       $table, $use_index, $ignore_index, $join_conds ) . ')';
                                } else {
                                        // Degenerate case
                                        $innerTable = reset( $table );
@@ -2364,7 +2359,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                        }
                }
 
-               return ' LIKE ' . $this->addQuotes( $s ) . ' ESCAPE ' . $this->addQuotes( $escapeChar ) . ' ';
+               return ' LIKE ' .
+                       $this->addQuotes( $s ) . ' ESCAPE ' . $this->addQuotes( $escapeChar ) . ' ';
        }
 
        public function anyChar() {
index ab791b4..d6523a7 100644 (file)
@@ -885,7 +885,7 @@ class User implements IDBAccessObject, UserIdentity {
                        return null;
                }
 
-               if ( !( $flags & self::READ_LATEST ) && isset( self::$idCacheByName[$name] ) ) {
+               if ( !( $flags & self::READ_LATEST ) && array_key_exists( $name, self::$idCacheByName ) ) {
                        return self::$idCacheByName[$name];
                }
 
index 43e8e9b..58460e2 100644 (file)
@@ -7,7 +7,7 @@ CREATE TABLE /*_*/MediaWikiTestCaseTestTable (
 CREATE TABLE /*_*/imagelinks (
   il_from int NOT NULL DEFAULT 0,
   il_from_namespace int NOT NULL DEFAULT 0,
-  il_to varchar(255) NOT NULL DEFAULT '',
-  il_frobniz varchar(255) NOT NULL DEFAULT 'FROB',
+  il_to varchar(127) NOT NULL DEFAULT '',
+  il_frobniz varchar(127) NOT NULL DEFAULT 'FROB',
   PRIMARY KEY (il_from,il_to)
 ) /*$wgDBTableOptions*/;
diff --git a/tests/selenium/wdio.conf.beta.js b/tests/selenium/wdio.conf.beta.js
new file mode 100644 (file)
index 0000000..8f5c2c7
--- /dev/null
@@ -0,0 +1,21 @@
+'use strict';
+const merge = require( 'deepmerge' ),
+       username = 'Selenium user',
+       wdioConf = require( './wdio.conf.js' );
+
+// Overwrite default settings
+exports.config = merge( wdioConf.config, {
+       username: process.env.MEDIAWIKI_USER === undefined ?
+               username :
+               process.env.MEDIAWIKI_USER,
+       password: process.env.MEDIAWIKI_PASSWORD,
+       baseUrl: (
+               process.env.MW_SERVER === undefined ?
+                       'https://en.wikipedia.beta.wmflabs.org:443' :
+                       process.env.MW_SERVER
+       ) + (
+               process.env.MW_SCRIPT_PATH === undefined ?
+                       '/w' :
+                       process.env.MW_SCRIPT_PATH
+       )
+} );