Commit graph

44 commits

Author SHA1 Message Date
Fomafix 249f30c88c Update namespaces of PHP classes
Change-Id: I23543c35ec6eead4d7cb5c0805833d1ff283fd5b
2024-10-04 21:43:09 +00:00
Simon Legner 01437fd521 Replace wgMultimediaViewer with config.json packageFiles
Practically, the variable wgMultimediaViewer is not used inside user common.js, see https://global-search.toolforge.org/?q=wgMultimediaViewer

Ref: https://www.mediawiki.org/wiki/ResourceLoader/Package_files
Bug: T77349
Change-Id: Ib086c6184f76ca2dbeb701f79c3b18b336ff5433
2024-08-11 11:34:46 +02:00
Simon Legner 64e0cfeab5 Make thumbnail bucket widths configurable using wgMediaViewerThumbnailBucketSizes
Bug: T269987
Change-Id: Ib1b590c5c6fe353a86ac1527d19617975113ff8a
2024-08-09 15:56:48 +02:00
Umherirrender d9742f34f3 Use new namespace for Output hooks
Change-Id: I1e82fe02b676ecc776b0412f60bde18b3c944da2
2024-06-09 18:50:10 +02:00
Fomafix 2a31c0b399 Use "optional_services" to inject service MobileContext
This change requires a soft dependency on extension MobileFrontend
in project integration/config in file zuul/parameter_functions.py.

Change-Id: I4e0c8185804a22c57f94dceae3c998e13afa3cfc
2024-04-02 19:55:01 +00:00
Martin Urbanec 81ce7b08bd Support conditional user defaults
Thanks to T321527, MediaWiki makes it possible for default
values of user properties to vary by user.

Depends-On: I1549c3137e66801c85e03e46427e27da333d68e2
Bug: T354329
Change-Id: Ib6717be54d4f898b8b0433ee44b57f1e3e960545
2024-01-04 13:07:24 +01:00
gerritbot 65cf8fc812 Update UserOptionsLookup's FQN
User-options related classes are being moved to the MediaWiki\User\Options namespace in MediaWiki Core; reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: If63fb03b90f797a38a07f0d88f663e25cac75770
2023-11-29 12:39:36 +00:00
jenkins-bot a76823a721 Merge "Use namespaced classes" 2023-10-23 21:18:42 +00:00
jenkins-bot 6ce10b6597 Merge "Replace global variables by inject MainConfig" 2023-10-23 21:17:39 +00:00
jenkins-bot b28183caeb Merge "Use type hint UserOptionsLookup for private variable declaration" 2023-10-23 21:17:37 +00:00
Fomafix 4fd709678e Remove phpcs exclusion rule MediaWiki.Commenting.PropertyDocumentation.MissingVar
Fix code to pass phpcs.

Change-Id: I093b87804d6b2c66efa6ba039d6f1e4720f30209
2023-10-23 20:58:07 +00:00
Fomafix 622f44121f Replace global variables by inject MainConfig
Change-Id: I53322a15e53bfe4e0de6d12253aff74071c339c3
2023-10-23 20:42:49 +00:00
Fomafix 72745a5f28 Use type hint UserOptionsLookup for private variable declaration
Also use alphabetical order of the __constuct parameters.

Change-Id: I448103eabdb88372709eb529118f0f5d17baee8a
2023-10-23 20:15:46 +00:00
Fomafix 2f6a063b71 Use namespaced classes
Change-Id: I358d0544e2195fe5fd8a828bf8130a9b851544d3
2023-10-23 20:10:29 +00:00
Umherirrender fb1de7786c Improve special page handling in onBeforePageDisplay
Avoid creating of Title object to get the "fixed special name" (which is
the localized name) and compare that against the local name of the
current page, just use the SpecialPageFactory to get the canonical name
(which is the english internal name, not the english visible name) and
compare against the list of canonical allowed pages (adjust the existing
list to the canonical names, that are "old" names in different cases)

Change-Id: Ia6f6574bf6e65c75f8977ff016feda6ecdca3776
2023-09-23 00:03:01 +02:00
gerritbot 2c25dcfe59 Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I61ad6f6178ca7cd4f6f52a303d10d47e8ba4476e
2023-08-19 13:08:12 +00:00
Umherirrender ad1f6a6ee0 Use HookHandlers for core hooks
The use of "HookHandlers" attribute in extension.json makes it possible
to inject services into hook handler classes in a future patch.

Bug: T271019
Change-Id: I57dac8d590b5afa7524000d93c8477a10148c052
2023-08-14 20:47:02 +02:00
Cormac Parle 6bb1cbaddb IP masking update
Use localstorage to store MMV preference for anon and temp users,
use regular user preference for non-temp accounts only

For embed default to wikitext for temp and regular users, html
for anon users

Bug: T340534
Change-Id: Ic19e8a6b6fbdeb2c86be14a33a306dd0f3088b1b
2023-07-04 11:52:40 +01:00
Matthias Mullie 23ae8d39c3 Handle translated special page names
On certain special pages, like Special:Search, MMV is
intended to launch anyway. The existing check, however,
assumes that those pages will actually be called that,
but in non-English languages, it's often something
different (e.g. Recherche or Pesquisar).
This then results in MMV not being present on those
pages in those languages, even though it was intended to.

The fix is to simply make sure to case both titles to
the local form and then compare them.

Bug: T323650
Change-Id: Iec01ddf4c1ea4ec5d9c42de5a6a3140470ad5052
2023-06-30 14:09:00 +02:00
gerritbot ae9ed54305 Update moved class Category
See T321882. Moved in I0b86acfdea

Bug: T321681
Change-Id: Id444a14c41cdf9a887fbd81fa9abd47d187c8df0
2023-05-12 14:33:11 +00:00
Simon Legner d2ab19fdac Remove most uses of jquery.tipsy in MediaViewer
Tipsy was added in I993bf60909024453a14de85af6239bded02eb8a6 however
has since been deprecated and usage is discourage.

Falling back to standard HTML `title` attribute display seems fine. Some
buttons (such as previous/next arrow) have not had a tipsy tooltip.

To be done separately: TipsyDialog which is used for StatusInfo

Bug: T77402
Change-Id: I2f7ae189734ba6d6e67ca703a42ae899ec56729d
2023-05-02 18:21:57 +00:00
Thiemo Kreuz d40e309a9f Streamline user options check for readability
E.g. using the ?? syntax, and turning the conditional around.

Change-Id: I6240f677ad47a60cccab5ba4c75ebef633e498ce
2022-09-29 16:00:47 +02:00
Sam Smith 34e4968b2c Remove instrumentation
The MediaViewer and MultimediaViewer* instruments were disabled circa
October 2021 in Ie7dd8739efc.

This patch removes those instruments and any supporting code and data.
Notably, this patch does not remove the mw.mmv.logging.ViewLogger
instrument, which is responsible for logging image views.

Bug: T310890
Change-Id: I97d41be93849b2ae9d1adba6660546ea716657fd
2022-07-05 17:41:24 +00:00
Reedy e49e7da070 Namespace extension
Change-Id: Ic480033a3a2418e41d39aaf777872587c11f1786
2022-02-06 15:24:30 +00:00
vladshapik 0e00f3e2f7 Avoid using User::getOption
Remove using of User:getOption since this method
will be hard-deprecated. Now it is soft-deprecated.

Bug: T296083
Change-Id: Ic7d52a3be7bcfef8827d3fa33b663fbe05fef3f8
2021-12-01 17:31:55 +01:00
Reedy cb6d6ef0cb Remove method_exists() calls on $file
getWidth and getHeight have existed in file for at least 15 years...

Change-Id: I96a9f3b08cb25db9e0cacd0fd25375aec2af9964
2021-10-19 16:13:13 +01:00
vladshapik 5dfaa7f653 Avoid using User::getDefaultOptions
Remove using of User::getDefaultOptions since this method will be hard-deprecated. Now it is soft-deprecated

Bug: T276035
Change-Id: If2647bf24969a277a795e46b620cc81937c147c2
2021-03-01 11:42:55 +02:00
James D. Forrester 98797b5a03 Use User->isRegistered(), not deprecated isLoggedIn()
Bug: T270450
Change-Id: Ie10652c4d9831f5582a027c7dc9cf1b1ddfc481b
2020-12-17 18:26:35 -08:00
jdlrobson 9a25e19bfe Do not queue MMV modules on the mobile domain
Document the compatibility problem between MobileFrontend
and Minerva.

Note that on Minerva when running in desktop mode, the code
in this extension runs (not MobileFrontend).

Bug: T235712
Change-Id: Iafe508cbd19b3f77f553219bf4c28f04ba147fe9
2019-11-05 19:01:30 +00:00
Thiemo Kreuz f2b247cb2f Add missing type hints to hook handler functions
This patch also removes some & from function parameters that are not
meant to be passed "by reference". These & are from a time when PHP 4
passed objects by creating expensive copies. They are not needed any
more, but create the wrong impression the hook handler function would be
allowed to replace these objects with other ones.

Change-Id: If91c6d963150f909735f2c06f98a446ae1fb2047
2019-05-11 13:44:05 +02:00
Thiemo Kreuz 0fe650ce08 Add @see links pointing to the MediaWiki hooks manual
Change-Id: I1980f488f8516fe8700ffdae4905e09446b322de
2019-05-10 19:18:49 +00:00
jenkins-bot ac1cc30d8a Merge "Rename all hook handler functions to follow on<HookName> scheme" 2019-05-10 15:53:07 +00:00
Thiemo Kreuz 44457ec926 Rename all hook handler functions to follow on<HookName> scheme
Change-Id: Ic770a9dd0a708a670a8658d3be037c7b73ebea83
2019-05-10 14:26:15 +02:00
Thiemo Kreuz 7c67c4ba81 Remove all default "return true" from hook handlers
This is the default for many years now. Returning true is not different
from returning nothing.

Change-Id: If05c82d4a534d21269934aebb48786a97246ac88
2019-05-10 14:18:37 +02:00
James D. Forrester 23b2f78642 Remove the BetaFeatures integration
Not used in years. Sadly $wgMediaViewerEnableByDefault has to remain
for now.

Change-Id: If2d90627de230b9b36e7b24abe0d4bdee8a2ef35
2019-05-08 11:22:35 -07:00
Timo Tijhof c520b76978 Rename MakeGlobalVariablesScript hook for consistency
Given case-sensitive search, the callback didn't show up
when searching for "MakeGlobalVariablesScript", unlike for
almost every other deployed extension.

Change-Id: Ib9138446a898802150a123e140a14bfba08709e6
2019-04-16 22:59:25 +00:00
Ed Sanders 551a0561fe Always load MMV on Flow pages
We can't tell if there are images on the page, so just always
load. The code will likely be in the client cache anyway.

Bug: T62014
Change-Id: Idaec22c3fd7126c1818c5febbccd6a0cfac7b721
2019-03-13 21:56:02 +00:00
jenkins-bot a68bd2a10b Merge "Replace use of deprecated ResourceLoaderTestModules hook" 2019-03-05 13:06:05 +00:00
Umherirrender 0312e465ed Use ExtensionRegistry rather than class_exists
Change-Id: I99d0207aaf193ab2aa4e27c7f12a5cefc2dc4da9
2019-03-03 02:05:12 +01:00
James D. Forrester 8ec4150af0 Replace use of deprecated ResourceLoaderTestModules hook
Use the new extension.json attribute instead.

Bug: T214211
Depends-On: I27ecebe27d7aaebe6d1317bc5eaea9cca368b45d
Change-Id: Iacb68ce9a7bab864720ef9a56f8702a4f02c129d
2019-02-13 15:05:33 -08:00
Eric Gardner bbaf7a38b4 Get Rid of EmbedFileInfo
* Deletes the mmv.model.EmbedFileInfo class file and its test file
* Updates the extension.json and MultimediaViewerHooks.php files to reflect
  these deletions (by removing entries from dependency lists)
* Refactors all instances of `new mmv.model.EmbedFileInfo()` to instead use a
  POJO with appropriate properties. Conditional assignment is used for the
  caption and alt properties if there is any chance they won't be available, to
  keep from adding props with falsy values.
* Refactors JSDoc method annotations so that `@param` tags expecting an
  EmbedFileInfo instance now expect an object; relevant properties of this
  object and their types have been added to the method annotations as well.

Bug: T77320
Change-Id: Ie9f5f24136f4b73000259685474ce4d765a3ccd3
2019-02-05 15:31:49 -08:00
Kunal Mehta cdac35ffda Register EventLogging schemas in extension.json
Change-Id: I7102950ff23fe6cb7f61d5a067076ddd77b10096
2018-07-26 09:51:31 -07:00
Kunal Mehta 03eb49cde1 Remove unnecessary $wgExtensionFunctions
As best I can tell, adding the `ext.eventLogging` module as a dependency
for these three modules is unnecesary. One of those modules doesn't
even exist, and my greps across the entire extension show that
mmv.logging.Logger.js uses `mw.loader.using` to load the module, so a
server-side dependency isn't required.

As an aside, this extension should probably use the more abstract
`mw.track` interface instead.

Bug: T180192
Change-Id: If71277114be5a003d8f51040e52a601ace983c51
2018-07-25 17:02:59 -07:00
Kunal Mehta e735c9bcff Move Hooks file into includes/
Change-Id: I534501cf06832fc53a5814f1e58cce00d32d09bb
2018-04-14 01:05:33 -07:00