Commit Graph

73 Commits

Author SHA1 Message Date
Niklas Laxström
9cf8ca3305 Add apioutput to unsupported skins
There is nothing ULS can do here: there is no entry point to change
language or access settings, there is nothing to type.

One exception would be loading web fonts. But I would argue that
that is a small set of users, who can use Special:ApiSandbox or
the wiki help pages.

Bug: T145186
Change-Id: I71de2a58f007ff03b01c9edc5ed6bed0e6524c4e
2021-11-17 13:14:05 +00:00
Abijeet
defc3d416d ApiULSSetLanguage: Use LanguageNameUtils
Change-Id: I00e814894db4ba84f1d08c52db2993b59fbccf55
2021-11-16 18:36:23 +00:00
Abijeet
da4d965739 Replace usage of ApiBase::PARAM_* with ParamValidator::PARAM_*
Change-Id: I4c7c16f8b3380cdaf32fbedc9d33f12b14050774
2021-11-16 13:56:49 +00:00
Fomafix
f0c6bec1ac Use HookHandlers and inject services
This change also replaces the calls of deprecated functions from class
Language and replaces the global variables by the MainConfig.

Change-Id: Ice7273481a736cb138e263a9300bfd90fdcbb401
2021-11-04 14:00:31 +00:00
Fomafix
183bb97f74 ApiULSLocalization: Inject LanguageNameUtils
Replace deprecated Language::isValidCode by
LanguageNameUtils::isValidCode.

Change-Id: I2adef21fb37e78c163674008a4f9b1e5a74aa6a1
2021-10-29 13:14:31 +00:00
Abijeet
4d8131af10 MW 1.35: Re-add class attribute for ULS
Without the class attribute, the ULS does not open on MW <= 1.35.
This was changed in Ie9e30af5468aea9803d77c9a36e480ba2b2e86a0

Bug: T294021
Change-Id: I1bcf4e442e85f8848c5e4ff5609204602265b949
2021-10-28 08:08:29 +00:00
Daimona Eaytoy
005f7199ba Suppress taint-check false positive blocking CI
Bug: T294441
Change-Id: I8e060fa8cb7d90b742673a93a52f449920e1d6e9
2021-10-27 17:45:53 +02:00
Reedy
6f8763b3b2 Remove out of date comment in UniversalLanguageSelectorHooks::setVersionConstant()
PHP entry point is gone

Change-Id: I3f2093336a78fa081b4aee862788c793f586fb63
2021-10-07 02:46:33 +00:00
Reedy
b5ec74dc14 Use namespaced BetaFeatures class
Change-Id: I155ca6aa87160be29af1ee57bdd905314410bcf8
2021-10-01 14:38:47 +01:00
jdlrobson
9f92d7e759 Register meta data to allow Vector to handle display of this menu item
- Adjusts CSS to defer button/icon rendering to skins that support button
and icons e.g. Vector

Depends-On: Ib518858e06549f252d73d57fd4768f446cc561b9
Bug: T289630
Change-Id: Ie9e30af5468aea9803d77c9a36e480ba2b2e86a0
2021-09-03 19:21:21 +00:00
Jdlrobson
4c3907e61d Revert "Language button icon/button should be consistent with other buttons"
This reverts commit 5ca2ccb58a.

Reason for revert: Per Niklas's review (T289630#7324439)
I've also seen a much better way to do this which limits the change
to modern skins so I'll post a follow up shortly.

Change-Id: I99802c60390e23eaa0de21462788da622a35a37a
2021-09-01 15:35:05 +00:00
jdlrobson
5ca2ccb58a Language button icon/button should be consistent with other buttons
This converts the language button into a mw-ui-button which is the
class we're currently using in both Vector and Minerva. In future
this can become a WVUI button using the same roadmap as Vector
and Minerva.

This fixes the issue with the icon resize, as well as the issue
with the button lacking appropriate hover/focus states.

Bug: T289630
Change-Id: I8242986e8762a8f663f8cab07c54481e14223320
2021-09-01 08:05:54 +00:00
Alexander Vorwerk
0d9e1b134a Avoid using User::setOption()
User::setOption() is deprecated and should be replaced with
UserOptionsManager::setOption()

Bug: T277818
Change-Id: I5ac58c4be5046d4457de24b63b062aa238e972b6
2021-08-16 06:00:28 +00:00
Alexander Vorwerk
77b61af6b8 Use constant MW_VERSION instead of deprecated global $wgVersion
Change-Id: I60647666d04b43d2cb01ff33310a325fba9bc325
2021-08-13 03:03:03 +02:00
Niklas Laxström
36d79be608 Remove ULSEnableAnon
I am not aware of anyone using this niche configuration where ULS
visible interface is enabled only for logged in users. Simplify
code and updated comments.

Change-Id: I9f0a5969fdc76ca790d961ee3035fdb27ece9c0c
2021-08-09 23:25:01 +05:30
Niklas Laxström
03d099eddc Fix regressions in ULS entry point setup
* Link in preferences is again opening ULS
* "personal" entry point now works even with compact languages
  preference disabled

I added lots of comments and refactored this code to give things
better names to make this code easier to understand and maintain
and hopefully reduce the amount of bugs in the future.

Bug: T282956
Bug: T286574
Change-Id: I9cd6776ea6664e33fd63c49dfa77c5f004fba799
2021-07-16 19:23:34 +00:00
jdlrobson
09a2b33bd6 Restore compact languages button user preference
The compact languages button user preference will be applied to
any compact language button provided by the skin, this allows users
to opt out of the feature as before.

This will be used immediately in Vector in
I436554d9d51470d277d59c2c71e08124735e12fd

Bug: T282149
Change-Id: I726c61d4c6895a28b999781752535e0ddc961744
2021-06-14 15:24:53 +00:00
jdlrobson
2c46226f83 Use SkinTemplateNavigationUniversal for ULS button
As part of the desktop refresh, we are moving towards a universal
hook for adding menu items. This allows more control over placement
without breaking backwards compatibility.

In modern skins, the personal URLs bar is split into
user-menu and notifications options which are combined for legacy
skins.

Depends-On: If4805e5186756056afcd31d21919e907a7782ce8
Bug: T282196
Change-Id: I79fa85e67d9c0064dd4dc9437517264d5fc04140
2021-06-07 20:40:14 +00:00
Abijeet
5baf437b3c Remove MW 1.34 backward compatible code
Move hooks and scripts to extensions.json

Bug: T282783
Change-Id: Id63d17d04789bb36fff35e0512e7878dc8bfe12c
2021-06-01 08:17:13 +00:00
libraryupgrader
b556ff5878 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

npm:
* lodash: 4.17.19 → 4.17.21
  * https://npmjs.com/advisories/1673 (CVE-2021-23337)
* hosted-git-info: 3.0.7 → 3.0.8
  * https://npmjs.com/advisories/1677 (CVE-2021-23362)

Change-Id: If4b6b21986aaa05e3d33fcca6e35374a2eae1830
2021-05-07 15:52:15 +00:00
ZabeMath
cb4c7a13b6 Avoid using User::getBoolOption()
User::getBoolOption() is deprecated and should be replaced with UserOptionsLookup::getBoolOption()

Bug: T277600
Change-Id: I119f9ed8a2f81af2a7f3ac6743e4af239f7ca61d
2021-04-02 02:22:13 +00:00
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