return Html::rawElement( 'td', [], $this->arrayTable( $val ) );
}
- return Html::element( 'td', [ 'class' => 'value' ], $this->primitiveValue( $val ) );
+ return Html::element( 'td', [ 'class' => 'mw-json-value' ], $this->primitiveValue( $val ) );
}
/**
// @TODO: disallow this word on all namespaces
$this->nsInfo->isContent( $this->mTitle->getNamespace() )
) {
- if ( $this->mRevisionId ) {
+ if ( $this->mRevisionId || $this->mOptions->getSpeculativeRevId() ) {
return '-';
} else {
$this->mOutput->setFlag( 'vary-revision-exists' );
$this->skin = $request->getRawVal( 'skin' );
$skinnames = Skin::getSkinNames();
- // If no skin is specified, or we don't recognize the skin, use the default skin
if ( !$this->skin || !isset( $skinnames[$this->skin] ) ) {
- $this->skin = $this->getConfig()->get( 'DefaultSkin' );
+ // The 'skin' parameter is required. (Not yet enforced.)
+ // For requests without a known skin specified,
+ // use MediaWiki's 'fallback' skin for skin-specific decisions.
+ $this->skin = 'fallback';
}
}
$lang = $this->getRequest()->getRawVal( 'lang', '' );
// Stricter version of RequestContext::sanitizeLangCode()
if ( !Language::isValidBuiltInCode( $lang ) ) {
- $lang = $this->getConfig()->get( 'LanguageCode' );
+ // The 'lang' parameter is required. (Not yet enforced.)
+ // If omitted, localise with the dummy language code.
+ $lang = 'qqx';
}
$this->language = $lang;
}
* getPages.
*/
public function __construct( array $options = null ) {
- if ( is_null( $options ) ) {
+ if ( $options === null ) {
return;
}
* @ingroup SpecialPage
*/
+use MediaWiki\Permissions\PermissionManager;
+
/**
* MediaWiki page data importer
*
# getUserPermissionsErrors() might actually be used for, hence the 'ns-specialprotected'
$errors = wfMergeErrorArrays(
$this->getPageTitle()->getUserPermissionsErrors(
- 'import', $user, true,
+ 'import', $user, PermissionManager::RIGOR_FULL,
[ 'ns-specialprotected', 'badaccess-group0', 'badaccess-groups' ]
),
$this->getPageTitle()->getUserPermissionsErrors(
- 'importupload', $user, true,
+ 'importupload', $user, PermissionManager::RIGOR_FULL,
[ 'ns-specialprotected', 'badaccess-group0', 'badaccess-groups' ]
)
);
if ( isset( $conds['orconds']['actor'] ) ) {
// @todo: This will need changing when revision_comment_temp goes away
$queryInfo['options']['USE INDEX']['temp_rev_user'] = 'actor_timestamp';
- // Alias 'rev_timestamp' => 'revactor_timestamp' so "ORDER BY rev_timestamp" is interpreted to
- // use revactor_timestamp instead.
+ // Alias 'rev_timestamp' => 'revactor_timestamp' and 'rev_id' => 'revactor_rev' so
+ // "ORDER BY rev_timestamp, rev_id" is interpreted to use denormalized revision_actor_temp
+ // fields instead.
$queryInfo['fields'] = array_merge(
- array_diff( $queryInfo['fields'], [ 'rev_timestamp' ] ),
- [ 'rev_timestamp' => 'revactor_timestamp' ]
+ array_diff( $queryInfo['fields'], [ 'rev_timestamp', 'rev_id' ] ),
+ [ 'rev_timestamp' => 'revactor_timestamp', 'rev_id' => 'revactor_rev' ]
);
} else {
$queryInfo['options']['USE INDEX']['revision'] =
padding: 0.5em 1em;
}
+/* TODO: Remove this old class once the content caches have cleared */
/* stylelint-disable-next-line selector-class-pattern */
.mw-json .value,
+.mw-json-value,
.mw-json-single-value {
background-color: #dcfae3;
font-family: monospace, monospace;
* "text/javascript"; if no type is provided, text/javascript is assumed.
*/
load: function ( modules, type ) {
- var l;
-
- // Allow calling with a url or single dependency as a string
- if ( typeof modules === 'string' ) {
- // "https://example.org/x.js", "http://example.org/x.js", "//example.org/x.js", "/x.js"
- if ( /^(https?:)?\/?\//.test( modules ) ) {
- if ( type === 'text/css' ) {
- l = document.createElement( 'link' );
- l.rel = 'stylesheet';
- l.href = modules;
- document.head.appendChild( l );
- return;
- }
- if ( type === 'text/javascript' || type === undefined ) {
- addScript( modules );
- return;
- }
+ if ( typeof modules === 'string' && /^(https?:)?\/?\//.test( modules ) ) {
+ // Called with a url like so:
+ // - "https://example.org/x.js"
+ // - "http://example.org/x.js"
+ // - "//example.org/x.js"
+ // - "/x.js"
+ if ( type === 'text/css' ) {
+ addLink( modules );
+ } else if ( type === 'text/javascript' || type === undefined ) {
+ addScript( modules );
+ } else {
// Unknown type
throw new Error( 'type must be text/css or text/javascript, found ' + type );
}
- // Called with single module
- modules = [ modules ];
+ } else {
+ // One or more modules
+ modules = typeof modules === 'string' ? [ modules ] : modules;
+ // Resolve modules into flat list for internal queuing.
+ // This also filters out unknown modules and modules with
+ // unknown dependencies, allowing the rest to continue. (T36853)
+ enqueue( resolveStubbornly( modules ), undefined, undefined );
}
-
- // Resolve modules into flat list for internal queuing.
- // This also filters out unknown modules and modules with
- // unknown dependencies, allowing the rest to continue. (T36853)
- enqueue( resolveStubbornly( modules ), undefined, undefined );
},
/**
],
[
(object)[ 'foo' ],
- '<table class="mw-json"><tbody><tr><th>0</th><td class="value">"foo"</td></tr>' .
+ '<table class="mw-json"><tbody><tr><th>0</th><td class="mw-json-value">"foo"</td></tr>' .
'</tbody></table>'
],
[
(object)[ 'foo', 'bar' ],
- '<table class="mw-json"><tbody><tr><th>0</th><td class="value">"foo"</td></tr>' .
- '<tr><th>1</th><td class="value">"bar"</td></tr></tbody></table>'
+ '<table class="mw-json"><tbody><tr><th>0</th><td class="mw-json-value">"foo"</td></tr>' .
+ '<tr><th>1</th><td class="mw-json-value">"bar"</td></tr></tbody></table>'
],
[
(object)[ 'baz' => 'foo', 'bar' ],
- '<table class="mw-json"><tbody><tr><th>baz</th><td class="value">"foo"</td></tr>' .
- '<tr><th>0</th><td class="value">"bar"</td></tr></tbody></table>'
+ '<table class="mw-json"><tbody><tr><th>baz</th><td class="mw-json-value">"foo"</td></tr>' .
+ '<tr><th>0</th><td class="mw-json-value">"bar"</td></tr></tbody></table>'
],
[
(object)[ 'baz' => 1000, 'bar' ],
- '<table class="mw-json"><tbody><tr><th>baz</th><td class="value">1000</td></tr>' .
- '<tr><th>0</th><td class="value">"bar"</td></tr></tbody></table>'
+ '<table class="mw-json"><tbody><tr><th>baz</th><td class="mw-json-value">1000</td></tr>' .
+ '<tr><th>0</th><td class="mw-json-value">"bar"</td></tr></tbody></table>'
],
[
(object)[ '<script>alert("evil!")</script>' ],
- '<table class="mw-json"><tbody><tr><th>0</th><td class="value">"' .
+ '<table class="mw-json"><tbody><tr><th>0</th><td class="mw-json-value">"' .
'<script>alert("evil!")</script>"' .
'</td></tr></tbody></table>',
],
protected static function getResourceLoader() {
return new EmptyResourceLoader( new HashConfig( [
'ResourceLoaderDebug' => false,
- 'DefaultSkin' => 'fallback',
- 'LanguageCode' => 'nl',
'LoadScript' => '/w/load.php',
] ) );
}
// Request parameters
$this->assertEquals( [], $ctx->getModules() );
- $this->assertEquals( 'nl', $ctx->getLanguage() );
+ $this->assertEquals( 'qqx', $ctx->getLanguage() );
$this->assertEquals( false, $ctx->getDebug() );
$this->assertEquals( null, $ctx->getOnly() );
$this->assertEquals( 'fallback', $ctx->getSkin() );
// Misc
$this->assertEquals( 'ltr', $ctx->getDirection() );
- $this->assertEquals( 'nl|fallback||||||||', $ctx->getHash() );
+ $this->assertEquals( 'qqx|fallback||||||||', $ctx->getHash() );
$this->assertInstanceOf( User::class, $ctx->getUserObj() );
}
// check
assert.strictEqual( EditPage.heading.getText(), name );
- assert( EditPage.displayedContent.getText().match( new RegExp( editContent ) ) );
+ // eslint-disable-next-line no-restricted-syntax
+ assert( EditPage.displayedContent.getText().includes( editContent ) );
} );
it( 'should have history @daily', function () {