Commit graph

14 commits

Author SHA1 Message Date
libraryupgrader 33ecce01c0 build: Updating mediawiki/mediawiki-codesniffer to 20.0.0
Change-Id: I210883a100f2060e9bff0d5066896ce35b45a788
2018-05-26 03:01:39 +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
Umherirrender 88d0b22359 Improve some parameter docs
Change-Id: I268aaa13d07985b0915774e83c487cd22568b161
2017-08-27 16:07:08 +02: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
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 5fd412b41d Code style/uniformity cleanups to GadgetDefinitionNamespaceRepo
Change-Id: Ic49383ac1ef99494050005c3641aa6a758fe3e8c
2017-03-02 21:32:54 -08:00
Fomafix 1a569b590b Convert PHP syntax from array() to []
Performed using:
find . -name \*.php -exec php ~/convert.php -w "{}" \;

Script from:
https://github.com/thomasbachem/php-short-array-syntax-converter

And convert syntax in comments manually.

Change-Id: I7ea9e57f9ab1250c8687885ad9e010771603bf78
2016-12-28 13:51:30 +01:00
Timo Tijhof 846b979578 Remove redundant 'position', 'top', and getPosition() code
Unused as of bc374082fa in MediaWiki core (T109837).

Change-Id: Idcec3c4fa2bc3bc05ac417062139794880040a6d
2016-11-18 13:55:30 -08:00
Timo Tijhof dc834f3933 Implement support for specifying type=styles
T87871 formally introduced the concept of a styles module,
which sets mw.loader.state to "ready" when loaded through addModuleStyles().

Previously, addModuleStyles couldn't safely do that because a module may
contain scripts also, in which case mw.loader must still load the (rest)
of the module (causes styles to load twice).

In MediaWiki core or extensions this is easily avoided by calling not
calling both addModules() and addModuleStyles().

For Gadgets we call both as a workaround to allow users to provide styles
(without a FOUC), but also to provide scripts+styles. Since we don't declare
which one is intended (and some gadgets do both), we loaded them both ways.
This will no longer be allowed in the future (see T92459).

The new 'type=styles' Gadget attribute promises to ResourceLoader that a
gadget only contains styles.

Impact:

* [Bug fix] When mw.loader requires a styles module that already loaded,
            it will not load again.

* [Feature] It is possible for a general scripts+styles gadget to depend on
            a styles gadget. Previously this caused the styles to load twice.

* Specifying type=styles will load the module through addModuleStyles() only.

  Use this for modules that contain styles that relate to elements already
  on the page (e.g. when customising the skin, layout, or article content).

* Specifying type=general will load the module through addModules() only.

  Use this if your module contains both scripts and styles and the styles
  only relate to elements created by the script. This means the styles do not
  need to be loaded separately through addModuleStyles() and will not apply
  to noscript mode.

Effective difference:

* Gadgets with only styles: We assume type=styles.

  This fixes the main bug (styles loading twice) and requires no migration!

* Gadgets with only scripts: We assume type=general.

  This requires no migration! (And: No more empty stylesheet request)

* Gadgets with scripts (with or without styles): We assume type=general, but
  unless type=general was explicitly set we'll still load it both ways so
  that the styles apply directly on page load.

  If this is not needed, set type=general.

  If this is needed, it should become two separate modules. We do not support
  a single module having two purposes (1: apply styles to the page,
  2: provide scripts+styles). The styles module should be separate.
  It can be made hidden, and listed as dependency of the other module.

The latter case is detected on page load and results in a console warning
with a link to T42284.

Bug: T42284
Bug: T92459
Change-Id: Ia3c9ddee243f710022144fc2884434350695699a
2016-09-30 10:43:29 +00:00
Kunal Mehta 519f30355e Implement Gadgets definition namespace repo
Implements:
* Gadget definition content and content handler
* Basic validation for gadget definition content
* GadgetDefinitionNamespace implementation of GadgetRepo
* DataUpdates upon editing/deletion of Gadget definition pages
* EditFilterMerged hook for improved error messages
* 'GadgetsRepoClass' option to switch GadgetRepo implementation used
* Lazy-load the GadgetResourceLoaderModule class so we don't need to
load each individual gadget object unless its needed

Note that Special:Gadgets's export feature intentionally doesn't work
yet, and will be fixed in a follow up patch.

Bug: T106177
Change-Id: Ib11db5fb0f7b46793bfa956cf1367f1dc1059b1c
2015-11-20 12:01:21 -06:00
Timo Tijhof e009534e5c Remove position default logic
Follows-up 3b141e7.

See also Ib9821b7b87 in MediaWiki core.

Change-Id: If385f4c9bcf88b824099effa3c5b93545f372e82
2015-10-27 03:40:23 +00:00
Kunal Mehta 152484566d Add support for 'messages' and 'hidden' gadgets
In the backend, allow:
* Adding dependencies on messages
* Marking gadgets as hidden so they don't show in preferences

These cannot be used by MediaWiki:Gadgets-definition gadgets, but will
be used by Gadgets 2.0 gadgets.

Change-Id: I55e97de9d631ae001ccc0164db172ba9c5689a34
2015-08-08 00:43:16 +00:00
Kunal Mehta adcb193a1b Move GadgetResourceLoaderModule class to separate file
Change-Id: Ic7dde135168a04fc5916e5f44acd6b8639c8ce1a
2015-08-01 15:10:15 -07:00