Commit graph

30 commits

Author SHA1 Message Date
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