Commit graph

58 commits

Author SHA1 Message Date
Kunal Mehta b105abff1b Remove unused variable
Change-Id: Ib3237e16a332072c2a5840b27c391e89dcac3a69
2015-10-06 13:26:26 -07:00
Southparkfan dbecdaee62 chmod 644 for php and json files
Bug: T111743
Change-Id: I3ebc7c05f4a598a702cbd2948147dade3323e994
2015-09-08 18:06:35 +02: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
Kunal Mehta e858bda308 Add abstract GadgetRepo and MediaWikiGadgetsDefinition implementation
GadgetRepo is an abstract class based off of the implementation in the
RL2 branch.

It is a singleton that provides basic methods to construct and interact
with Gadget objects.

The MediaWikiGadgetsDefinition class is an implementation of GadgetsRepo
that parses the "MediaWiki:Gadgets-definition" page for gadget
definitions.

Tests were left in place to demonstrate that no functional changes have
been made aside from relocation of code. Some tests should be moved to
separate files in the future.

Bug: T106176
Change-Id: I3e802889f6f495783f4dbac65c2a8cefa824a778
2015-08-01 15:10:07 -07:00
Aaron Schulz 2bd2ef99c5 Removed caching config variables and always enable caching
* APC will be used if around as a tier 1 cache
* This also makes it easier to have mixed zend/hhvm servers

Bug: T106743
Change-Id: Ie9f234753f78215441474dddc4eadedbd2b76ad7
2015-07-23 15:26:06 -07:00
Kunal Mehta d537e50256 Refactor Gadget construction process
The current method of setting private properties prevents the Gadget
object from being constructed by another class (like a GadgetRepo).

Instead, lets pass in arguments in an array.

Change-Id: I86853c72dfb323fb3e54be9ecff85973e30fe781
2015-07-18 02:26:25 -05:00
Alex Monk ca8880a634 Set 644 file permissions on .php files
Bug: T104039
Change-Id: I5a040819ae53ce9e4da7ed542ed1f74253129a86
2015-06-27 18:50:31 +01:00
Andrew Green da30614641 Update GadgetResourceLoaderModule::getDependencies method signature
This change is for compatibility with Iee61e5b527 in MediaWiki.

Change-Id: I0a10fb0cbf17d095ece493e744296caf13dcee02
2015-06-09 02:28:53 +01:00
Aaron Schulz 68b8b406aa Added a blind 10 second TTL to loadStructuredList() for local caching
Change-Id: Ieb1e91f3fbabb279969017d741ae2825502b2ad5
2015-05-29 14:35:46 -07:00
Gilles Dubuc 3b141e7276 Acknowledge that gadgets have their position explicitly defined
Bug: T97410
Change-Id: Ie5dff4f63a0068f47daf4e6d1fcc7a99d008ca52
2015-05-26 12:08:01 +02:00
Aaron Schulz 11e1c51d6b Conversion to using WAN cache
* Bumped the key version due to key wrapping
* Removed isValidList() gived the key versioning
* Follow up ba1311c323 by making APC viable;
  previously, definition purges would not work

Bug: T93141
Change-Id: I6da3eede044bf4b840b3f9656a1ae8105941dc6b
2015-05-23 23:04:06 +00:00
Ori Livneh ba1311c323 Make the ObjectCache implementation used for Gadget def's configurable
Add a configuration option, 'GadgetsCacheType', which may be used to specify
the ObjectCache type to use for gadget definitions.

Change-Id: I1e02f7b6c470c5fffa014c6247c71f43a69420b6
2015-05-11 18:17:36 -07:00
Chad Horohoe fb5c2ba40e Remove obvious function-level profiling
Change-Id: If6ce3558357a64ce5054a40e493d65a07956f471
2015-02-12 11:48:44 -08:00
Kunal Mehta 61f04bab01 Fix $wgGadgetsCaching = false;
Bug: 71988
Change-Id: Ib1012b4d0b0eeabb62812f35b61882bbf9733f3d
2014-10-12 17:26:13 -07:00
jenkins-bot aa84226d0e Merge "Ability to disable gadget caching" 2014-09-07 22:37:21 +00:00
Max Semenik 1e5c7917a7 Ability to disable gadget caching
Change-Id: Ic1653ae896ac0fd7c0165ecee76f807feea6edcf
2014-09-05 15:47:08 -07:00
Max Semenik 3abd0ebf4f Don't save gadget class versions, cache key is already versioned
Change-Id: I00c200c237f35d6e3934ce432271bd4fa968b175
2014-09-05 14:30:41 -07:00
Kunal Mehta b7b52a9029 Check Gadget name is a valid ResourceLoader module name
When loading the Gadget list, check against ResourceLoader::isValidModuleName
to avoid MWExceptions being thrown.

This will lower the max length of a gadget name from 248 bytes to
244 since ResourceLoader requires <= 255 bytes, and we add a
"ext.gadget." prefix in front of the name.

Bug: 19410
Change-Id: Ib74c0866bb333885c747d318418e2c8685ae339c
2014-09-02 17:27:39 +00:00
helderwiki c0e952120e Add space before closing parenthesis
Change-Id: Iea95227e70f87e54efb20dfac70ae7147e3186d2
2014-08-08 17:07:26 -03:00
Max Semenik 0ee165bce8 Move hooks to a separate file
Change-Id: I2cb53bd4beae247c1b983dc8c4482af682acab64
2013-08-30 03:35:07 +04:00
Roan Kattouw 17c820f364 Add 'top' flag to allow Gadgets to top-load
Obviously this should be used sparingly, but it's needed for some
initialization stuff like registering plugins with VisualEditor.

Change-Id: Ifeed524a53601a47b3a945ca0a324bbbead0f1f5
2013-07-23 21:02:19 -07:00
Marius Hoch 4f65685257 Don't cache the gadget-defintion in case no gadgets were found
After some investigation I could only find a few unlike
possibilities which eventually could lead to the issues
described in the bug. In the end I decided that it would
be the easiest and probably most robust solution to simply
don't cache in case no gadgets were found, even if the
MediaWiki page exists.
This shouldn't cause any performance issues as we already
don't cache in case no gadgets could be found in all paths
of this function except after trying to parse the gadget
definition.

Bug: 37228
Change-Id: I3092bcb162d032282fbe263c7f14f4d1ce9163ab
2013-07-14 18:01:37 +02:00
Liangent 867ccb19b4 Gadget-definitions: Make comment matching non-greedy
Change-Id: I1b92e4d84d11ff7493a2ec684815d19f0937caa7
2013-05-24 09:18:09 +00:00
Max Semenik 192d37b19a Allow disabling of legacy gadgets (Mobile support)
The mobile environment differs from the desktop environment so various
gadgets may not work as expected. ResourceLoader deals with this for
normal modules by enforcing a 'targets' property that requires
javascript that wants to run on mobile to specify a mobile target.

This change
* Allow other extensions to disallow legacy gadgets
* Allow specifying module targets in similar way to RL, effectively
creating mobile gadgets

Bug: 44918

Change-Id: I9ee852e33412826608b6039fa01a2b0027b35e7b
2013-05-01 01:48:28 +00:00
Timo Tijhof eca021ed61 tests: Rename file to end in Test.php
Though the hook registration was working fine, the run from
Jenkins was failing.

Jenkins runs like this:

 $ php tests/phpunit/phpunit.php extensions/Gadgets

Which bypasses UnitTestsList and uses auto-discovery within the
given directory of "*.Test.php" files.

Renamed to file to match PHPUnit's internal discovery pattern
and updated the onUnitTestsList callback to use this pattern
as well.

Also updated documentation applied recent code conventions in
this area (extend MediaWikiTestCase).

Change-Id: Iaa52a5eafdebf1529dd02fb1bed89d27c298e0d3
2013-05-01 03:20:39 +02:00
Max Semenik f8cceadc00 Typo in comment
Change-Id: I2ea2a363ea42e690386ba662b201b9a56fbe35f1
2012-11-16 20:58:52 +04:00
Siebrand Mazeland bf416b175a Maintenance for Gadgets extension.
* Use Message class.
* Redice globals usage.
* Update .gitignore.

Change-Id: I087c8209b1a7ccf63171a2c14c8809eed90a297b
2012-08-17 11:28:09 +02:00
Sam Reed df866a5f21 Documentation, code updates, removal of direct member variable access 2012-02-17 21:23:46 +00:00
Roan Kattouw 9009f36e81 Revert r106007 (Split Gadget modules into two, one for scripts and one for styles): I like the concept of having multiple modules, and I'll probably implement this in the RL2 branch, but this specific implementation has issues (subclassing OutputPage, building its own head items) that were pointed out on CR but never fixed. 2012-02-02 19:04:52 +00:00
Liangent f0f203bbba Followup r100509: Don't validate skin names written in the definition page. 2012-01-18 02:44:37 +00:00
Robin Pepermans f6e96b17e9 Bug 30182: add dir="auto" as a workaround for untranslated gadget descriptions 2011-12-13 18:03:00 +00:00
Liangent cbef9a4faf Followup r100497, r101827: use another way which doesn't look that hacky to load styles in gadgets before documents. Also avoid double loading of the same stylesheet.
Now a gadget generates up to three modules:
* The first is known as meta module which still use its original name to keep B/C. It contains no contents, with dependencies of ones specified by user, scripts module, and styles module. See below.
* The second is known as scripts module whose name ends with ".scripts". It contains all scripts in this gadgets, with dependencies specified by user
* The third is known as styles module whose name ends with ".styles". It contains all styles in this gadgets and loaded before documents. After its load it's instantly marked as ready without dependencies resolved (which is the same as dependencies of .scripts but may not be used at all)

The meta module is loaded as if there's only one module under that name, and it's safe for users to reuse that name. The styles module is loaded and marked as ready in <head>, as described above. Normally the scripts and styles modules shouldn't be used by users.

A possible bug that dependency-only gadgets (ie. no scripts or styles) may not be loaded is fixed.
2011-12-13 10:41:51 +00:00
Liangent fadacf486f Followup r101827: It doesn't need to extends OutputPage anymore 2011-11-03 16:12:11 +00:00
Liangent f2478673ee Followup r100497: Fix stuff described there 2011-11-03 16:11:04 +00:00
Liangent 7bdf6f5ca2 Followup r100509: Increase GADGET_CLASS_VERSION 2011-10-24 12:49:33 +00:00
Liangent b9aa1fea37 (bug 31414) Skin specific gadgets 2011-10-22 19:09:25 +00:00
Liangent fb4ad3cac6 Followup r100497: Indention tweak 2011-10-22 05:59:55 +00:00
Liangent 294abd1e32 Move styles in gadgets to the top of pages to avoid flash of unstyled content.
Those styles should be loaded after site and user styles to keep B/C.
2011-10-22 04:32:10 +00:00
Siebrand Mazeland 76b26174eb stylize.php, update whitespace, remove superfluous comment lines
update indentation and sprinkle some braces.
2011-09-23 06:48:37 +00:00
Aaron Schulz ea4dbfd336 Replaced use of wfEmptyMsg() with new Message class. The underlying implementation changed and caused an unstub loop in some cases (like with filecache enabled). Unstubbing $wgLang requires loading $wgUser which triggers a gadget hook, which should not require unstubbing the user's language. 2011-09-23 05:43:40 +00:00
Krinkle e941ac9d18 [ResourceLoader] Set default options for gadgets that are enabled by default, otherwise they can't be disabled from the preferences (bug 30941)
* Uses the new hook in User:getDefaultOptions (bug 30940; r97365)
* This revision is based on a similar one for RL2 in the branch (r97366). Needs to be back ported as the bug occurs in 1.18 as well
2011-09-17 03:03:02 +00:00
Niklas Laxström e4ab22033d Typo and whitespace 2011-04-16 15:48:24 +00:00
Max Semenik 32ea54f472 Gadgets: store category information in class, added getters for description in different forms 2011-04-15 19:41:47 +00:00
Max Semenik dbc8ef531f Bug 13742 - Allow for gadgets to be turned on by default.
Because I'm lazy to do everything twice, README now points to on-wiki docs for definition format.
2011-04-12 18:09:50 +00:00
Max Semenik 1566407b27 Gadgets: bug 12211 - show in preferences only gadgets the user is able to use 2011-04-03 19:01:52 +00:00
Max Semenik 2700695760 Gadgets: refactored [options] parsing in preparation for adding moar 2011-04-02 16:02:53 +00:00
Max Semenik 5c03dc8ff7 Gadgets: add class version to Memcached key. This will help in avoid problems like we had with switches back and forth between 1.16 and 1.17 versions of this extension. 2011-04-02 15:36:59 +00:00
Max Semenik 10fc73e2a4 Adapt Gadgets to changes in r81692 2011-02-20 18:14:38 +00:00
Platonides 5ec0566f1d Merge r81884 (the other half is already in trunk) 2011-02-10 18:05:50 +00:00