Commit Graph

52 Commits

Author SHA1 Message Date
Sam Smith
852d72e66d Remove UniversalLanguageSelector instrument
Per T275894, Readers Web intend to increase the scope of the
UniversalLanguageSelector instrument to help them understand how
users are interacting with the Languages list in sidebar.

In order to keep the UniversalLanguageSelector extension focussed and
not overly Wikimedia-specific, it was agreed that the instrument would
be migrated to the WikimediaEvents extension, where other such
instruments are located.

Therefore, remove all code related to the UniversalLanguageSelector
instrument.

Bug: T275894
Depends-On: I2acee8ba8dc59c497dc6ba42cd5bd88dfd985c8b
Change-Id: I72b1d0ff35488521b3499e9606efee26baff8c00
2021-03-04 13:58:19 +00:00
jdlrobson
96656c5f41 Allow access to display and input settings in new vector
Light refactor of existing code into reusable method to support
this.

Use Extension attributes to allow skins to provide ULS
additional configuration.

Bug: T274396
Change-Id: I7dcd49f05fae83fbc0c15768bee8ca93eab17bcc
2021-02-22 11:02:10 +00:00
James D. Forrester
9fc9dbafa3 Use User->isRegistered(), not deprecated isLoggedIn()
Bug: T270450
Change-Id: Ibeb882b8917f43aed9fd2411a6d4a2400532da33
2020-12-18 22:16:26 +00:00
jdlrobson
d69d5773e5 Compact language links module is loaded via server side
This provides an alternative mechanism to
I0518ecdf402ebf5eb6bad2c430f6462322c0d8e1 for loading the compact
language link module. Instead of relying on the client, the HTML
is inspected.

Bug: T264824
Change-Id: I977a998388b3e70f7fe4d97fa05be3c1ac1bf676
2020-11-18 17:07:59 +00:00
jdlrobson
ab6decae11 Allow skins to register their own button and disable compact
Example usage:
Iabd4688c6081b4de391b9655b92a16f3a414e018

We will skip loading the compact link if we don't need
to compact the languages.

Note special handling is known for Timeless which stops
propagation of events. This will be fixed in Timeless at a
later date.

Bug: T264824
Change-Id: I0518ecdf402ebf5eb6bad2c430f6462322c0d8e1
2020-11-18 17:06:40 +00:00
Niklas Laxström
98f0bb42bd Remove ULSCompactLinksForNewAccounts and ULSCompactLinksEnableAnon
These are disabled by default and on production. They are only enabled
in the beta cluster, which is not needed.

Change-Id: Ifa847fd8a1f3d7d2695a7c1c4a1a93f136091604
2020-10-14 13:02:25 +00:00
Ammar Abdulhamid
f13d28f4d1 Hide ULS language settings in Minerva skin
Bug: T259037
Change-Id: Id62fd434f5974834292bda09e8436efef97cb234
2020-08-31 10:53:09 +00:00
jdlrobson
b5aff8a06b Define unsupported skins
Previously UniversalLanguageSelector relied on the targets system
meaning the modules ext.uls.interface,
ext.uls.interlanguage and ext.uls.pt were
loaded on Minerva desktop skin unnecessarily and silently removed
on MobileFrontend which throws a warning.

Instead of doing this, check the skin

Bug: T237036
Bug: T235712
Change-Id: Ib38b041533cf959c3c4c30decc65869995c254fa
2020-07-28 14:55:40 +00:00
Abijeet
e44e59497c Set language URLs to empty for older version of skins
During MLEB 2020.07 release testing noticed that if $wgULSPosition
is interlanguage, the ULS was not appearing.

Revert some of the changes introduced in
I2843edde1bb45c70911d5acf2f7dafdff3bac53e to fix this

Tested this change on,
1. MW 1.34, Timeless (1b22886)
2. MW 1.34, Vector (f39a3f0)
3. MW 1.36, Timeless (e5e188f)
4. MW 1.36, Vector (3926ffa)

ULS appears in all scenarios

Change-Id: I84feaed26c4e32d74ae90152a2d006648d4d9b64
2020-07-23 11:42:40 +00:00
Abijeet
09a19700d2 Update ULS_VERSION for the MLEB release
This is currently used in CleanChanges extension:
https://codesearch.wmcloud.org/search/?q=ULS_VERSION&i=nope&files=&repos=

Bug: T257286
Change-Id: I62cf6a20c6a990d21b8f958356bf35aabb749f38
2020-07-23 16:16:28 +05:30
Niklas Laxström
6e93ccfb2e Minimal fix for broken language trigger in ContentTranslation
Bug: T255331
Change-Id: If81613f6a9784535e25feef56335afb290023749
2020-06-16 09:39:02 +02:00
jdlrobson
afebb45eb9 SkinTemplateOutputPageBeforeExec is deprecated
Instead use SkinAfterPortlet to force the language portal
to always display. This will work with all Wikimedia deployed skins that
use ULS (note the Minerva skin is not impacted but in future can benefit
from this change)

Depends-On: I438daa79d3d97e2518e6258c3213a805bd1f30e8
Bug: T253178
Change-Id: I2843edde1bb45c70911d5acf2f7dafdff3bac53e
2020-06-12 09:07:14 -07:00
Timo Tijhof
5b7e12705a Remove redundant dependency on 'mediawiki.notify'
As this extension supports MW 1.34 (and MW 1.33) in the master
branch, apply the usual ternary PHP registration and ternary
tricks.

Bug: T233676
Change-Id: I4d18bab53460b397d4f50485c4a149185a1db7b3
2020-05-28 07:27:24 +00:00
James D. Forrester
18552a7142 Use QUnitTestModule instead of deprecated ResourceLoaderTestModules
This increases the compatibility requirement of this extension to
MediaWiki 1.33+

Bug: T232875
Change-Id: I50e652697c9d6e2886d457885b1d7b04a45f376f
2020-05-11 19:06:21 +00:00
Fomafix
0a605f40ab Use PHP syntax features from PHP 7.1
* void return type (https://wiki.php.net/rfc/void_return_type)
* Nullable type (https://wiki.php.net/rfc/nullable_types)

The parent change ensures that PHP 7.1+ is required.

This change reverts commit 8eb162020f.

Change-Id: Ifb8fc52f4b161ea89fef2c84e51e4c8f2b648a49
2020-01-20 13:49:55 +00:00
Fomafix
5fda459531 Remove URL parameter setlang from history when language is unchanged
This change allows to use the ULS language changer without getting a
dialog for restoring the old language.

This change requires that the module is also loaded in this case.

Change-Id: Ie5169e986d0362034ede122b0bc29ce7a4aa481e
2019-12-19 20:32:25 +01:00
Fomafix
5b41346e76 Use a cookie which can changed by JavaScript for setlang
Before this change the cookie set by setlang can't changed with
JavaScript UI anymore.

Change-Id: Iad5fac0ee7de59813370849f22b685073e4cc535
2019-12-19 18:22:32 +01:00
Fomafix
8eb162020f Remove type hints which are not supported by PHP 7.0
ULS currently supports MediaWiki 1.32+ which supports PHP 7.0+.

This change can reverted when the minimum required MediaWiki version is
1.34+.

Change-Id: I8115c4ae74c8aa91899899b1fb304ccbf1066ad8
2019-12-19 17:36:32 +01:00
Abijeet
ff02e63a45 Update setlang to display confirmation dialog to change language
setlang will now display a dialog to confirm with the user that
they would like to change their interface language. The preferred
language will only be updated if the user confirms.

The dialog will be displayed if the setlang parameter is present in
the query string and,

* A user is logged in, and their preferred language is not the same
  as the one passed via setlang.
* For an anonymous user if the wgULSAnonCanChangeLanguage is true,
  and the current interface language is not the same as the one
  passed via setlang.

Bug: T63115
Change-Id: I882297d99a594fd82fd0aec3b4664e8bfd1eac3a
2019-12-19 14:54:34 +00:00
Fomafix
e7ab5faf2f Use type hints for TypeError exception
This change allows to replace the Assert::parameterType by a type hint
in Ie215179b4631fd9071b257772c5cb193547cb7d7.

Change-Id: I399a92d3fac0e0849fe3a403c703fe7d32f51257
2019-10-31 19:12:09 +00:00
Fomafix
71aefc8d4b Drop support for MediaWiki 1.31 and earlier
MediaWiki 1.33 is released. The next version MLEB 2019.07 will be
compatible with MediaWiki 1.32 and 1.33.

Change-Id: I9487706125fe84d02cb8d3fec0a10e1f10006e64
2019-07-08 22:51:08 +02:00
Fomafix
760674d965 Add type hints to used objects and arrays in hooks
Also mark only local used functions as private function.

Change-Id: I5fa27d0be492a4a936e6b30b2a16655ed3746fdd
2019-05-17 04:27:56 +00:00
Kosta Harlan
96f3515eef Use getInstanceForUpdate when saving user settings
Bug: T222300
Change-Id: Ia5e292bea544e5415ebcbbdd75705ee3b547e034
2019-05-02 04:50:50 +00:00
Timo Tijhof
6928b7ec8d Merge ext.uls.eventlogger into ext.uls.common
This could've been done longer ago (by defining ext.uls.common
in Hooks.php), but didn't notice it before.

The ext.uls.eventlogger was (if configured) loaded on all page
loads. Same as ext.uls.init (but without config condition).

ext.uls.ext is an empty shim around ext.uls.common, which is thus
also loaded on all pages. Merge this into there given has no
reason for being its own module. They are always loaded together.

Change-Id: Icdda6f27470a1d56a37275164c06541514a488a0
2019-04-17 10:52:04 +00:00
Timo Tijhof
49ed2a5ac4 ULSJsonMessageModule: Remove language code validation
The ResourceLoaderContext class already performs a stricter
version of this.

Change-Id: I46b920cbc0f9024e5ed2027ff30c40400a73fef3
2019-04-17 04:37:46 +00:00
Fomafix
6fadfa783b Remove addModules( 'ext.uls.init' )
The modules 'ext.uls.init'/'ext.uls.common' provides only a library and
no own funtionality. The modules get automatically loaded through
dependencies by other modules when needed as library. An explicit
loading on all page is not necessary. For example the MediaWiki API
help page does not have any ULS elements.

Bug: T145186
Change-Id: Ida99704ca2846e6adf154255bee3148e80c957d8
2019-04-17 04:37:44 +00:00
Timo Tijhof
ea671b1f24 ext.uls.eventlogger: Use mw.track() and remove EventLogging dep
Given the code no longer uses any EventLogging methods directly,
but rather mw.track(), this means it also doesn't need to declare
any dependencies, including for older MediaWiki versions this
will work as-is.

Change-Id: I8cdcef54321d0887c509fc3683acf132c113e628
2019-04-17 04:04:01 +00:00
Reedy
f8e9ed1299 Move some more php files under includes
Change-Id: I55d536e05c50a90f0805a6dc4252cc003ee0c7bb
2019-03-02 20:11:49 +00:00
Fomafix
72fb42cdba Remove support for MediaWiki 1.29 and earlier
extension.json already requires "MediaWiki": ">= 1.30.0".

Change-Id: Ic460e6364967cd7b0367e66f613077c424bd8f19
2018-08-31 21:41:42 +00:00
libraryupgrader
38b449ceef build: Updating mediawiki/mediawiki-codesniffer to 20.0.0
Change-Id: I02db015a34f67a8b268feead090d2f6be5658935
2018-05-26 07:31:25 +00:00
Kunal Mehta
10a5865f9a Fix MediaWiki.Commenting.LicenseComment.InvalidLicenseTag errors
Change-Id: I2c868006d108b35adaa19d179bc6ebe95e29d0ef
2018-05-23 23:02:54 -07:00
Kunal Mehta
8d8aef75c0 Avoid unnecessary closure
Change-Id: Ic17dce21b8a7175d75545f76c9e6c365d0e536cb
2018-05-16 17:05:46 -07:00
libraryupgrader
f97802e4e2 build: Updating mediawiki/mediawiki-codesniffer to 18.0.0
The following sniffs are failing and were disabled:
* MediaWiki.VariableAnalysis.UnusedGlobalVariables.UnusedGlobal$wgWBClientSettings

Change-Id: Ia5423c3d7ea419b3f073f35736de7a9379d4429a
2018-04-14 07:39:31 +00:00
libraryupgrader
858ebd5552 build: Updating mediawiki/mediawiki-codesniffer to 17.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.LicenseComment.InvalidLicenseTag

The following sniffs now pass and were enabled:
* MediaWiki.Commenting.FunctionComment.MissingParamComment

Change-Id: I06e0542d737cec5e2500aad6d85f72951f8b584d
2018-03-29 06:53:52 +00:00
Santhosh Thottingal
07087dbb06 Remove ttf format from repo and thereby from fontface css
TTF files are not removed, the entries for them from the repo
is removed. Generated CSS will also skip ttf.

TTF format is not required for any browser now a days.
https://caniuse.com/#feat=woff

Change-Id: I018e74f6a50e63f55adeca480c03124092fba015
2017-11-14 09:23:55 +05:30
Umherirrender
7761a9e60b Improve some parameter docs
Change-Id: Icd8fd55cf1a4a83a6f674038e098b9be8257dc0c
2017-10-07 16:54:28 +02:00
Kunal Mehta
0e7d8a7a9d build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.Commenting.FunctionComment.WrongStyle
* MediaWiki.FunctionComment.Missing.Public

Change-Id: Ic8acf95cfd8edf88125128fe527e357fa5d0a8ec
2017-06-25 18:39:02 +00:00
Fomafix
b30315da05 Use ResourceLoader::makeConfigSetScript to generate mw.config.set() script
Change-Id: If2ca0585c17f772567fffeab0fc32239e87d8cd7
2017-04-02 14:41:33 +02:00
Timo Tijhof
2ab168f113 Use getDefinitionSummary() in ResourceLoaderULSJsonMessageModule
* Fix inaccurate class comment that was copied from an unrelated
  module in MediaWiki core.

* Remove use of deprecated getModifiedTime(). While this implementation was
  straight forward, it is more reliable and deterministic to use a content hash
  because timestamps are not tracked by Git. This currently causes needless
  cache invalidation for all users at Wikimedia every week because git-clone
  starts with fresh timestamps on disk.

  I'm not using enableModuleContentVersion() right now because calling
  getScript() reads all files into memory which is more expensive than
  simply hashing the files. Especially because safeFileHash() is backed
  by an APC cache via FileContentsHasher.

  This matches the implementation in core ResourceLoaderFileModule.

Change-Id: If9aaefa6a3cf047c6c36e1cdd0f350412d59c849
2016-08-23 21:49:26 +00:00
Timo Tijhof
f06ac3efca Simplify ResourceLoaderULSModule with content-based versioning
* Remove manual tracking of when a hash is first seen.
  ResourceLoader is no longer time-based, rather it is content based.
  Except where a timestamp is actually wanted as key, a hash is all
  we need. The default implementation of simply calling getScript()
  and hashing its output suffices, and isn't a performance problem
  in this case.

* Also simplify getScript() by passing an object to 'mw.config.set'.
  Instead of multiple calls for each key/value. This is a no-op
  now because there is only one key.

* Fix inaccurate class comment that was copied from an unrelated
  module in MediaWiki core.

Change-Id: I9bb82cadd9caa7e584e20dd49ce30b64218326c4
2016-08-23 14:49:16 -07:00
jdlrobson
9e0dcbde35 Enable UniversalLanguageSelector modules for mobile
Enable several of the ULS modules so they can be used in a mobile context,
in particular by the Translate Extension

Changes:
* Create a ext.uls.common module that can be loaded safely on mobile
* Only add the ext.uls.init entry point module on desktop (ensured by
the use of targets). On mobile it has no impact other than to increase
the amount of bytes shipped to users.
* Note various modules have not been enabled for mobile usage.

Bug: T102922
Change-Id: If2808886f0bfa153f5918e3c7536e88641028da9
2016-08-17 06:43:46 +00:00
Niklas Laxström
3481946695 Drop svg from supported webfont formats
We do not have any svg formatted font files.

Change-Id: I613c04f082bfc07872d4e843cdacdfd62517bd37
2016-05-24 06:07:07 +00:00
Niklas Laxström
b2b75b15eb Drop eot from supported webfont formats
IE9+ which is lowest that MediaWiki still supports is supposed to
support both ttf and woff par some exceptions.

This reduces uncompressed repo size almost 4000 bytes.

Change-Id: If80f4ec898d86d5fd4cf873d0d86245e66da2f0b
2016-05-24 08:06:11 +02:00
Niklas Laxström
e054af704c FontRepoCompiler now adds hash suffix to font paths
This is now new standard way of doing this in MediaWiki.

Since this makes the font repo bit longer, compensated by no
longer providing version information, which also simplifies the code.
Uncompressed increase is 542 bytes.

Depends on https://github.com/wikimedia/jquery.webfonts/pull/45

Bug: T135806
Change-Id: I1921115fc1abc20e6e756044c0a84a9fe4133884
2016-05-23 09:32:57 +02:00
Kunal Mehta
6b8c33e763 build: Updating mediawiki/mediawiki-codesniffer to 0.7.1
Also added "composer fix" command.

Change-Id: I6f3f29f03abb607fbca9cec6f140875f2a3468a0
2016-05-09 18:30:34 -07:00
Niklas Laxström
651f8bc1c3 Refactor font repo compiler so it can be reused
Includes changes to the generated repository file
because the script had not been run for last update.

Change-Id: I6b5d1ce980c6e5b42e36c0044729536b6b0ae4dc
2016-04-14 10:12:20 +02:00
Siebrand Mazeland
49b4cc0028 Declare functions with access modifiers
Change-Id: I047d3dc6642de07130a43ad4c2fd4a8106450aac
2016-03-05 16:10:52 +01:00
Andrew Green
c00645a0a0 Update ResourceLoaderULSJsonMessageModule::getDependencies method signature
This change is for compatibility with Iee61e5b527 in MediaWiki.

This patch updates version info due to said requirement.

Change-Id: Ic63e617f51702c27104e123d4bed91983a726b7f
2015-06-09 01:23:30 +00:00
Niklas Laxström
a54a7c6793 Use different key for memckey
Change-Id: Iee00180c9b356a510a28000203ac06f757822114
2014-03-13 07:36:14 +00:00
Santhosh Thottingal
328eb017c8 Json message loader clean up
* Rename JsonMessageLoader to ULSJsonMessageLoader
* Correct the return type of mw.uls.loadLocalization

Follow up: Ic39dec1c484982fb07edd167e83794c0b5f470ee

Change-Id: I13c64a5e89ac75be8a95d951658018a78534f466
2013-11-19 10:55:52 +00:00