specified, deprecated in 1.30, have been removed.
* BufferingStatsdDataFactory::getBuffer(), deprecated in 1.30, has been removed.
* The constant DB_SLAVE, deprecated in 1.28, has been removed. Use DB_REPLICA.
+* Replacer, DoubleReplacer, HashtableReplacer and RegexlikeReplacer
+ (deprecated in 1.32) have been removed. Closures should be used instead.
* …
=== Deprecations in 1.34 ===
'DnsSrvDiscoverer' => __DIR__ . '/includes/libs/DnsSrvDiscoverer.php',
'DoubleRedirectJob' => __DIR__ . '/includes/jobqueue/jobs/DoubleRedirectJob.php',
'DoubleRedirectsPage' => __DIR__ . '/includes/specials/SpecialDoubleRedirects.php',
- 'DoubleReplacer' => __DIR__ . '/includes/libs/replacers/DoubleReplacer.php',
'DummyLinker' => __DIR__ . '/includes/DummyLinker.php',
'DummySearchIndexFieldDefinition' => __DIR__ . '/includes/search/DummySearchIndexFieldDefinition.php',
'DummyTermColorer' => __DIR__ . '/maintenance/term/MWTerm.php',
'HashConfig' => __DIR__ . '/includes/config/HashConfig.php',
'HashRing' => __DIR__ . '/includes/libs/HashRing.php',
'HashSiteStore' => __DIR__ . '/includes/site/HashSiteStore.php',
- 'HashtableReplacer' => __DIR__ . '/includes/libs/replacers/HashtableReplacer.php',
'HistoryAction' => __DIR__ . '/includes/actions/HistoryAction.php',
'HistoryBlob' => __DIR__ . '/includes/historyblob/HistoryBlob.php',
'HistoryBlobCurStub' => __DIR__ . '/includes/historyblob/HistoryBlobCurStub.php',
'RefreshImageMetadata' => __DIR__ . '/maintenance/refreshImageMetadata.php',
'RefreshLinks' => __DIR__ . '/maintenance/refreshLinks.php',
'RefreshLinksJob' => __DIR__ . '/includes/jobqueue/jobs/RefreshLinksJob.php',
- 'RegexlikeReplacer' => __DIR__ . '/includes/libs/replacers/RegexlikeReplacer.php',
'RemexStripTagHandler' => __DIR__ . '/includes/parser/RemexStripTagHandler.php',
'RemoveInvalidEmails' => __DIR__ . '/maintenance/removeInvalidEmails.php',
'RemoveUnusedAccounts' => __DIR__ . '/maintenance/removeUnusedAccounts.php',
'RenameDbPrefix' => __DIR__ . '/maintenance/renameDbPrefix.php',
'RenderAction' => __DIR__ . '/includes/actions/RenderAction.php',
'ReplacementArray' => __DIR__ . '/includes/libs/ReplacementArray.php',
- 'Replacer' => __DIR__ . '/includes/libs/replacers/Replacer.php',
'ReplicatedBagOStuff' => __DIR__ . '/includes/libs/objectcache/ReplicatedBagOStuff.php',
'RepoGroup' => __DIR__ . '/includes/filerepo/RepoGroup.php',
'RequestContext' => __DIR__ . '/includes/context/RequestContext.php',
"wikimedia/testing-access-wrapper": "~1.0",
"wmde/hamcrest-html-matchers": "^0.1.0",
"mediawiki/mediawiki-phan-config": "0.6.0",
- "symfony/yaml": "3.4.28"
+ "symfony/yaml": "3.4.28",
+ "johnkary/phpunit-speedtrap": "^1.0 | ^2.0"
},
"replace": {
"symfony/polyfill-ctype": "1.99",
}
unset( $logDir );
-// Disable rate-limiting
+// Disable rate-limiting to allow integration tests to run unthrottled
+// in CI and for devs locally (T225796)
$wgRateLimits = [];
*/
protected $tabIndex = 1;
+ /**
+ * Numeric index of the help box
+ *
+ * @var int
+ */
+ protected $helpBoxId = 1;
+
/**
* Name of the page we're on
*
$args = array_map( 'htmlspecialchars', $args );
$text = wfMessage( $msg, $args )->useDatabase( false )->plain();
$html = $this->parse( $text, true );
+ $id = 'helpBox-' . $this->helpBoxId++;
return "<div class=\"config-help-field-container\">\n" .
- "<span class=\"config-help-field-hint\" title=\"" .
+ "<input type=\"checkbox\" class=\"config-help-field-checkbox\" id=\"$id\" />" .
+ "<label class=\"config-help-field-hint\" for=\"$id\" title=\"" .
wfMessage( 'config-help-tooltip' )->escaped() . "\">" .
- wfMessage( 'config-help' )->escaped() . "</span>\n" .
+ wfMessage( 'config-help' )->escaped() . "</label>\n" .
"<div class=\"config-help-field-data\">" . $html . "</div>\n" .
"</div>\n";
}
public function __construct( ILoadBalancer $lb, $conn, $role ) {
$this->lb = $lb;
$this->role = $role;
- if ( $conn instanceof Database ) {
+ if ( $conn instanceof IDatabase && !( $conn instanceof DBConnRef ) ) {
$this->conn = $conn; // live handle
} elseif ( is_array( $conn ) && count( $conn ) >= 4 && $conn[self::FLD_DOMAIN] !== false ) {
$this->params = $conn;
return $this->__call( __FUNCTION__, func_get_args() );
}
- public function buildLike() {
+ public function buildLike( $param ) {
return $this->__call( __FUNCTION__, func_get_args() );
}
$s );
}
- public function buildLike() {
- $params = func_get_args();
-
- if ( count( $params ) > 0 && is_array( $params[0] ) ) {
- $params = $params[0];
+ public function buildLike( $param, ...$params ) {
+ if ( is_array( $param ) ) {
+ $params = $param;
+ } else {
+ $params = func_get_args();
}
$s = '';
* $query .= $dbr->buildLike( $pattern );
*
* @since 1.16
+ * @param array[]|string|LikeMatch $param
* @return string Fully built LIKE statement
*/
- public function buildLike();
+ public function buildLike( $param );
/**
* Returns a token for buildLike() that denotes a '_' to be used in a LIKE query
+++ /dev/null
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-/**
- * Class to perform secondary replacement within each replacement string
- *
- * @deprecated since 1.32, use a Closure instead
- */
-class DoubleReplacer extends Replacer {
- /**
- * @param mixed $from
- * @param mixed $to
- * @param int $index
- */
- public function __construct( $from, $to, $index = 0 ) {
- wfDeprecated( __METHOD__, '1.32' );
- $this->from = $from;
- $this->to = $to;
- $this->index = $index;
- }
-
- /**
- * @param array $matches
- * @return mixed
- */
- public function replace( array $matches ) {
- return str_replace( $this->from, $this->to, $matches[$this->index] );
- }
-}
+++ /dev/null
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-/**
- * Class to perform replacement based on a simple hashtable lookup
- *
- * @deprecated since 1.32, use a Closure instead
- */
-class HashtableReplacer extends Replacer {
- private $table, $index;
-
- /**
- * @param array $table
- * @param int $index
- */
- public function __construct( $table, $index = 0 ) {
- wfDeprecated( __METHOD__, '1.32' );
- $this->table = $table;
- $this->index = $index;
- }
-
- /**
- * @param array $matches
- * @return mixed
- */
- public function replace( array $matches ) {
- return $this->table[$matches[$this->index]];
- }
-}
+++ /dev/null
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-/**
- * Class to replace regex matches with a string similar to that used in preg_replace()
- *
- * @deprecated since 1.32, use a Closure instead
- */
-class RegexlikeReplacer extends Replacer {
- private $r;
-
- /**
- * @param string $r
- */
- public function __construct( $r ) {
- wfDeprecated( __METHOD__, '1.32' );
- $this->r = $r;
- }
-
- /**
- * @param array $matches
- * @return string
- */
- public function replace( array $matches ) {
- $pairs = [];
- foreach ( $matches as $i => $match ) {
- $pairs["\$$i"] = $match;
- }
-
- return strtr( $this->r, $pairs );
- }
-}
+++ /dev/null
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-/**
- * Base class for "replacers", objects used in preg_replace_callback() and
- * StringUtils::delimiterReplaceCallback()
- *
- * @deprecated since 1.32, use a Closure instead
- */
-abstract class Replacer {
- /**
- * @return array
- */
- public function cb() {
- wfDeprecated( __METHOD__, '1.32' );
- return [ $this, 'replace' ];
- }
-
- /**
- * @param array $matches
- * @return string
- */
- abstract public function replace( array $matches );
-}
private $cgroup = false;
/**
- * bitfield with restrictions
+ * Bitfield with restrictions
*
* @var int
*/
protected $restrictions = 0;
/**
- * Constructor. Don't call directly, instead use Shell::command()
+ * Don't call directly, instead use Shell::command()
*
* @throws ShellDisabledError
*/
}
/**
- * Destructor. Makes sure programmer didn't forget to execute the command after all
+ * Makes sure the programmer didn't forget to execute the command after all
*/
public function __destruct() {
if ( !$this->everExecuted ) {
];
$separatorTransformTable = [ ',' => '.', '.' => ',' ];
+$linkTrail = '/^([a-zçəğıöşü]+)(.*)$/sDu';
display: none;
}
+.config-help-field-checkbox {
+ display: none;
+}
+
/* tooltip styles */
.config-help-field-hint {
- display: none;
margin-left: 2px;
- margin-bottom: -8px;
padding: 0 0 0 15px;
/* @embed */
background-image: url( images/help-question.gif );
margin-left: 20px;
}
+.config-help-field-checkbox:not( :checked ) ~ .config-help-field-data {
+ display: none;
+}
+
#p-logo a {
background-image: url( images/installer-logo.png );
}
$label.text( labelText.replace( '$1', value ) );
}
- // Set up the help system
- $( '.config-help-field-data' ).hide()
- .closest( '.config-help-field-container' ).find( '.config-help-field-hint' )
- .show()
- .on( 'click', function () {
- // FIXME: Use CSS transition
- // eslint-disable-next-line no-jquery/no-slide
- $( this ).closest( '.config-help-field-container' ).find( '.config-help-field-data' )
- .slideToggle( 'fast' );
- } );
-
// Show/hide code for DB-specific options
// FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here?
$( '.dbRadio' ).each( function () {
use MWException;
use Title;
use WANObjectCache;
-use Wikimedia\Rdbms\Database;
+use Wikimedia\Rdbms\IDatabase;
use Wikimedia\Rdbms\LoadBalancer;
use Wikimedia\TestingAccessWrapper;
use WikitextContent;
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject|Database
+ * @return \PHPUnit_Framework_MockObject_MockObject|IDatabase
*/
private function getMockDatabase() {
- return $this->getMockBuilder( Database::class )
+ return $this->getMockBuilder( IDatabase::class )
->disableOriginalConstructor()->getMock();
}
use MediaWikiTestCase;
use Psr\Log\NullLogger;
use WANObjectCache;
-use Wikimedia\Rdbms\Database;
+use Wikimedia\Rdbms\IDatabase;
use Wikimedia\Rdbms\LoadBalancer;
use Wikimedia\TestingAccessWrapper;
}
private function getCallCheckingDb( $insertCalls, $selectCalls ) {
- $mock = $this->getMockBuilder( Database::class )
+ $proxiedMethods = [
+ 'select' => $selectCalls,
+ 'insert' => $insertCalls,
+ 'affectedRows' => null,
+ 'insertId' => null,
+ 'getSessionLagStatus' => null,
+ 'writesPending' => null,
+ 'onTransactionPreCommitOrIdle' => null
+ ];
+ $mock = $this->getMockBuilder( IDatabase::class )
->disableOriginalConstructor()
->getMock();
- $mock->expects( $this->exactly( $insertCalls ) )
- ->method( 'insert' )
- ->willReturnCallback( function ( ...$args ) {
- return call_user_func_array( [ $this->db, 'insert' ], $args );
- } );
- $mock->expects( $this->exactly( $selectCalls ) )
- ->method( 'select' )
- ->willReturnCallback( function ( ...$args ) {
- return call_user_func_array( [ $this->db, 'select' ], $args );
- } );
- $mock->expects( $this->exactly( $insertCalls ) )
- ->method( 'affectedRows' )
- ->willReturnCallback( function ( ...$args ) {
- return call_user_func_array( [ $this->db, 'affectedRows' ], $args );
- } );
- $mock->expects( $this->any() )
- ->method( 'insertId' )
- ->willReturnCallback( function ( ...$args ) {
- return call_user_func_array( [ $this->db, 'insertId' ], $args );
- } );
- $mock->expects( $this->any() )
- ->method( 'query' )
- ->willReturn( [] );
- $mock->expects( $this->any() )
- ->method( 'isOpen' )
- ->willReturn( true );
- $wrapper = TestingAccessWrapper::newFromObject( $mock );
- $wrapper->queryLogger = new NullLogger();
+ foreach ( $proxiedMethods as $method => $count ) {
+ $mock->expects( is_int( $count ) ? $this->exactly( $count ) : $this->any() )
+ ->method( $method )
+ ->willReturnCallback( function ( ...$args ) use ( $method ) {
+ return call_user_func_array( [ $this->db, $method ], $args );
+ } );
+ }
return $mock;
}
<?php
-use Wikimedia\Rdbms\Database;
+use Wikimedia\Rdbms\IDatabase;
use Wikimedia\Rdbms\DBConnRef;
use Wikimedia\Rdbms\FakeResultWrapper;
-use Wikimedia\Rdbms\IDatabase;
use Wikimedia\Rdbms\ILoadBalancer;
use Wikimedia\Rdbms\ResultWrapper;
* @return IDatabase
*/
private function getDatabaseMock() {
- $db = $this->getMockBuilder( Database::class )
+ $db = $this->getMockBuilder( IDatabase::class )
->disableOriginalConstructor()
->getMock();
$db->method( 'isOpen' )->willReturnCallback( function () use ( &$open ) {
return $open;
} );
- $db->method( 'open' )->willReturnCallback( function () use ( &$open ) {
- $open = true;
-
- return $open;
- } );
- $db->method( '__toString' )->willReturn( 'MOCK_DB' );
return $db;
}
</exclude>
</whitelist>
</filter>
+ <listeners>
+ <listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener">
+ <arguments>
+ <array>
+ <element key="slowThreshold">
+ <integer>50</integer>
+ </element>
+ <element key="reportLength">
+ <integer>50</integer>
+ </element>
+ </array>
+ </arguments>
+ </listener>
+ </listeners>
</phpunit>