id int64 0 1.29M | original_id stringlengths 32 32 | swhid stringlengths 100 170 | sha1 stringlengths 40 40 | repo_name stringlengths 2 45 | repo_group stringclasses 12
values | filepath stringlengths 5 153 | name stringlengths 1 14.9k | type stringclasses 3
values | code stringlengths 7 2.12M |
|---|---|---|---|---|---|---|---|---|---|
16,700 | a5329b0381ecca880f5e768dbdf975c5 | swh:1:cnt:6740ed86e8ab7a9d3b6b1f74a68fe1a78afa0017;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=92-123/ | 0020e06d24ea78331540d0219657df40ee90b6f7 | Babel | deployed | includes/BabelLanguageCodes.php | BabelLanguageCodes::getName( string $code, ?string $language = null ) | function | /**
* Take a code as input, and search a language name for it in
* a given language via LanguageNameUtils:getLanguageNames() or
* else via the internal Babel language names map.
*
* @param string $code Code to get name for.
* @param string|null $language Code of language to attempt to get name in,
* defa... |
16,701 | d601698ad082518ba33ef5d0dd742543 | swh:1:cnt:6740ed86e8ab7a9d3b6b1f74a68fe1a78afa0017;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=61-90/ | 0020e06d24ea78331540d0219657df40ee90b6f7 | Babel | deployed | includes/BabelLanguageCodes.php | BabelLanguageCodes::getCode( string $code ) | function | /**
* Takes a language code, and attempt to obtain a better variant of it,
* checks the MediaWiki language codes for a match, otherwise checks the
* internal Babel language codes (preferring ISO 639-1 over ISO 639-3) map.
*
* @param string $code Code to try and get a "better" code for.
* @return string|null... |
16,702 | c6ff7af7355d531c9777b157881c20b4 | swh:1:cnt:6740ed86e8ab7a9d3b6b1f74a68fe1a78afa0017;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=125-144/ | 0020e06d24ea78331540d0219657df40ee90b6f7 | Babel | deployed | includes/BabelLanguageCodes.php | BabelLanguageCodes::getCategoryCode( string $code ) | function | /**
* Return an appropriate category name, given a MediaWiki-internal
* language code. MediaWiki-internal codes are all-lowercase, but
* historically our category codes have been partially uppercase
* in the style of BCP 47. Eventually, we should probably use true
* BCP 47 for category names, but historicall... |
16,703 | 86eddf56aee3022c4af3afd351183dc6 | swh:1:cnt:e2079f6b6ae1dc95e6a4b651099226e24f820983;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=8-26/ | fb74e700f4753e652325f0f535d5b4ef96dbc906 | Babel | deployed | includes/BabelServices.php | BabelServices | type | class BabelServices {
public function __construct(
private readonly MediaWikiServices $coreServices,
) {
}
/**
* Static version of the constructor, for nicer syntax.
* @return static
*/
public static function wrap( MediaWikiServices $coreServices ) {
return new static( $coreServices );
}
public func... |
16,704 | 2636e80a88fccd175ff79e914f466a07 | swh:1:cnt:e2079f6b6ae1dc95e6a4b651099226e24f820983;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=10-13/ | fb74e700f4753e652325f0f535d5b4ef96dbc906 | Babel | deployed | includes/BabelServices.php | BabelServices::__construct(
private readonly MediaWikiServices $coreServices,
) | function | public function __construct(
private readonly MediaWikiServices $coreServices,
) {
} |
16,705 | b579db5af653e4b70a3f3c339d7185f9 | swh:1:cnt:e2079f6b6ae1dc95e6a4b651099226e24f820983;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=23-25/ | fb74e700f4753e652325f0f535d5b4ef96dbc906 | Babel | deployed | includes/BabelServices.php | BabelServices::getConfig() | function | public function getConfig(): Config {
return $this->coreServices->getService( 'Babel.Config' );
} |
16,706 | 07fded30c55f9f558f9e509482178273 | swh:1:cnt:e2079f6b6ae1dc95e6a4b651099226e24f820983;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=15-21/ | fb74e700f4753e652325f0f535d5b4ef96dbc906 | Babel | deployed | includes/BabelServices.php | BabelServices::wrap( MediaWikiServices $coreServices ) | function | /**
* Static version of the constructor, for nicer syntax.
* @return static
*/
public static function wrap( MediaWikiServices $coreServices ) {
return new static( $coreServices );
} |
16,707 | c6e315578cdda85ac6685a0fcb720f0b | swh:1:cnt:b502f19372f2daef76b28321e9fc9a02e1318683;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=29-143/ | 203b9835cd17ab6ff3313ee902a7e72c93a07580 | Babel | deployed | includes/Database.php | Database | type | class Database {
private readonly LBFactory $loadBalancerFactory;
public function __construct() {
$this->loadBalancerFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
}
/**
* @param int $index
* @param string|bool $wiki Database name if querying a different wiki
* @return IDatabase
... |
16,708 | f6efeeb87cbc9b5e0c7da6decba77e70 | swh:1:cnt:b502f19372f2daef76b28321e9fc9a02e1318683;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=32-34/ | 203b9835cd17ab6ff3313ee902a7e72c93a07580 | Babel | deployed | includes/Database.php | Database::__construct() | function | public function __construct() {
$this->loadBalancerFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
} |
16,709 | 700c577915835b706ab9c0b509e4d2e5 | swh:1:cnt:b502f19372f2daef76b28321e9fc9a02e1318683;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=90-142/ | 203b9835cd17ab6ff3313ee902a7e72c93a07580 | Babel | deployed | includes/Database.php | Database::setForUser( int $id, array $data ) | function | /**
* @param int $id
* @param string[] $data [ lang => level ]
* @return bool true if changes to the db were made
*/
public function setForUser( int $id, array $data ): bool {
$dbw = $this->getDB( DB_PRIMARY );
$newRows = [];
foreach ( $data as $lang => $level ) {
$newRows[$lang] = [
'babel_lang'... |
16,710 | 17b7c110ac11219a5675125bbd754806 | swh:1:cnt:b502f19372f2daef76b28321e9fc9a02e1318683;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=46-64/ | 203b9835cd17ab6ff3313ee902a7e72c93a07580 | Babel | deployed | includes/Database.php | Database::getForUser( int $id ) | function | /**
* @param int $id user id
* @return string[] [ lang => level ]
*/
public function getForUser( int $id ): array {
$rows = $this->getDB( DB_REPLICA )->newSelectQueryBuilder()
->select( [ 'babel_lang', 'babel_level' ] )
->from( 'babel' )
->where( [ 'babel_user' => $id ] )
->caller( __METHOD__ )
... |
16,711 | 68bee6e7d9ee4b36f8dd87fa18c544eb | swh:1:cnt:b502f19372f2daef76b28321e9fc9a02e1318683;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=66-88/ | 203b9835cd17ab6ff3313ee902a7e72c93a07580 | Babel | deployed | includes/Database.php | Database::getForRemoteUser( string $wiki, string $username ) | function | /**
* @param string $wiki Database name
* @param string $username
* @return string[] [ lang => level ]
*/
public function getForRemoteUser( string $wiki, string $username ): array {
$rows = $this->getDB( DB_REPLICA, $wiki )->newSelectQueryBuilder()
->select( [ 'babel_lang', 'babel_level' ] )
->from( 'b... |
16,712 | 6a733932b21848116f76938f8d612f48 | swh:1:cnt:b502f19372f2daef76b28321e9fc9a02e1318683;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=36-44/ | 203b9835cd17ab6ff3313ee902a7e72c93a07580 | Babel | deployed | includes/Database.php | Database::getDB( int $index, $wiki = false ) | function | /**
* @param int $index
* @param string|bool $wiki Database name if querying a different wiki
* @return IDatabase
*/
protected function getDB( int $index, $wiki = false ): IDatabase {
return $this->loadBalancerFactory->getMainLB( $wiki )
->getConnection( $index, [], $wiki );
} |
16,713 | 962d3cb1351077019a82a7d22e7273e5 | swh:1:cnt:a5f6f755cddfa88ec4e579e70121a64a964ba796;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=23-96/ | 3db3a476dd1fed7534b70b48b47d329b75bc0442 | Babel | deployed | includes/Hooks.php | Hooks | type | /**
* Hook handler functions for Babel extension.
*/
class Hooks implements
ParserFirstCallInitHook,
LinksUpdateHook,
UserGetReservedNamesHook
{
public function __construct(
private readonly Config $config,
private readonly UserIdentityLookup $userIdentityLookup,
private readonly CentralIdLookupFactory $ce... |
16,714 | ff457ec86e583820d4bc4ace010aaa49 | swh:1:cnt:a5f6f755cddfa88ec4e579e70121a64a964ba796;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=32-38/ | 3db3a476dd1fed7534b70b48b47d329b75bc0442 | Babel | deployed | includes/Hooks.php | Hooks::__construct(
private readonly Config $config,
private readonly UserIdentityLookup $userIdentityLookup,
private readonly CentralIdLookupFactory $centralIdLookupFactory,
private readonly WANObjectCache $mainWANObjectCache,
) | function | public function __construct(
private readonly Config $config,
private readonly UserIdentityLookup $userIdentityLookup,
private readonly CentralIdLookupFactory $centralIdLookupFactory,
private readonly WANObjectCache $mainWANObjectCache,
) {
} |
16,715 | 7d80d5dab1a2d4ced65f8d7edf1cd88a | swh:1:cnt:a5f6f755cddfa88ec4e579e70121a64a964ba796;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=40-47/ | 3db3a476dd1fed7534b70b48b47d329b75bc0442 | Babel | deployed | includes/Hooks.php | Hooks::onParserFirstCallInit( $parser ) | function | /**
* Registers the parser function hook.
*
* @param Parser $parser
*/
public function onParserFirstCallInit( $parser ): void {
$parser->setFunctionHook( 'babel', [ Babel::class, 'render' ] );
} |
16,716 | 9e946552fb24ce51d0a92e99de043940 | swh:1:cnt:a5f6f755cddfa88ec4e579e70121a64a964ba796;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=90-95/ | 3db3a476dd1fed7534b70b48b47d329b75bc0442 | Babel | deployed | includes/Hooks.php | Hooks::onUserGetReservedNames( &$names ) | function | /**
* @param array &$names
*/
public function onUserGetReservedNames( &$names ): void {
$names[] = 'msg:' . BabelAutoCreate::MSG_USERNAME;
} |
16,717 | 36307b2726bd7687aa6a9b249666b520 | swh:1:cnt:a5f6f755cddfa88ec4e579e70121a64a964ba796;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=49-88/ | 3db3a476dd1fed7534b70b48b47d329b75bc0442 | Babel | deployed | includes/Hooks.php | Hooks::onLinksUpdate( $linksUpdate ) | function | /**
* @param LinksUpdate $linksUpdate
*/
public function onLinksUpdate( $linksUpdate ): void {
$title = $linksUpdate->getTitle();
$toCreate = $linksUpdate->getParserOutput()->getExtensionData( 'babel-tocreate' ) ?: [];
// Create categories
foreach ( $toCreate as $category => $value ) {
$text = $linksUp... |
16,718 | ad424ddee1aff0bd46e6db95a9ad120a | swh:1:cnt:a8cac02744c883d6171997dd8a48dd1ce91794e1;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=16-54/ | c182ebfd643d4f463beb85e3499604bdbe057965 | Babel | deployed | includes/SchemaHooks.php | SchemaHooks | type | class SchemaHooks implements LoadExtensionSchemaUpdatesHook {
/**
* @param DatabaseUpdater $updater
*/
public function onLoadExtensionSchemaUpdates( $updater ): void {
$dir = dirname( __DIR__ ) . '/sql/';
$dbType = $updater->getDB()->getType();
if ( $dbType === 'mysql' ) {
$updater->addExtensionTable( '... |
16,719 | 7bb24b5c58e22fede271a14f633d7ef5 | swh:1:cnt:a8cac02744c883d6171997dd8a48dd1ce91794e1;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=17-53/ | c182ebfd643d4f463beb85e3499604bdbe057965 | Babel | deployed | includes/SchemaHooks.php | SchemaHooks::onLoadExtensionSchemaUpdates( $updater ) | function | /**
* @param DatabaseUpdater $updater
*/
public function onLoadExtensionSchemaUpdates( $updater ): void {
$dir = dirname( __DIR__ ) . '/sql/';
$dbType = $updater->getDB()->getType();
if ( $dbType === 'mysql' ) {
$updater->addExtensionTable( 'babel',
$dir . 'tables-generated.sql'
);
$updater->mo... |
16,720 | 3739d40f30bed6f7519b36d30f706ccd | swh:1:cnt:eee87f16427b3b8105eb6a132befa6824ad56c80;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=8-14/ | 400e8c9190edc7f9a2bd3463d1ab67c9b707d1f5 | Babel | deployed | includes/Utils.php | Utils | type | class Utils {
public static function useCommunityConfiguration(): bool {
return ExtensionRegistry::getInstance()->isLoaded( 'CommunityConfiguration' ) &&
MediaWikiServices::getInstance()->getMainConfig()->get( 'BabelUseCommunityConfiguration' );
}
} |
16,721 | d6cf8d619cd2f0db3440186f313fb864 | swh:1:cnt:eee87f16427b3b8105eb6a132befa6824ad56c80;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=10-13/ | 400e8c9190edc7f9a2bd3463d1ab67c9b707d1f5 | Babel | deployed | includes/Utils.php | Utils::useCommunityConfiguration() | function | public static function useCommunityConfiguration(): bool {
return ExtensionRegistry::getInstance()->isLoaded( 'CommunityConfiguration' ) &&
MediaWikiServices::getInstance()->getMainConfig()->get( 'BabelUseCommunityConfiguration' );
} |
16,722 | 60a72c9f6ecca3a5ef1dfd31ca8a7d25 | swh:1:cnt:ea1203e62e95e91221e644012b7caee6aad075f7;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=15-34/ | 5714c2893ab0354101321ed4e11f4fe2c67920a1 | Babel | deployed | includes/BabelBox/BabelBox.php | BabelBox | type | /**
* Interface for babel boxes.
*/
interface BabelBox {
/**
* Return the babel box code.
*
* @return string HTML
*/
public function render(): string;
/**
* Adds categories to the given ParserOutput.
*
* @param ParserOutput $output Parser output to add categories to
*/
public function addCategor... |
16,723 | 8ed7afcb17157fa1ba18643c52c07d33 | swh:1:cnt:ea1203e62e95e91221e644012b7caee6aad075f7;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=20-25/ | 5714c2893ab0354101321ed4e11f4fe2c67920a1 | Babel | deployed | includes/BabelBox/BabelBox.php | BabelBox::render() | function | /**
* Return the babel box code.
*
* @return string HTML
*/
public function render(): string; |
16,724 | f35f9779bec881797f2fa3da1e8b37e7 | swh:1:cnt:ea1203e62e95e91221e644012b7caee6aad075f7;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=27-32/ | 5714c2893ab0354101321ed4e11f4fe2c67920a1 | Babel | deployed | includes/BabelBox/BabelBox.php | BabelBox::addCategories( ParserOutput $output ) | function | /**
* Adds categories to the given ParserOutput.
*
* @param ParserOutput $output Parser output to add categories to
*/
public function addCategories( ParserOutput $output ): void; |
16,725 | 8a9db25eeb80ecc0143da5778114fcfc | swh:1:cnt:a826d4d9182920e70068b3d779d0a1806b026e77;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=31-284/ | d7b4534e554584e13fa6420129e2491e1382d39f | Babel | deployed | includes/BabelBox/LanguageBabelBox.php | LanguageBabelBox | type | /**
* Class for babel language boxes.
*/
class LanguageBabelBox implements BabelBox {
private readonly string $code;
/**
* Construct a babel box for the given language and level.
*
* @param Config $config
* @param PageReference $page
* @param Language $targetLanguage Target language of the parse.
* @p... |
16,726 | 758f14a611ee587739fc0c8d983411ba | swh:1:cnt:a826d4d9182920e70068b3d779d0a1806b026e77;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=38-56/ | d7b4534e554584e13fa6420129e2491e1382d39f | Babel | deployed | includes/BabelBox/LanguageBabelBox.php | LanguageBabelBox::__construct(
private readonly Config $config,
private readonly PageReference $page,
private readonly Language $targetLanguage,
string $code,
private readonly string $level,
) | function | /**
* Construct a babel box for the given language and level.
*
* @param Config $config
* @param PageReference $page
* @param Language $targetLanguage Target language of the parse.
* @param string $code Language code to use.
* This is a mediawiki-internal code (not necessarily a valid BCP-47 code)
* @... |
16,727 | 05a7975cae8eed1c91b0fc381594d705 | swh:1:cnt:a826d4d9182920e70068b3d779d0a1806b026e77;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=103-151/ | d7b4534e554584e13fa6420129e2491e1382d39f | Babel | deployed | includes/BabelBox/LanguageBabelBox.php | LanguageBabelBox::getText(
PageReference $page,
string $name,
string $code,
string $level
) | function | /**
* Get the text to display in the language box for specific language and
* level. If MediaWiki:Babel-<level>-n (the message that includes the
* language autonym) is translated into the given language, use that
* otherwise use MediaWiki:Babel-<level> (the message that takes the
* language name as a paramete... |
16,728 | 8d164a69c62d10b2cf443943af22cf4f | swh:1:cnt:a826d4d9182920e70068b3d779d0a1806b026e77;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=153-182/ | d7b4534e554584e13fa6420129e2491e1382d39f | Babel | deployed | includes/BabelBox/LanguageBabelBox.php | LanguageBabelBox::addCategories( ParserOutput $parserOutput ) | function | /**
* Add appropriate categories for the language box to the given parser output
*
* @param ParserOutput $parserOutput Output to add categories to
*/
public function addCategories( ParserOutput $parserOutput ): void {
$namespaces = $this->config->get( 'BabelCategorizeNamespaces' );
if (
$namespaces !== ... |
16,729 | 7571e0b27ccb8695f900934ee4f11d55 | swh:1:cnt:a826d4d9182920e70068b3d779d0a1806b026e77;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=68-101/ | d7b4534e554584e13fa6420129e2491e1382d39f | Babel | deployed | includes/BabelBox/LanguageBabelBox.php | LanguageBabelBox::render() | function | /**
* Return the babel box code.
*
* @return string A babel box for the given language and level.
*/
public function render(): string {
$code = $this->code;
$catCode = BabelLanguageCodes::getCategoryCode( $code );
$bcp47 = LanguageCode::bcp47( $code );
$portal = wfMessage( 'babel-portal', $catCode )->... |
16,730 | 7d25e81af588e87fa720a1902c13e577 | swh:1:cnt:a826d4d9182920e70068b3d779d0a1806b026e77;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=58-66/ | d7b4534e554584e13fa6420129e2491e1382d39f | Babel | deployed | includes/BabelBox/LanguageBabelBox.php | LanguageBabelBox::getConfig() | function | /**
* Get a Config instance to use
*
* @todo Use proper Dependency Injection.
* @return Config
*/
private static function getConfig(): Config {
return BabelServices::wrap( MediaWikiServices::getInstance() )->getConfig();
} |
16,731 | cc56d05ea94b15f410a2259fce0e0144 | swh:1:cnt:a826d4d9182920e70068b3d779d0a1806b026e77;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=184-218/ | d7b4534e554584e13fa6420129e2491e1382d39f | Babel | deployed | includes/BabelBox/LanguageBabelBox.php | LanguageBabelBox::addCategory( ParserOutput $parserOutput,
string $code, ?string $level, $sortkey, ?string $parent
) | function | /**
* Adds one category to the given ParserOutput, and arranges for its creation if it doesn't exist.
*
* @param ParserOutput $parserOutput Parser output to use
* @param string $code Code of language that the category is for.
* @param string|null $level Level that the category is for.
* @param string|bool $... |
16,732 | c1faf5c93607a290a088d7317067188a | swh:1:cnt:a826d4d9182920e70068b3d779d0a1806b026e77;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=220-266/ | d7b4534e554584e13fa6420129e2491e1382d39f | Babel | deployed | includes/BabelBox/LanguageBabelBox.php | LanguageBabelBox::getCategoryName( ?string $level, string $code, bool &$isOverridden ) | function | /**
* Replace the placeholder variables from the category names configuration
* array with actual values.
*
* @param ?string $level Level of babel category in question, or null for the main category
* @param string $code Mediawiki-internal language code of category.
* @param bool &$isOverridden Output param... |
16,733 | d6f82e0e724722f895c573598c94b9d2 | swh:1:cnt:a826d4d9182920e70068b3d779d0a1806b026e77;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=268-283/ | d7b4534e554584e13fa6420129e2491e1382d39f | Babel | deployed | includes/BabelBox/LanguageBabelBox.php | LanguageBabelBox::getCategoryLink( PageReference $page, ?string $level, string $code ) | function | /**
* Returns the right link target for a category (either the category itself or the
* title given to get a self-link)
* @param PageReference $page The page to point the self-link to
* @param ?string $level Level of babel category in question, or null for the main category
* @param string $code Mediawiki-int... |
16,734 | 9d26c6abf130f25e0a0325d7a37b8869 | swh:1:cnt:c7a1c89732ba5e0cfcd4b8edfefb2a123b0f1f17;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=22-52/ | f47263299fc6340da33322f64230ace23f60486d | Babel | deployed | includes/BabelBox/NotBabelBox.php | NotBabelBox | type | /**
* Class for inner items which are not babel boxes.
*/
class NotBabelBox implements BabelBox {
/**
* Construct a non-babel box.
*
* @param string $dir HTML 'dir' attribute
* @param string $content What's inside the box, in wikitext format.
*/
public function __construct(
private readonly string $dir,... |
16,735 | f8b463b2834b9c344bddf6887fcd6ab1 | swh:1:cnt:c7a1c89732ba5e0cfcd4b8edfefb2a123b0f1f17;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=26-36/ | f47263299fc6340da33322f64230ace23f60486d | Babel | deployed | includes/BabelBox/NotBabelBox.php | NotBabelBox::__construct(
private readonly string $dir,
private readonly string $content,
) | function | /**
* Construct a non-babel box.
*
* @param string $dir HTML 'dir' attribute
* @param string $content What's inside the box, in wikitext format.
*/
public function __construct(
private readonly string $dir,
private readonly string $content,
) {
} |
16,736 | 81eb0ff89f3cd7f9241f705b480e7f72 | swh:1:cnt:c7a1c89732ba5e0cfcd4b8edfefb2a123b0f1f17;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=38-47/ | f47263299fc6340da33322f64230ace23f60486d | Babel | deployed | includes/BabelBox/NotBabelBox.php | NotBabelBox::render() | function | /**
* Return the babel box code.
*
* @return string A single non-babel box, in wikitext format.
*/
public function render(): string {
return <<<EOT
<div class="mw-babel-notabox" dir="{$this->dir}">{$this->content}</div>
EOT;
} |
16,737 | 032eac38f1fe4b5fc723770d35508dd0 | swh:1:cnt:c7a1c89732ba5e0cfcd4b8edfefb2a123b0f1f17;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=49-50/ | f47263299fc6340da33322f64230ace23f60486d | Babel | deployed | includes/BabelBox/NotBabelBox.php | NotBabelBox::addCategories( ParserOutput $parserOutput ) | function | public function addCategories( ParserOutput $parserOutput ): void {
} |
16,738 | 74fe52e5a0154c0b979eba90520829a4 | swh:1:cnt:f3694b222410f7edd2f1ca04164ddec57a99df8e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=15-32/ | 8e54f56a5e47164e824bf94ac9a3bf6e32d73ec4 | Babel | deployed | includes/BabelBox/NullBabelBox.php | NullBabelBox | type | /**
* Class for inner items which render as empty strings.
*/
class NullBabelBox implements BabelBox {
/**
* Return the babel box code.
*
* @return string Empty string
*/
public function render(): string {
return '';
}
public function addCategories( ParserOutput $parserOutput ): void {
}
} |
16,739 | f0cb0dac3e2b31a630dded02f4f9c8a7 | swh:1:cnt:f3694b222410f7edd2f1ca04164ddec57a99df8e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=20-27/ | 8e54f56a5e47164e824bf94ac9a3bf6e32d73ec4 | Babel | deployed | includes/BabelBox/NullBabelBox.php | NullBabelBox::render() | function | /**
* Return the babel box code.
*
* @return string Empty string
*/
public function render(): string {
return '';
} |
16,740 | 032eac38f1fe4b5fc723770d35508dd0 | swh:1:cnt:f3694b222410f7edd2f1ca04164ddec57a99df8e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=29-30/ | 8e54f56a5e47164e824bf94ac9a3bf6e32d73ec4 | Babel | deployed | includes/BabelBox/NullBabelBox.php | NullBabelBox::addCategories( ParserOutput $parserOutput ) | function | public function addCategories( ParserOutput $parserOutput ): void {
} |
16,741 | 24dbed59421c060e92507af1f3aa2c59 | swh:1:cnt:1bd85dca295e070f322062b548040e079415ae3c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=7-59/ | baa344b8361dd8d075d611a02a86335d1860a45c | Babel | deployed | includes/Config/BabelSchema.php | BabelSchema | type | // phpcs:disable Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase
class BabelSchema extends JsonSchema {
public const VERSION = '1.0.0';
public const BabelCategoryNames = [
self::TYPE => self::TYPE_OBJECT,
self::PROPERTIES => [
'0' => [
self::TYPE => self::TYPE_STRING,
self::D... |
16,742 | 7716cf3227e909df1ddc3cff53f96de2 | swh:1:cnt:2b71aab0fc6dcf4636f087fe7c93545156b15617;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=8-25/ | 7871d15912c44e1237fb9a08d1bd9fda335ecc0f | Babel | deployed | includes/Config/CommunityConfigurationHooks.php | CommunityConfigurationHooks | type | /**
* Hooks for CommunityConfiguration
*
* @note Needs to be separate from Hooks to keep CommunityConfiguration a soft dependency.
*/
class CommunityConfigurationHooks implements CommunityConfigurationProvider_initListHook {
/**
* @inheritDoc
*/
public function onCommunityConfigurationProvider_initList( arra... |
16,743 | b1de69c89d39869bc759bd4931c92030 | swh:1:cnt:2b71aab0fc6dcf4636f087fe7c93545156b15617;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=15-24/ | 7871d15912c44e1237fb9a08d1bd9fda335ecc0f | Babel | deployed | includes/Config/CommunityConfigurationHooks.php | CommunityConfigurationHooks::onCommunityConfigurationProvider_initList( array &$providers ) | function | /**
* @inheritDoc
*/
public function onCommunityConfigurationProvider_initList( array &$providers ) {
if ( !Utils::useCommunityConfiguration() ) {
// Do not show the Babel provider in the dashboard when CommunityConfiguration is not in
// use (to avoid user confusion).
unset( $providers['Babel'] );
}
... |
16,744 | f14fb5d0f6ed875a5791eebc2831de42 | swh:1:cnt:9503c89ec590cb7c12aa3ed0682109802b6a2a72;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=10-36/ | c6192ddd879355d0ea3ee2f4f6e5c78798fe932d | Babel | deployed | includes/Config/ConfigWrapper.php | ConfigWrapper | type | class ConfigWrapper implements Config {
public function __construct(
private readonly MediaWikiConfigRouter $configRouter,
) {
}
/**
* @inheritDoc
*/
public function get( $name ) {
$value = $this->configRouter->get( $name );
if ( is_object( $value ) ) {
// CommunityConfiguration passes objects inste... |
16,745 | 811c0d46093f54d8bb6e9274f56badee | swh:1:cnt:9503c89ec590cb7c12aa3ed0682109802b6a2a72;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=12-15/ | c6192ddd879355d0ea3ee2f4f6e5c78798fe932d | Babel | deployed | includes/Config/ConfigWrapper.php | ConfigWrapper::__construct(
private readonly MediaWikiConfigRouter $configRouter,
) | function | public function __construct(
private readonly MediaWikiConfigRouter $configRouter,
) {
} |
16,746 | a7f5ad4182ebc80617d2efa715f4823f | swh:1:cnt:9503c89ec590cb7c12aa3ed0682109802b6a2a72;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=30-35/ | c6192ddd879355d0ea3ee2f4f6e5c78798fe932d | Babel | deployed | includes/Config/ConfigWrapper.php | ConfigWrapper::has( $name ) | function | /**
* @inheritDoc
*/
public function has( $name ): bool {
return $this->configRouter->has( $name );
} |
16,747 | 835c5fd022d970a539e41406e03f793a | swh:1:cnt:9503c89ec590cb7c12aa3ed0682109802b6a2a72;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=17-28/ | c6192ddd879355d0ea3ee2f4f6e5c78798fe932d | Babel | deployed | includes/Config/ConfigWrapper.php | ConfigWrapper::get( $name ) | function | /**
* @inheritDoc
*/
public function get( $name ) {
$value = $this->configRouter->get( $name );
if ( is_object( $value ) ) {
// CommunityConfiguration passes objects instead of associative arrays (which Babel
// expects). This affects eg. BabelCategoryNames. See T369608.
$value = wfObjectToArray( $val... |
16,748 | 302844baef7cc76442ecaf9f90b5353a | swh:1:cnt:5c418052a7402d5b94d19ce5ad6ef4cf6a6dac12;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=21-113/ | b5ea22953a0987f4cdb32015973d971baef2cfe9 | Babel | deployed | maintenance/migrateConfigToCommunity.php | MigrateConfigToCommunity | type | // @codeCoverageIgnoreEnd
class MigrateConfigToCommunity extends LoggedUpdateMaintenance {
private StatusFormatter $statusFormatter;
private ConfigurationProviderFactory $providerFactory;
public function __construct() {
parent::__construct();
$this->requireExtension( 'Babel' );
$this->requireExtension( 'Co... |
16,749 | ca0a2d467cd261da577637733b021e90 | swh:1:cnt:5c418052a7402d5b94d19ce5ad6ef4cf6a6dac12;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=28-41/ | b5ea22953a0987f4cdb32015973d971baef2cfe9 | Babel | deployed | maintenance/migrateConfigToCommunity.php | MigrateConfigToCommunity::__construct() | function | public function __construct() {
parent::__construct();
$this->requireExtension( 'Babel' );
$this->requireExtension( 'CommunityConfiguration' );
$this->addOption( 'dry-run', 'Print the migration summary.' );
$this->addOption(
'summary-note',
'A note to be included in the edit summary (for example, a li... |
16,750 | 143060330621b90fc86f69d282ad1c34 | swh:1:cnt:5c418052a7402d5b94d19ce5ad6ef4cf6a6dac12;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=107-112/ | b5ea22953a0987f4cdb32015973d971baef2cfe9 | Babel | deployed | maintenance/migrateConfigToCommunity.php | MigrateConfigToCommunity::getUpdateKey() | function | /**
* @inheritDoc
*/
protected function getUpdateKey() {
return 'BabelMigrateConfigToCommunity';
} |
16,751 | b2a20c0064e4ddcc16257218bf4392c8 | swh:1:cnt:5c418052a7402d5b94d19ce5ad6ef4cf6a6dac12;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=43-50/ | b5ea22953a0987f4cdb32015973d971baef2cfe9 | Babel | deployed | maintenance/migrateConfigToCommunity.php | MigrateConfigToCommunity::initServices() | function | private function initServices(): void {
$services = $this->getServiceContainer();
$this->statusFormatter = $services->getFormatterFactory()
->getStatusFormatter( RequestContext::getMain() );
$ccServices = CommunityConfigurationServices::wrap( $this->getServiceContainer() );
$this->providerFactory = $ccServi... |
16,752 | 79e26710474fd607d071bbad685ae97c | swh:1:cnt:5c418052a7402d5b94d19ce5ad6ef4cf6a6dac12;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=52-105/ | b5ea22953a0987f4cdb32015973d971baef2cfe9 | Babel | deployed | maintenance/migrateConfigToCommunity.php | MigrateConfigToCommunity::doDBUpdates() | function | /** @inheritDoc */
protected function doDBUpdates(): LoggedUpdateOutcome {
$this->initServices();
if ( !$this->providerFactory->isProviderSupported( 'Babel' ) ) {
$this->fatalError(
'The `Babel` CommunityConfiguration provider is not supported; ' .
'maybe BabelUseCommunityConfiguration is not set to tr... |
16,753 | da59724c3c2c414c75fcea9cd3ae06bb | swh:1:cnt:8702eb42ef541921378fe3a95a6f0b95819e9144;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=12-72/ | 1c5ca86404b3bc33107e1c106f62845478c4c593 | Babel | deployed | tests/phpunit/BabelAutoCreateTest.php | BabelAutoCreateTest | type | /**
* @covers \MediaWiki\Babel\BabelAutoCreate
*
* @group Babel
* @group Database
*
* @license GPL-2.0-or-later
* @author Thiemo Kreuz
*/
class BabelAutoCreateTest extends MediaWikiIntegrationTestCase {
protected function setUp(): void {
parent::setUp();
$this->overrideConfigValue( MainConfigNames::Langu... |
16,754 | 50e0ee1008fc1bf48b8af1a801c685b1 | swh:1:cnt:8702eb42ef541921378fe3a95a6f0b95819e9144;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=23-27/ | 1c5ca86404b3bc33107e1c106f62845478c4c593 | Babel | deployed | tests/phpunit/BabelAutoCreateTest.php | BabelAutoCreateTest::setUp() | function | protected function setUp(): void {
parent::setUp();
$this->overrideConfigValue( MainConfigNames::LanguageCode, 'qqx' );
} |
16,755 | 2e1641b28d672d8a9a9050d9f5884e57 | swh:1:cnt:8702eb42ef541921378fe3a95a6f0b95819e9144;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=41-56/ | 1c5ca86404b3bc33107e1c106f62845478c4c593 | Babel | deployed | tests/phpunit/BabelAutoCreateTest.php | BabelAutoCreateTest::getCategoryTextProvider() | function | public static function getCategoryTextProvider(): array {
return [
[
'en', null, 'top',
'(babel-autocreate-text-main: English, en, [[Category:top|en]])'
],
[
'en', 'level-2', 'en',
'(babel-autocreate-text-levels: level-2, English, en, [[Category:en|level-2]])'
],
[
'en', 'level-2', ... |
16,756 | 925e9a5b51b0b4b85b0906cda381fb96 | swh:1:cnt:8702eb42ef541921378fe3a95a6f0b95819e9144;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=63-70/ | 1c5ca86404b3bc33107e1c106f62845478c4c593 | Babel | deployed | tests/phpunit/BabelAutoCreateTest.php | BabelAutoCreateTest::testCreate() | function | public function testCreate() {
BabelAutoCreate::create( 'categoryname', 'category text' );
$page = $this->getServiceContainer()->getWikiPageFactory()->newFromTitle(
Title::newFromText( 'Category:categoryname' )
);
$this->assertTrue( $page->exists() );
$this->assertSame( 'category text', $page->getContent()... |
16,757 | 1e034480b7e68691040ff9a82fdd2eb6 | swh:1:cnt:8702eb42ef541921378fe3a95a6f0b95819e9144;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=58-61/ | 1c5ca86404b3bc33107e1c106f62845478c4c593 | Babel | deployed | tests/phpunit/BabelAutoCreateTest.php | BabelAutoCreateTest::testUser() | function | public function testUser(): void {
$user = BabelAutoCreate::user();
$this->assertInstanceOf( User::class, $user );
} |
16,758 | 1693a0bf8cd2d61f463721bc8cdc9213 | swh:1:cnt:8702eb42ef541921378fe3a95a6f0b95819e9144;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=29-39/ | 1c5ca86404b3bc33107e1c106f62845478c4c593 | Babel | deployed | tests/phpunit/BabelAutoCreateTest.php | BabelAutoCreateTest::testGetCategoryText(
string $code,
?string $level,
?string $parent,
string $expected
) | function | /**
* @dataProvider getCategoryTextProvider
*/
public function testGetCategoryText(
string $code,
?string $level,
?string $parent,
string $expected
): void {
$this->assertEquals( $expected, BabelAutoCreate::getCategoryText( $code, $level, $parent ) );
} |
16,759 | a4301b87157c7188c15f64a7699dd544 | swh:1:cnt:0ae3ad974eb883715a719df407af865d2deb3f0d;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=10-85/ | 7219ebd444ff271d534c91937ba84b26786a2b3b | Babel | deployed | tests/phpunit/BabelLanguageCodesTest.php | BabelLanguageCodesTest | type | /**
* @covers \MediaWiki\Babel\BabelLanguageCodes
*
* @group Babel
*
* @license GPL-2.0-or-later
* @author Thiemo Kreuz
*/
class BabelLanguageCodesTest extends TestCase {
/**
* @dataProvider getCodeProvider
*/
public function testGetCode( string $code, $expected ): void {
$this->assertSame( $expected, B... |
16,760 | e8d2f5d97560a79dafa38a1cbe1118af | swh:1:cnt:0ae3ad974eb883715a719df407af865d2deb3f0d;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=20-25/ | 7219ebd444ff271d534c91937ba84b26786a2b3b | Babel | deployed | tests/phpunit/BabelLanguageCodesTest.php | BabelLanguageCodesTest::testGetCode( string $code, $expected ) | function | /**
* @dataProvider getCodeProvider
*/
public function testGetCode( string $code, $expected ): void {
$this->assertSame( $expected, BabelLanguageCodes::getCode( $code ) );
} |
16,761 | 8a0dded58681f89c60224280d2d476cb | swh:1:cnt:0ae3ad974eb883715a719df407af865d2deb3f0d;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=27-48/ | 7219ebd444ff271d534c91937ba84b26786a2b3b | Babel | deployed | tests/phpunit/BabelLanguageCodesTest.php | BabelLanguageCodesTest::getCodeProvider() | function | public static function getCodeProvider(): array {
$testData = [
[ 'invalidLanguageCode', null ],
[ 'en', 'en' ],
[ 'eng', 'en' ],
[ 'en-gb', 'en-gb' ],
[ 'de', 'de' ],
[ 'be-x-old', 'be-tarask' ],
// Make sure this special case gets handled properly, instead of returning an unrecognized code
[... |
16,762 | 77fd72a225b358ae37cae2247358eb12 | swh:1:cnt:0ae3ad974eb883715a719df407af865d2deb3f0d;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=50-55/ | 7219ebd444ff271d534c91937ba84b26786a2b3b | Babel | deployed | tests/phpunit/BabelLanguageCodesTest.php | BabelLanguageCodesTest::testGetName( string $code, ?string $language, $expected ) | function | /**
* @dataProvider getNameProvider
*/
public function testGetName( string $code, ?string $language, $expected ): void {
$this->assertSame( $expected, BabelLanguageCodes::getName( $code, $language ) );
} |
16,763 | b77cfca8c99cf0736d445d0c73c369d5 | swh:1:cnt:0ae3ad974eb883715a719df407af865d2deb3f0d;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=57-67/ | 7219ebd444ff271d534c91937ba84b26786a2b3b | Babel | deployed | tests/phpunit/BabelLanguageCodesTest.php | BabelLanguageCodesTest::getNameProvider() | function | public static function getNameProvider(): array {
return [
[ 'invalidLanguageCode', null, false ],
[ 'en', null, 'English' ],
[ 'en', 'en', 'English' ],
[ 'eng', null, 'English' ],
[ 'en-gb', null, 'British English' ],
[ 'de', null, 'Deutsch' ],
[ 'aaq', null, 'Eastern Abnaki' ],
];
} |
16,764 | d47af59d90821b14a023740d20d64a49 | swh:1:cnt:0ae3ad974eb883715a719df407af865d2deb3f0d;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=69-74/ | 7219ebd444ff271d534c91937ba84b26786a2b3b | Babel | deployed | tests/phpunit/BabelLanguageCodesTest.php | BabelLanguageCodesTest::testGetCategoryCode( string $code, string $expected ) | function | /**
* @dataProvider getCategoryCodeProvider
*/
public function testGetCategoryCode( string $code, string $expected ): void {
$this->assertSame( $expected, BabelLanguageCodes::getCategoryCode( $code ) );
} |
16,765 | 253ef0818f9ccca363171eb10c201edd | swh:1:cnt:0ae3ad974eb883715a719df407af865d2deb3f0d;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=76-83/ | 7219ebd444ff271d534c91937ba84b26786a2b3b | Babel | deployed | tests/phpunit/BabelLanguageCodesTest.php | BabelLanguageCodesTest::getCategoryCodeProvider() | function | public static function getCategoryCodeProvider(): array {
return [
[ 'en', 'en' ],
[ 'de', 'de' ],
[ 'simple', 'simple' ],
[ 'zh-hant', 'zh-Hant' ],
];
} |
16,766 | a52795f7842712d02ef4fcb4f1c9320b | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=17-401/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest | type | /**
* @covers \MediaWiki\Babel\Babel
*
* @group Babel
* @group Database
*
* @license GPL-2.0-or-later
* @author Thiemo Kreuz
*/
class BabelTest extends MediaWikiIntegrationTestCase {
use LinkCacheTestTrait;
public function addDBDataOnce(): void {
$services = $this->getServiceContainer();
$user = $service... |
16,767 | f8a37857222063cecf148eee6f0a1fe3 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=36-46/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::setUp() | function | protected function setUp(): void {
parent::setUp();
$this->overrideConfigValues( [
// Individual tests may change these
'BabelAllowOverride' => false,
'BabelCentralDb' => false,
MainConfigNames::CapitalLinks => false,
MainConfigNames::LanguageCode => 'qqx',
] );
} |
16,768 | c23d0ba65b748c450d242029177b7029 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=81-87/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::assertNotHasCategory( Parser $parser, string $cat ) | function | /**
* @param Parser $parser
* @param string $cat
*/
private function assertNotHasCategory( Parser $parser, string $cat ): void {
$this->assertNotContains( $cat, $parser->getOutput()->getCategoryNames() );
} |
16,769 | 7a5c2022904a301275397154d32ad089 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=89-102/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testRenderEmptyBox() | function | public function testRenderEmptyBox(): void {
$title = Title::newFromText( 'User:User-1' );
$parser = $this->getParser( $title );
$wikiText = Babel::render( $parser, '' );
$this->assertSame(
'{|class="mw-babel-wrapper"'
. "\n"
. '! class="mw-babel-header" | [[(babel-url)|(babel: User-1)]]'
. "\n|-\n|... |
16,770 | 78d9575b859c7f0aefb47efb34d5a3e7 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=169-209/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testRenderCustomLevel() | function | public function testRenderCustomLevel(): void {
$parser = $this->getParser( Title::newFromText( 'User:User-1' ) );
$wikiText = Babel::render( $parser, 'EN-1', 'zh-Hant' );
$this->assertBabelBoxCount( 2, $wikiText );
$this->assertStringContainsString(
'<div class="mw-babel-box mw-babel-box-1 mw-babel-box-en" ... |
16,771 | 776bb7ea799d6fb9fa215abada1efd6c | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=71-79/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::assertHasCategory( Parser $parser, string $cat, string $sortKey ) | function | /**
* @param Parser $parser
* @param string $cat
* @param string $sortKey
*/
private function assertHasCategory( Parser $parser, string $cat, string $sortKey ): void {
$this->assertContains( $cat, $parser->getOutput()->getCategoryNames() );
$this->assertSame( $sortKey, $parser->getOutput()->getCategorySort... |
16,772 | 9d0e2c181ca23b67f7b5b66725d2aec8 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=104-112/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::providePageNames() | function | /**
* Provides different page names, such as pages in the Category namespace.
*/
public static function providePageNames(): array {
return [
[ 'User:User-1' ],
[ 'Category:X1' ],
];
} |
16,773 | bc504206668cbc45e4a028acff56e25d | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=114-138/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testRenderDefaultLevel( string $pageName ) | function | /**
* @dataProvider providePageNames
*/
public function testRenderDefaultLevel( string $pageName ): void {
$parser = $this->getParser( Title::newFromText( $pageName ) );
$wikiText = Babel::render( $parser, 'en' );
$this->assertBabelBoxCount( 1, $wikiText );
$this->assertStringContainsString(
'<div class... |
16,774 | 0e96d45b0110d6d72286901a3738e2fe | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=337-352/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testCategoryOverride() | function | public function testCategoryOverride(): void {
$this->overrideConfigValue( 'BabelAllowOverride', true );
$title = Title::newFromText( 'User:User-1' );
$parser = $this->getParser( $title );
$wikiText = Babel::render( $parser, 'en-1' );
$this->assertStringContainsString( "babel-category-override:_en-1,_en,_1", ... |
16,775 | b9f2e508a15945327f072af304412f53 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=354-356/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::provideInvalidTitles() | function | public static function provideInvalidTitles(): array {
return [ [ "<><><" ], [ "" ], [ "foo|bar" ] ];
} |
16,776 | 24205cdeb03523ebaad5bd9191d415c5 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=376-384/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testOverrideMessage() | function | public function testOverrideMessage(): void {
$this->overrideConfigValue( MainConfigNames::LanguageCode, 'en' );
$this->getServiceContainer()->getService( "MessageCache" )->enable();
$this->insertPage( "MediaWiki:Babel-1-n", "Overridden message" );
$title = Title::newFromText( 'User:User-1' );
$parser = $this... |
16,777 | 651695605d5168ca005bf8d75336e320 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=63-69/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::assertBabelBoxCount( int $expectedCount, string $haystack ) | function | /**
* @param int $expectedCount
* @param string $haystack
*/
private function assertBabelBoxCount( int $expectedCount, string $haystack ): void {
$this->assertSame( $expectedCount, substr_count( $haystack, '<div class="mw-babel-box' ) );
} |
16,778 | a518bc6886939ccc4bac7b9c393982a3 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=274-282/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testRenderInvalidTitle() | function | public function testRenderInvalidTitle(): void {
$parser = $this->getParser( Title::newFromText( 'User:User-1' ) );
$wikiText = Babel::render( $parser, '<invalidTitle>' );
$this->assertBabelBoxCount( 0, $wikiText );
$this->assertStringContainsString(
'<div class="mw-babel-notabox" dir="ltr">(babel-template: ... |
16,779 | 3bab4f61ebf6af151cfc902070c08476 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=290-320/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testGetUserLanguages() | function | public function testGetUserLanguages(): void {
$services = $this->getServiceContainer();
$userIdentity = $services->getUserIdentityLookup()->getUserIdentityByName( 'User-1' );
// Sorted by language code
$this->assertSame( [
'de',
'en',
'es',
'simple',
'zh-Hant',
], Babel::getUserLanguages( $us... |
16,780 | fcf594d2cad8b554b9eb481d3e691b30 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=358-374/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testFailedOverride( $invalidTitle ) | function | /**
* @dataProvider provideInvalidTitles
*/
public function testFailedOverride( $invalidTitle ): void {
$this->overrideConfigValues( [
'BabelAllowOverride' => true,
MainConfigNames::LanguageCode => 'en',
] );
$this->getServiceContainer()->getService( "MessageCache" )->enable();
$this->insertPage( "Me... |
16,781 | a1b49de09b43b1014ba991aedea35314 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=386-392/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testAutoCreationEnabled() | function | public function testAutoCreationEnabled(): void {
$this->overrideConfigValue( 'BabelAutoCreate', true );
$title = Title::newFromText( 'User:User-1' );
$parser = $this->getParser( $title );
$wikiText = Babel::render( $parser, 'zxx-1' );
$this->assertNotNull( $parser->getOutput()->getExtensionData( 'babel-tocre... |
16,782 | 84b52c20cba98b9e6eebed36bc07dfc6 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=394-400/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testAutoCreationDisabled() | function | public function testAutoCreationDisabled(): void {
$this->overrideConfigValue( 'BabelAutoCreate', false );
$title = Title::newFromText( 'User:User-1' );
$parser = $this->getParser( $title );
$wikiText = Babel::render( $parser, 'zxx-1' );
$this->assertNull( $parser->getOutput()->getExtensionData( 'babel-tocrea... |
16,783 | 53e43616eadfeb204265907dc89251ee | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=29-34/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::addDBDataOnce() | function | public function addDBDataOnce(): void {
$services = $this->getServiceContainer();
$user = $services->getUserFactory()->newFromName( 'User-1' );
$user->addToDatabase();
$this->insertPage( 'User:User-1', '{{#babel:en-1|es-2|de|SIMPLE-1|zh-hant-3}}' );
} |
16,784 | a12bb1b745721dcca09cbd8a3824b676 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=48-61/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::getParser( PageReference $page ) | function | private function getParser( PageReference $page ): Parser {
$options = ParserOptions::newFromAnon();
$options->setIsPreview( true );
$output = new ParserOutput();
$parser = $this->createMock( Parser::class );
$parser->method( 'getOptions' )->willReturn( $options );
$parser->method( 'getPage' )->willReturn(... |
16,785 | 7cb88f9c938b61bfd1a02e93d21aeb94 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=140-167/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testRenderDefaultLevelNoCategory( string $pageName ) | function | /**
* @dataProvider providePageNames
*/
public function testRenderDefaultLevelNoCategory( string $pageName ): void {
$this->overrideConfigValue( 'BabelMainCategory', false );
$title = Title::newFromText( $pageName );
$parser = $this->getParser( $title );
$wikiText = Babel::render( $parser, 'en' );
$this... |
16,786 | b18dfebe9c50fb21fbfa0ba78c69bdce | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=264-272/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testRenderRedLink() | function | public function testRenderRedLink(): void {
$parser = $this->getParser( Title::newFromText( 'User:User-1' ) );
$wikiText = Babel::render( $parser, 'redLink' );
$this->assertBabelBoxCount( 0, $wikiText );
$this->assertStringContainsString(
'<div class="mw-babel-notabox" dir="ltr">[[(babel-template: redLink)]]... |
16,787 | 1ed2ecb4f25e4d01c36429cde250501c | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=211-233/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testRenderPlain() | function | public function testRenderPlain(): void {
$parser = $this->getParser( Title::newFromText( 'User:User-1' ) );
$wikiText = Babel::render( $parser, 'plain=1', 'en' );
$this->assertSame(
'<div class="mw-babel-box mw-babel-box-N mw-babel-box-en" dir="ltr">'
. "\n"
. '{|'
. "\n"
. '! dir="ltr" | [[(babel... |
16,788 | a2df3c8c814d37cbd8be3a807e97b49e | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=235-262/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testRenderNamedParams() | function | public function testRenderNamedParams() {
$parser = $this->getParser( Title::newFromText( 'User:User-1' ) );
$parser->method( 'replaceVariables' )->willReturnCallback( static function ( $data ) {
return $data;
} );
$this->insertPage( '(babel-template: example)' );
$this->insertPage( '(babel-template: exam... |
16,789 | b5b7124ba7741cc2d2b77571f21bb81b | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=322-335/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testGetUserLanguageInfo() | function | public function testGetUserLanguageInfo(): void {
$services = $this->getServiceContainer();
$userIdentity = $services->getUserIdentityLookup()->getUserIdentityByName( 'User-1' );
$languages = Babel::getUserLanguageInfo( $userIdentity );
// Sorted by language code
$this->assertSame( [
'de' => 'N',
'en' ... |
16,790 | 188bc22dfa4078c58e414a70cbe6eaf2 | swh:1:cnt:04cc5e757e25a0d4197d5e24d84dc48ed4c1cd45;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=284-288/ | 1e921c2e5fbc2a41936c520b771c0f60975ad435 | Babel | deployed | tests/phpunit/BabelTest.php | BabelTest::testRenderNoSkillNoCategory() | function | public function testRenderNoSkillNoCategory(): void {
$parser = $this->getParser( Title::newFromText( 'User:User-1' ) );
$wikiText = Babel::render( $parser, 'en-0' );
$this->assertNotHasCategory( $parser, 'en' );
} |
16,791 | c8dc7b005fad81d041ad4149ca44b151 | swh:1:cnt:d0c0889e9860e8c187ac2cafdb0410220f3c1485;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=9-28/ | 96a6b77afabbb475c2b406f9264bfe4c51b0e231 | Babel | deployed | tests/phpunit/integration/Config/BabelSchemaProviderTest.php | BabelSchemaProviderTest | type | /**
* @coversNothing
*/
class BabelSchemaProviderTest extends SchemaProviderTestCase {
protected function getExtensionName(): string {
return 'Babel';
}
protected function getProviderId(): string {
return 'Babel';
}
protected function setUp(): void {
parent::setUp();
$this->overrideConfigValue( 'Babe... |
16,792 | 96af6fa3cf32df6229d3d3a5dc10ca39 | swh:1:cnt:d0c0889e9860e8c187ac2cafdb0410220f3c1485;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=14-16/ | 96a6b77afabbb475c2b406f9264bfe4c51b0e231 | Babel | deployed | tests/phpunit/integration/Config/BabelSchemaProviderTest.php | BabelSchemaProviderTest::getExtensionName() | function | protected function getExtensionName(): string {
return 'Babel';
} |
16,793 | 929462f47980cb66b0e982fb8fb07d48 | swh:1:cnt:d0c0889e9860e8c187ac2cafdb0410220f3c1485;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=22-26/ | 96a6b77afabbb475c2b406f9264bfe4c51b0e231 | Babel | deployed | tests/phpunit/integration/Config/BabelSchemaProviderTest.php | BabelSchemaProviderTest::setUp() | function | protected function setUp(): void {
parent::setUp();
$this->overrideConfigValue( 'BabelUseCommunityConfiguration', true );
} |
16,794 | 16fc65767e1a2379f84905626e35b255 | swh:1:cnt:d0c0889e9860e8c187ac2cafdb0410220f3c1485;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=18-20/ | 96a6b77afabbb475c2b406f9264bfe4c51b0e231 | Babel | deployed | tests/phpunit/integration/Config/BabelSchemaProviderTest.php | BabelSchemaProviderTest::getProviderId() | function | protected function getProviderId(): string {
return 'Babel';
} |
16,795 | 8d8b9981629ebcffc82b31714b2cf9c8 | swh:1:cnt:6e8e01a41fc346487a84f9b6e507067fe8133bf5;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=9-86/ | 0feb57b5f75c79c3bf30e9a897e64d30545913b7 | Babel | deployed | tests/phpunit/integration/maintenance/MigrateConfigToCommunityTest.php | MigrateConfigToCommunityTest | type | /**
* @group Database
* @covers \MediaWiki\Babel\Maintenance\MigrateConfigToCommunity
*/
class MigrateConfigToCommunityTest extends MaintenanceBaseTestCase {
protected function setUp(): void {
parent::setUp();
$this->overrideConfigValue( 'BabelUseCommunityConfiguration', true );
}
protected function getMain... |
16,796 | 5f2014304f24fd296a49684589161e6f | swh:1:cnt:6e8e01a41fc346487a84f9b6e507067fe8133bf5;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=15-18/ | 0feb57b5f75c79c3bf30e9a897e64d30545913b7 | Babel | deployed | tests/phpunit/integration/maintenance/MigrateConfigToCommunityTest.php | MigrateConfigToCommunityTest::setUp() | function | protected function setUp(): void {
parent::setUp();
$this->overrideConfigValue( 'BabelUseCommunityConfiguration', true );
} |
16,797 | 18d1165dbcbde7e03bc583fe15b64dd5 | swh:1:cnt:6e8e01a41fc346487a84f9b6e507067fe8133bf5;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=20-22/ | 0feb57b5f75c79c3bf30e9a897e64d30545913b7 | Babel | deployed | tests/phpunit/integration/maintenance/MigrateConfigToCommunityTest.php | MigrateConfigToCommunityTest::getMaintenanceClass() | function | protected function getMaintenanceClass() {
return MigrateConfigToCommunity::class;
} |
16,798 | 970c8795e2be71db19b162f8bce34616 | swh:1:cnt:6e8e01a41fc346487a84f9b6e507067fe8133bf5;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=29-65/ | 0feb57b5f75c79c3bf30e9a897e64d30545913b7 | Babel | deployed | tests/phpunit/integration/maintenance/MigrateConfigToCommunityTest.php | MigrateConfigToCommunityTest::provideSpecificConfig() | function | public static function provideSpecificConfig() {
return [
'false BabelCategoryNames' => [
// expected
[
'0' => '0',
'1' => 'User %code%-1',
'2' => '',
'3' => 'User %code%-3',
'4' => 'User %code%-4',
'5' => 'User %code%-5',
'N' => 'User %code%-N',
],
// config
... |
16,799 | 9e179daa4bc312295ca722ce95a33ed8 | swh:1:cnt:6e8e01a41fc346487a84f9b6e507067fe8133bf5;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel.git;lines=67-85/ | 0feb57b5f75c79c3bf30e9a897e64d30545913b7 | Babel | deployed | tests/phpunit/integration/maintenance/MigrateConfigToCommunityTest.php | MigrateConfigToCommunityTest::testWithSpecificConfig( $expected, string $variable, $value ) | function | /**
* @param mixed $expected Value to expect in CommunityConfiguration
* @param string $variable Config variable to set
* @param mixed $value Value to set in server configuration
* @dataProvider provideSpecificConfig
*/
public function testWithSpecificConfig( $expected, string $variable, $value ) {
$this->... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.