$this->mId = $id;
$this->mSynonyms = (array)$syn;
$this->mCaseSensitive = $cs;
- $this->contLang = $contLang;
-
- if ( !$contLang ) {
- $this->contLang = MediaWikiServices::getInstance()->getContentLanguage();
- }
+ $this->contLang = $contLang ?: MediaWikiServices::getInstance()->getContentLanguage();
}
/**
*/
public function __construct( $names = [], MagicWordFactory $factory = null ) {
$this->names = $names;
- $this->factory = $factory;
- if ( !$factory ) {
- $this->factory = MediaWikiServices::getInstance()->getMagicWordFactory();
- }
+ $this->factory = $factory ?: MediaWikiServices::getInstance()->getMagicWordFactory();
}
/**
}
}
+ /** @noinspection PhpDocSignatureInspection */
/**
* Salvages the state of any salvageable service instances in $other.
*
use MediaWiki\Block\BlockRestrictionStore;
use MediaWiki\Config\ConfigRepository;
use MediaWiki\Config\ServiceOptions;
+use MediaWiki\Http\HttpRequestFactory;
use MediaWiki\Interwiki\ClassicInterwikiLookup;
use MediaWiki\Interwiki\InterwikiLookup;
use MediaWiki\Linker\LinkRenderer;
return new DateFormatterFactory;
},
- 'DBLoadBalancer' => function ( MediaWikiServices $services ) : Wikimedia\Rdbms\LoadBalancer {
+ 'DBLoadBalancer' => function ( MediaWikiServices $services ) : Wikimedia\Rdbms\ILoadBalancer {
// just return the default LB from the DBLoadBalancerFactory service
return $services->getDBLoadBalancerFactory()->getMainLB();
},
},
'HttpRequestFactory' =>
- function ( MediaWikiServices $services ) : \MediaWiki\Http\HttpRequestFactory {
- return new \MediaWiki\Http\HttpRequestFactory();
+ function ( MediaWikiServices $services ) : HttpRequestFactory {
+ return new HttpRequestFactory();
},
'InterwikiLookup' => function ( MediaWikiServices $services ) : InterwikiLookup {
*/
public function __construct( ApiMain $main, ApiFormatBase $errorFallback = null ) {
parent::__construct( $main, 'raw' );
- if ( $errorFallback === null ) {
- $this->errorFallback = $main->createPrinterByName( $main->getParameter( 'format' ) );
- } else {
- $this->errorFallback = $errorFallback;
- }
+ $this->errorFallback = $errorFallback ?:
+ $main->createPrinterByName( $main->getParameter( 'format' ) );
}
public function getMimeType() {
$this->file = $file;
$this->reason = $reason;
$this->suppress = $suppress;
- if ( $user ) {
- $this->user = $user;
- } else {
- global $wgUser;
- $this->user = $wgUser;
- }
+ global $wgUser;
+ $this->user = $user ?: $wgUser;
$this->status = $file->repo->newGood();
}
protected function isValidIPRange( $value ) {
$cidrIPRanges = $this->mParams['iprangelimits'];
- if ( !IP::isValidBlock( $value ) ) {
+ if ( !IP::isValidRange( $value ) ) {
return false;
}
* @throws ContainerDisabledException if this container has already been destroyed.
* @throws ServiceDisabledException if the requested service has been disabled.
*
- * @return object The service instance
+ * @return mixed The service instance
*/
public function getService( $name ) {
if ( $this->destroyed ) {
* @return array Array of strings
*/
public static function titleSearch( $search, $limit, $namespaces = [], $offset = 0 ) {
- wfDeprecated( __METHOD__, '1.34' );
+ wfDeprecated( __METHOD__, '1.23' );
$prefixSearch = new StringPrefixSearch;
return $prefixSearch->search( $search, $limit, $namespaces, $offset );
}
* @param IDatabase|null $db The database to search from
*/
public function __construct( IDatabase $db = null ) {
- if ( $db ) {
- $this->db = $db;
- } else {
- $this->db = wfGetDB( DB_REPLICA );
- }
+ $this->db = $db ?: wfGetDB( DB_REPLICA );
}
/**
* search engine
*/
public function transformSearchTerm( $term ) {
- wfDeprecated( __METHOD__, '1.34' );
+ wfDeprecated( __METHOD__, '1.32' );
return $term;
}
}
/**
- * Parses the given text and constructs a TitleValue. Normalization
- * is applied according to the rules appropriate for the form specified by $form.
+ * Parses the given text and constructs a TitleValue.
*
* @param string $text The text to parse
* @param int $defaultNamespace Namespace to assume per default (usually NS_MAIN)
*/
interface TitleParser {
/**
- * Parses the given text and constructs a TitleValue. Normalization
- * is applied according to the rules appropriate for the form specified by $form.
+ * Parses the given text and constructs a TitleValue.
*
* @note this only parses local page links, interwiki-prefixes etc. are not considered!
*
// if a user was passed, use it. otherwise, attempt to use the global.
// this keeps FileRepo from breaking when it creates an UploadStash object
- if ( $user ) {
- $this->user = $user;
- } else {
- global $wgUser;
- $this->user = $wgUser;
- }
+ global $wgUser;
+ $this->user = $user ?: $wgUser;
if ( is_object( $this->user ) ) {
$this->userId = $this->user->getId();
'Badtitle' => [ 'Badtitle' ],
'Blankpage' => [ 'BlankPage' ],
'Block' => [ 'Block', 'BlockIP', 'BlockUser' ],
+ 'BlockList' => [ 'BlockList', 'ListBlocks', 'IPBlockList' ],
'Booksources' => [ 'BookSources' ],
'BotPasswords' => [ 'BotPasswords' ],
'BrokenRedirects' => [ 'BrokenRedirects' ],
'Import' => [ 'Import' ],
'Invalidateemail' => [ 'InvalidateEmail' ],
'JavaScriptTest' => [ 'JavaScriptTest' ],
- 'BlockList' => [ 'BlockList', 'ListBlocks', 'IPBlockList' ],
'LinkSearch' => [ 'LinkSearch' ],
'LinkAccounts' => [ 'LinkAccounts' ],
'Listadmins' => [ 'ListAdmins' ],
src: https://raw.githubusercontent.com/briancherne/jquery-hoverIntent/823603fdac/jquery.hoverIntent.js
integrity: sha384-lca0haN0hqFGGh2aYUhtAgX9dhVHfQnTADH4svDeM6gcXnL7aFGeAi1NYwipDMyS
-# TODO: jquery.i18n
+jquery.i18n:
+ type: tar
+ src: https://codeload.github.com/wikimedia/jquery.i18n/tar.gz/v1.0.5
+ integrity: sha384-bkmmKC2byOVjTg4di3o6sSISU49JwXynV9gNGH2zl4U9nh8vZJiauiIvoWgvhwsK
+ dest:
+ jquery.i18n-1.0.5/CODE_OF_CONDUCT.md:
+ jquery.i18n-1.0.5/CREDITS:
+ jquery.i18n-1.0.5/GPL-LICENSE:
+ jquery.i18n-1.0.5/MIT-LICENSE:
+ jquery.i18n-1.0.5/README.md:
+ jquery.i18n-1.0.5/src:
jquery.jStorage:
type: file
*/
class MagicWordFactoryTest extends MediaWikiTestCase {
private function makeMagicWordFactory( Language $contLang = null ) {
- if ( $contLang === null ) {
- return new MagicWordFactory( Language::factory( 'en' ) );
- }
- return new MagicWordFactory( $contLang );
+ return new MagicWordFactory( $contLang ?: Language::factory( 'en' ) );
}
public function testGetContentLanguage() {