Remove support for MediaWiki 1.29 and earlier

extension.json already requires "MediaWiki": ">= 1.30.0".

Change-Id: Ic460e6364967cd7b0367e66f613077c424bd8f19
This commit is contained in:
Fomafix
2018-08-31 16:42:22 +02:00
committed by jenkins-bot
parent 137fb70a75
commit 72fb42cdba
4 changed files with 7 additions and 43 deletions

View File

@@ -462,7 +462,7 @@ class UniversalLanguageSelectorHooks {
* @param ResourceLoader $resourceLoader * @param ResourceLoader $resourceLoader
*/ */
public static function onResourceLoaderRegisterModules( ResourceLoader $resourceLoader ) { public static function onResourceLoaderRegisterModules( ResourceLoader $resourceLoader ) {
global $wgULSEventLogging, $wgVersion; global $wgULSEventLogging;
$modules = []; $modules = [];
$modules['ext.uls.compactlinks'] = [ $modules['ext.uls.compactlinks'] = [
@@ -482,10 +482,6 @@ class UniversalLanguageSelectorHooks {
'localBasePath' => __DIR__ . '/resources', 'localBasePath' => __DIR__ . '/resources',
'remoteExtPath' => 'UniversalLanguageSelector/resources' 'remoteExtPath' => 'UniversalLanguageSelector/resources'
]; ];
if ( version_compare( $wgVersion, '1.29', '<' ) ) {
// Support: MediaWiki 1.28 and earlier (T162590)
$modules['ext.uls.compactlinks']['dependencies'][] = 'es5-shim';
}
if ( $wgULSEventLogging ) { if ( $wgULSEventLogging ) {
$modules['ext.uls.eventlogger'] = [ $modules['ext.uls.eventlogger'] = [

View File

@@ -93,7 +93,7 @@ class FontRepoCompiler {
foreach ( [ 'woff', 'woff2' ] as $format ) { foreach ( [ 'woff', 'woff2' ] as $format ) {
if ( isset( $font[$format] ) ) { if ( isset( $font[$format] ) ) {
$info[$format] = $this->getFontWebPath( $fontpath, $fontdir, $font[$format] ); $info[$format] = OutputPage::transformFilePath( $fontdir, $fontpath, $font[$format] );
} }
} }
@@ -101,7 +101,7 @@ class FontRepoCompiler {
if ( !isset( $info['woff'] ) ) { if ( !isset( $info['woff'] ) ) {
foreach ( glob( "$fontpath/*.{woff,woff2}", GLOB_BRACE ) as $fontfile ) { foreach ( glob( "$fontpath/*.{woff,woff2}", GLOB_BRACE ) as $fontfile ) {
$type = substr( $fontfile, strrpos( $fontfile, '.' ) + 1 ); $type = substr( $fontfile, strrpos( $fontfile, '.' ) + 1 );
$info[$type] = $this->getFontWebPath( $fontpath, $fontdir, basename( $fontfile ) ); $info[$type] = OutputPage::transformFilePath( $fontdir, $fontpath, basename( $fontfile ) );
} }
} }
@@ -120,14 +120,4 @@ class FontRepoCompiler {
return $info; return $info;
} }
private function getFontWebPath( $path, $fontdir, $filename ) {
if ( method_exists( 'OutputPage', 'transformFilePath' ) ) {
return OutputPage::transformFilePath( $fontdir, $path, $filename );
}
// BC for MediaWiki <= 1.27
$hash = md5_file( "$path/$filename" );
return "$fontdir/$filename?" . substr( $hash, 0, 5 );
}
} }

View File

@@ -439,15 +439,9 @@
* @return {Array} List of language codes in which there are articles with badges * @return {Array} List of language codes in which there are articles with badges
*/ */
CompactInterlanguageList.prototype.filterByBadges = function () { CompactInterlanguageList.prototype.filterByBadges = function () {
// Can be removed when backwards compatibility before
// MediaWiki 1.28 is no longer needed
var targetSelector = parseFloat( mw.config.get( 'wgVersion' ) ) >= 1.28 ?
'.interlanguage-link-target' :
'a';
return $( '#p-lang' ).find( '[class*="badge"]' ).map( function ( i, el ) { return $( '#p-lang' ).find( '[class*="badge"]' ).map( function ( i, el ) {
return convertMediaWikiLanguageCodeToULS( return convertMediaWikiLanguageCodeToULS(
$( el ).find( targetSelector ).attr( 'lang' ) $( el ).find( '.interlanguage-link-target' ).attr( 'lang' )
); );
} ).toArray(); } ).toArray();
}; };
@@ -459,16 +453,9 @@
* @return {Object} List of existing language codes and their hrefs * @return {Object} List of existing language codes and their hrefs
*/ */
CompactInterlanguageList.prototype.getInterlanguageList = function () { CompactInterlanguageList.prototype.getInterlanguageList = function () {
var targetSelector, var interlanguageList = {};
interlanguageList = {};
// Can be removed when backwards compatibility before this.$interlanguageList.find( '.interlanguage-link-target' ).each( function () {
// MediaWiki 1.28 is no longer needed
targetSelector = parseFloat( mw.config.get( 'wgVersion' ) ) >= 1.28 ?
'.interlanguage-link-target' :
'li.interlanguage-link > a';
this.$interlanguageList.find( targetSelector ).each( function () {
var langCode = convertMediaWikiLanguageCodeToULS( this.getAttribute( 'lang' ) ); var langCode = convertMediaWikiLanguageCodeToULS( this.getAttribute( 'lang' ) );
interlanguageList[ langCode ] = { interlanguageList[ langCode ] = {

View File

@@ -133,16 +133,7 @@
} }
function showTipsy( timeout ) { function showTipsy( timeout ) {
var offset, tipsyTimer = 0; var tipsyTimer = 0;
// BC for MW 1.27
if ( ulsPopup.setFloatableContainer === undefined ) {
offset = $ulsTrigger.offset();
ulsPopup.$element.css( {
top: offset.top + 24,
left: offset.left + $ulsTrigger.outerWidth() / 2
} );
}
ulsPopup.toggle( true ); ulsPopup.toggle( true );
ulsPopup.toggleClipping( false ); ulsPopup.toggleClipping( false );