Commit graph

65 commits

Author SHA1 Message Date
Thiemo Kreuz 62f3d828b8 Update some generic/unspecific PHPDoc type hints
Change-Id: I30ad46cc9d503b4403dd2e0ab263d0db2039a8e3
2019-06-04 17:33:17 +02:00
Kunal Mehta b28ad14b8c Upgrade to newer phan
Bug: T216919
Change-Id: I3a403891eafa703215a79526fcf9469b1fd6edc6
2019-03-17 16:39:02 -07:00
Max Semenik 963f3c1525 Don't use deprecated Sanitizer::escapeId()
Change-Id: Ia92e685d33e377669b034b02819e183efe77e4f2
2019-02-22 12:26:17 -08:00
Fomafix be4e6db51d SpecialGadgetUsage: Add Infinity as sort-value for defaults
This change ensures that gadgets that are enabled by default are sorted
with a higher value than the other gadgets.

Change-Id: I02fab73c85b4c3580e484832c91a7314c797e978
2019-01-22 04:58:39 +00:00
Fomafix 49ec533e8d Fix typo in comment
This typo was introduced in 88d0b223.

Change-Id: Ib9adde89ccc1fca6bac0ceb5ba409637a03f7dd7
2019-01-04 23:11:51 +01:00
Umherirrender 6b2e46b142 Declare visibility on SpecialGadgetUsage::__construct
Change-Id: Id98c214770224e6d5b65e1c164a6663e09861a0f
2018-10-31 23:18:47 +01:00
Aaron Schulz 1204d238f0 Increase loadGadgets() expiry to 15 seconds to avoid stampedes
Bug: T203786
Change-Id: If45b91987f3f523139e5e66f546be17a455647fe
2018-10-30 15:55:51 +00:00
Aaron Schulz 1acde38a6a Randomized APC gadget definition refreshes to avoid stampedes to memcached
Bug: T203786
Change-Id: If87e752f5cdc6bd216ad96486a86a40b2477b315
2018-10-19 01:57:07 +00:00
Aaron Schulz 93137ec581 Clean up gadget definition key code
Change-Id: Ic3116de9f5b76375c908f540a29945203f14d4c5
2018-10-05 03:29:29 -07:00
Umherirrender c8b50c30ee Fix caller name in GadgetDefinitionNamespaceRepo::getGadgetIds
Seeing {closure} in the logs as caller is not helpful

Change-Id: I1bfefd86aa0929ddafff3ccbdf50730a22fcdcb4
2018-09-30 13:47:56 +02:00
Timo Tijhof 848775d925 SpecialGadgets: Restore line breaks between actions and uses
Follows-up f3da602. I accidentally removed the first of the
line breaks.

Bug: T204616
Change-Id: I53b43acb5c0d43443b2f62bd335fc013d2e23539
2018-09-26 03:46:10 +01:00
Timo Tijhof f3da602058 SpecialGadgets: Omit blank space due to <br> between <ul> and <p>
Due to some of the portions of the gadget list items being optional
it's not consistent whether or not they should be separated by
a line break.

When two pieces of text follow each other, there should be a line
break in-between.

When a piece of text is output afte a list, however, there is no
need for a line break as anything after a list would already
become its own line. Printing one anyway causes a blank space
to show up, which visually causes it to appear related to the
next gadget.

Fix by setting a boolean after each portion to indicate whether
or not it should be followed by a line break.

Also improve the code a bit with comments and use Html instead
of Xml.

Bug: T204616
Change-Id: If65e170746898999dd8f5351004eeaf49b340ab2
2018-09-17 23:33:35 +01:00
Timo Tijhof e369419bdd SpecialGadgets: List right names instead of descriptions
The lengthy and localised descriptions make it hard to scan and
identify the actual rights themselves. They are meant as descriptions
to explain what a right is, not to identify the right itself.

It should probably be more similar to the list of checkboxes
on Special:UserRights. For now, kept the descriptions as tooltips,
but could also remove them entirely.

Change-Id: I29f68ffd5a8d002b65384f3762fb9e5631c13def
2018-09-17 23:17:44 +01:00
Bartosz Dziewoński 52d57c6597 Avoid 'rawrow' for HTMLForm 'info' fields
The wrapper tags that we have to create when using the 'rawrow' option
would have to be different for OOUI and non-OOUI preferences forms,
making it impossible to support both at the same time.

We used it in order to generate `<td colspan=2>...</td>` rather than
`<td></td><td>...</td>`, and make the description span both the label
and the input columns. However, this is not necessary, because the
label column is entirely hidden on this page of preferences, as all of
the preferences have no labels.

Bug: T203202
Change-Id: Ib9510a8bfb2430fdda3988d88628c9f0c509c6d0
2018-09-03 18:19:34 +02:00
Thiemo Kreuz 01a3de04e7 Remove not needed properties from "info" form field
* "raw" and "rawrow" are documented as booleans.
* "raw" does not have any effect if "rawrow" is set.
* "label" does not have any effect if "rawrow" is set.
* "noglobal" refers to GlobalPreferences. It does not have any effect
  because "info" fields are blacklisted anyway.

https://github.com/wikimedia/mediawiki-extensions-GlobalPreferences/blob/master/includes/GlobalPreferencesFactory.php#L75

Also see my longer comment in I1ab2bc6 where I explain all these changes.

Change-Id: I7b4e08b45070ae07935e1cd59091b3d608583e5b
2018-08-20 14:41:35 +00:00
jenkins-bot a6c181e610 Merge "SpecialGadgetUsage: Add <thead> and <tbody> in the table" 2018-08-15 05:00:22 +00:00
jenkins-bot 7fddd2bdc7 Merge "Use ContentLanguage service instead of global $wgContLang" 2018-08-12 04:56:26 +00:00
Derk-Jan Hartman 9e24c3a551 RL: Simplify userrights check of Gadgets
Change-Id: I135dcfdba72014803b8ce9710680fb5574f76d04
2018-08-08 13:46:24 +00:00
Fomafix b6e7bcf015 Use ContentLanguage service instead of global $wgContLang
This change raises MediaWiki version requirement to 1.32.

Change-Id: Ieffed829bf5a8e1f138fd5f63518e415cebb1287
Depends-On: I193f5b9a95430b0a05573c361715e053e5411e32
2018-08-05 00:52:53 +02:00
jenkins-bot ef4c537d9e Merge "Fix skins option to use currently displayed skin, rather than user preference" 2018-08-03 18:53:39 +00:00
Matt Russell b340532c52 Fix skins option to use currently displayed skin, rather than user preference
The user's preference usually reflects the displayed skin, however this isn't
true if the `useskin` URL query is set, or MobileFrontend is being used.

This fixes gadgets being displayed on the wrong skin when using `useskin`,
and allows mobile-specific gadgets (using `skins=minerva`).

Testing if the gadget is allowed in the current skin is split out from
`isAllowed` to `isSkinSupported` to enable a future patch showing gadgets
on preferences regardless of if they are allowed on the current skin.
Test coverage is added for both functions.

Also fixed another test which wasn't working, presumably because the placeholder
user didn't have the "read" right, so the section wasn't being kept.

Bug: T199478
Change-Id: I21febe92d54d6d0b89925f902581cc2739d824fb
2018-08-01 11:06:17 +10:00
Fomafix 3aeffaa12b SpecialGadgetUsage: Add <thead> and <tbody> in the table
Change-Id: I53f61ce4c7d0721171a455e25b560ce33d4109b9
2018-07-30 21:38:20 +02:00
Fomafix 98ac345756 Use $lang->equals() to compare Language objects
Change-Id: Iae691c2b1e4f34bb0f509a109333277ade900659
2018-07-30 20:01:18 +02:00
libraryupgrader 33ecce01c0 build: Updating mediawiki/mediawiki-codesniffer to 20.0.0
Change-Id: I210883a100f2060e9bff0d5066896ce35b45a788
2018-05-26 03:01:39 +00:00
Kunal Mehta c383794d16 Fix variable name reuse in EditFilterMergedContent hook
Bug: T194695
Change-Id: Ic99e35874f1a3a4a7c1d1c302294bbecd23080ed
2018-05-14 17:11:58 -07:00
Jayprakash12345 54d1eb0d77 Convert Special:Gadgets/export/$par to use OOUI
Bug: T191822
Change-Id: Ia59918a1a7f10d56a5c32050591a537d90c6de7c
2018-04-09 23:20:17 +05:30
jenkins-bot 435d0f4fcd Merge "Use SPDX license identifiers for @license" 2018-04-07 21:06:34 +00:00
jenkins-bot 4ca18e2fac Merge "Change ResultWrapper to IResultWrapper in special page" 2018-04-07 21:06:33 +00:00
Kunal Mehta bb81950e9f Use SPDX license identifiers for @license
Change-Id: I7eaf1d7bd11642f40a59505c1586fb393bf35283
2018-04-07 08:42:12 +00:00
Umherirrender 75ce384e42 Change ResultWrapper to IResultWrapper in special page
Follows core change I22ec4d3a9a19fc86efc9a2deb06f810695d38c85

Change-Id: I3f5e63478761e2cf312f75771b152d01111a3fa6
2018-04-07 10:35:58 +02:00
Sam Wilson 97c5bd7732 Prevent gadget preferences from being cleaned up
Bug: T188966
Change-Id: I5627f014827fdbf266eb7fdb00a446f81a0c3458
2018-04-06 20:06:11 +00:00
Kunal Mehta e99e181303 Add phan configuration
Depends-On: I09a0c0a786b687997e61344847f8af08b20cebf2
Change-Id: I9500232fb524e884d6cb15f2bdda10835df35ad4
2018-02-26 12:57:40 -08:00
Kunal Mehta 677d4e932c Move classes into includes/
Change-Id: I10bc5234ad2ebeed2514aafc3dbe2a0afa983bd8
2018-02-25 11:19:23 +00:00
Thiemo Mättig f564d52d9a Fix PHPDocs of GadgetDefinitionContent::getDeletionUpdates
DataUpdate is a specific implementation (currently the only one), while
DeferrableUpdate is the interface. Binding against the interface is
enough, and what the base classes already do.

I'm also removing a line of meaningless documentation. "Creates an
instance of this class" is a general description that is true for all
constructors.

Change-Id: Ia6dc86b078628db5e0ab68ef46bf0396567b767c
2018-01-24 14:51:16 +01:00
Kunal Mehta a544c227f2 Avoid hardcoding specific GadgetRepo implementations for cache invalidations
Depending on GadgetRepo::singleton() to return a specific implementation
is fragile. Pass each created/updated/deleted page to
GadgetRepo::handlePageCreation/Update/Deletion() and let each specific
implementation deal with it.

Use LinkTarget to be TitleValue compatible for the future.

Change-Id: Ibe2e26d12369a897c53757adf621926f62af7f7b
2017-11-07 12:13:11 -08:00
libraryupgrader 969027392e build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
Change-Id: I40598f8c34691bbe7b217aa38f24f150a210e2f3
2017-09-24 05:26:03 +00:00
jenkins-bot bea78b0726 Merge "Account for DB lag in loadGadgets() caching" 2017-09-01 02:09:40 +00:00
Aaron Schulz 155d108c02 Account for DB lag in loadGadgets() caching
Bug: T157210
Change-Id: I86a32407af4d6ebb4fa2e16005c76081a113e8c8
2017-08-31 15:29:05 -07:00
Umherirrender 88d0b22359 Improve some parameter docs
Change-Id: I268aaa13d07985b0915774e83c487cd22568b161
2017-08-27 16:07:08 +02:00
jenkins-bot 371cfc1936 Merge "Move gadget styles from main stylesheet request to site request" 2017-06-21 20:32:46 +00:00
Kunal Mehta 837c8403fd 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.FunctionComment.Missing.Protected
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: I38d7f39d2d00e8d26dad4c6281885b54203b23b7
2017-06-20 00:06:01 -07:00
Timo Tijhof 8c35ed5cf1 Move gadget styles from main stylesheet request to site request
This is a resubmission of 86905f8, which was reverted because
of a bug in ResourceLoader that caused gadget styles to be
concatenated in the request for site.styles (fixed: 15ca48ad).

This change ensures that gadget styles no longer get combined with styles
from core, skins and extensions in their early stylesheet request. Instead,
they now load after the 'ResourceLoaderDynamicStyles' marker directly
after the site.styles module request.

Bug: T147667
Change-Id: I16b9901de78e7ee913c4faa55ff9fc9c77fe73ba
2017-06-07 18:36:17 +00:00
Umherirrender f102194baf Add phpcs and make pass
Change-Id: I02b7f85f54ffaf8a1c9d5bed6fa20abb1627afe5
2017-05-31 16:36:45 +02:00
Thiemo Mättig 6b22f1089e Use …->assertArrayHasKey() instead of isset()
… as well as update a line of documentation I had stashed. I think this
does not need it's own patch, or does it?

Change-Id: I99eee1f7b5ec96c1c75e73d66200bc41807452fa
2017-05-31 07:52:18 +00:00
Legoktm ccf1f6818d Revert "Move gadget styles from main stylesheet request to site request"
This reverts commit 86905f8d78.

Bug: T165040
Bug: T165031
Change-Id: I523f46f442946c4cccd6f9eaedc877d871643672
2017-05-11 17:15:20 +00:00
Timo Tijhof 86905f8d78 Move gadget styles from main stylesheet request to site request
This ensures that:

* It will load in the request for module=site.styles
  instead of the request for core, extension and skin modules.
* It will load after the 'ResourceLoaderDynamicStyles' marker
  instead of before.

Bug: T147667
Change-Id: I762a188b8ddfc192121f89ef01afaa4b5bf31b98
2017-05-01 17:27:06 -07:00
Aaron Schulz f53828bf57 Avoid wfMessage() call in Gadget cache updates
This avoids purge problems due to layered caching. The message cache
is known to take a while to regenerate and uses lockTSE=300.

Bug: T157210
Change-Id: I418e160ddb61c4d3654780f5d2bbb14bc2827e2a
2017-03-09 06:03:03 +00:00
Aaron Schulz 5fd412b41d Code style/uniformity cleanups to GadgetDefinitionNamespaceRepo
Change-Id: Ic49383ac1ef99494050005c3641aa6a758fe3e8c
2017-03-02 21:32:54 -08:00
Aaron Schulz dbccf81ffd Minor code style cleanups
Change-Id: Ia4390dcdba6fc809610b036896223448270641d6
2017-02-27 14:08:51 -08:00
Timo Tijhof dc4ea6cb21 Implement 'peers' feature for loading extra styles-type gadgets
Ref discussion on T42284.

Test plan:
* Create gadget A with a .css file only. (Maybe mark as 'hidden')
* Create gadget B with .js file, and peers=A.
* Verify that enabling B will result in B being loaded as general module,
  and A being loaded as page style module.

Change-Id: Ib6207e72c576ff387ecdba685a063bdfbb828199
2017-01-02 14:45:09 +01:00