Commit graph

11 commits

Author SHA1 Message Date
Umherirrender
130ec2523d Fix PhanTypeMismatchDeclaredParam
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff

Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
2018-07-07 00:34:30 +00:00
Tpt
983dad7457 mw.language.specialcharacters: Add Canadian Aboriginal group
Bug: T108626
Change-Id: Ia337d42c6ef7f9645f1dd843ef0e7553857f6aa3
2017-04-05 18:19:40 +00:00
Ed Sanders
85b2c30d1a Follow-up Idb1202579: Add special-characters-group-greekextended to RL module
Bug: T130535
Change-Id: I3e26d08a34283eaafe129dbef0944ea10c086162
2016-04-14 19:50:10 +01:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Timo Tijhof
afcfc3290c resourceloader: Consistently refer to the framework as ResourceLoader
Change-Id: Ia59e4eac9662723e80d62f7cfcb9e4292e3ee4de
2015-10-28 03:24:40 +00:00
Timo Tijhof
2581453fac resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.

Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.

Benefits:
* Remove all methods and logic related to querying database and disk for
  timestamps, revision numbers, definition summaries, cache epochs, and more.

* No longer needlessly invalidate cache as a result of no-op changes to
  implementation datails. Due to inclusion of absolute file paths in the
  definition summary, cache was always invalidated when moving wikis to newer
  MediaWiki branches; even if the module observed no actual changes.

* When changes are reverted within a certain period of time, old caches can now
  be re-used. The module would produce the same version hash as before.
  Previously when a change was deployed and then reverted, all web clients (even
  those that never saw the bad version) would have re-fetch modules because the
  version increased.

Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=

Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule

The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.

Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.

Ref T98087.

Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-18 20:39:38 +00:00
Andrew Green
7e0d3369c2 resourceloader: Add context param to ResourceLoaderModule::getDependencies
By providing context as a parameter in getDependencies, we allow
modules to dyanamically determine dependencies based on context.
Note: To ease rollout, the parameter is optional in this patch. It is expected
that it will be made non-optional in the near future.

The use case is for CentralNotice campaigns to be able to add special
modules ahead of deciding which banner to show a user. The dynamically
chosen RL modules would replace ad-hoc JS currently sent with some banners.
A list of possible campaigns and banners is already sent as a PHP-
implemented RL module; that's the module that will dynamically choose other
modules as dependencies when appropriate. This approach will save a round
trip as compared to dynamically loading the modules client-side.

For compatibility, extensions that override
ResourceLoaderModule::getDependencies() should be updated with the new
method signature. Here are changes for extensions currently deployed on
Wikimedia wikis:

* CentralNotice: I816bffa3815e2eab7e88cb04d1b345070e6aa15f
* Gadgets: I0a10fb0cbf17d095ece493e744296caf13dcee02
* EventLogging: I67e957f74d6ca48cfb9a41fb5144bcc78f885e50
* PageTriage: Ica3ba32aa2fc76d11a44f391b6edfc871e7fbe0d
* UniversalLanguageSelector: Ic63e617f51702c27104e123d4bed91983a726b7f
* VisualEditor: I0ac775ca286e64825e31a9213b94648e41a5bc30

For more on the CentralNotice use case, please see I9f80edcbcacca2.

Bug: T98924
Change-Id: Iee61e5b527321d01287baa03ad9b4d4f526ff3ef
2015-06-09 03:10:20 +01:00
Timo Tijhof
64ecc77422 resourceloader: Remove redundant getModifiedTime implementations
Follows-up f37cee996e which replaced the getHashMtime() and
getDefinitionMtime() methods with dummies that always return 1.

These getModifiedTime() implementations were only tracking the
definition summary or custom hash, which is already tracked
by getVersionHash().

Notes:
* SpecialCharacterDataModule: This one was odd as it was tracking
  both the mtime *and* the file contents.

* UserCSSPrefsModule/UserOptionsModule: Remove redundant caching.
  Already taken care of by getVersionHash() as of f37cee996e.

Bug: T94074
Change-Id: I6e37c3c2f85ef4599a8643b0efabc18de2f51ec4
2015-06-03 14:27:38 +00:00
Timo Tijhof
281a1847d7 resourceloader: Use absolute file path in SpecialCharactersDataModule
Follows-up ec2330f.

When called, it fails fails:
> file_get_contents(resources/src/mediawiki.language/specialcharacters.json):
> failed to open stream: No such file or directory

Needs to be expanded relative to $IP, just like ResourceLoaderFileModule
and others do already.

Not previously caught by unit tests because this method was never
called from any tests.

Change-Id: Id87b3de29a61039d87b630202f1f71f112cbd752
2015-05-09 04:48:24 +00:00
Alex Monk
8388cde849 Fix dependency of ResourceLoaderSpecialCharacterDataModule
I think this is probably what's causing the test failure in I3fafc561 on PS7

Follows-up If9c5cdbe

Change-Id: I8fafd734db49fdfaf088c68098c41920a2e6011b
2015-03-27 22:11:01 +00:00
Alex Monk
ec2330f7f9 Move WikiEditor's special character data and messages into core for use in other extensions
Using a ResourceLoader module to send the data to the client

For I3fafc561

Message changes:
wikieditor-toolbar-characters-page-.* -> special-characters-group-
wikieditor-toolbar-characters-(endash|emdash|minus) -> special-characters-title-

Bug: T91608
Change-Id: If9c5cdbe077e8796e1ebae99f759331251b5c4b1
2015-03-27 17:40:09 +00:00