Commit graph

36551 commits

Author SHA1 Message Date
Bartosz Dziewoński
aa00a3e838 ResourceLoaderImageModule for icons
ResourceLoaderImageModule needs a set of SVG files and some data in
the module definition, and produces styles for a set of CSS classes,
one for each image, optionally with differently colored variants,
generated in SVG and PNG, data-URI-embedded if possible, compatible
with all browsers, and generally slick.

The intended usage is to ship icon libraries with MediaWiki that can
be used throughout the pages with no additional code.

* ResourceLoaderImageModule implements all of the logic for data
  parsing and CSS generation.
* ResourceLoaderImage implements the logic for SVG image colorization
  (for variants) and rasterization.
* ResourceLoader and ResourceLoaderContext were extended to serve a
  new kind of load.php request that delivers a single image file. This
  is used for fallback PNG images served to browsers that don't
  understand SVG.

See change Ic6a76bfb for a demo.

Bug: T76473
Co-Authored-By: Trevor Parscal <trevorparscal@gmail.com>
Co-Authored-By: Bartosz Dziewoński <matma.rex@gmail.com>
Change-Id: Idf6ff4eb8e94f45946f15d283d34108b881fae6e
2014-12-09 20:11:07 +01:00
jenkins-bot
2b40dd3ed7 Merge "Fix for broken thumbnails when the file width is in $wgThumbnailBucket" 2014-12-09 15:03:02 +00:00
Brad Jorsch
ce0de4aa88 API: Don't double generator list
Bug: T77974
Change-Id: I1746da0f802e6ab7f87c83ad9918c05f98ab5ea8
2014-12-09 09:28:35 -05:00
Gergő Tisza
555b1f800f Fix for broken thumbnails when the file width is in $wgThumbnailBucket
When the source file width equals a bucket width,
File::getThumbnailBucket() suggests the use of a thumbnail of that
size. A thumbnailing attempt with the same width as the original 
usually returns an error; File::generateBucketsIfNeeded() creates
an empty temporary file to later overwrite with the thumbnail, and
does not clean that file up on error. This empty file is then used 
as the intermediary thumbnail for everything in the top bucket.

Bug: T77950
Change-Id: I8c2fdd9b51d227f34cac874ed2b16c87adc9315d
2014-12-09 02:25:25 +00:00
jenkins-bot
d2674373c5 Merge "resourceloader: Refactor empty value trimming for mw.loader.register" 2014-12-09 01:05:20 +00:00
Timo Tijhof
c0c221bfe4 resourceloader: Refactor empty value trimming for mw.loader.register
We already did this, but it was rather convoluted with lots of
if/elseif sequences checking all the possible values.

Remove this logic from ResourceLoaderStartUpModule. Simplying it
simply create the array and pass it to ResourceLoader::makeLoaderRegisterScript.

In makeLoaderRegisterScript, we apply a filter to the array(s) that
trim empty values.

While at it:
* As with other registration properties' default values (like for dependencies,
  group, and skip) also use 'null' for the default value of 'source'.
  The mediawiki.js client was already compatible with this, and the server omitted
  it if it was the last value in the list. But in all other cases it explicitly
  outputs "local". Use null instead of simplicity sake. This also gains us a
  few characters in the output, and a relatively larger win after gzip since
  there's lots more re-using of "null".
* Remove stray casting of $version to int. This only happened in case of
  registering a single module (which don't do anywhere), and is redundant.

Change-Id: I1f321e7b8bd3b5cffc550b51169957a3da9b971d
2014-12-09 00:47:14 +00:00
Aaron Schulz
1b32de48d5 Made xhprof scopedProfileIn() work via merging SectionProfiler results
* This works around various pecl/hhvm xhprof extension issues.

Change-Id: I04555db1d0781bafc758ab9965c4af2fab9569f4
2014-12-08 23:39:37 +00:00
Aaron Schulz
e145b81e5d Refactored xhprof getFunctionReport() to use getFunctionStats()
* Also added more doc comments to getFunctionStats()

Change-Id: I3741713d3c80b0bbc622eb17ce4c3a047bf5a06c
2014-12-08 23:39:18 +00:00
Aaron Schulz
848cad74e8 Fixed running percents in SectionProfiler
* Previously it assumed methods never overlapped.
* Also fixed running collation when in trace mode.

Change-Id: I6cbf5384a57ea68197495173d75732f5df328040
2014-12-08 23:04:27 +00:00
Translation updater bot
e83d400d94 Localisation updates from https://translatewiki.net.
Change-Id: I9cc798961281a198617f1e09b7f63cdf5293a5b2
2014-12-08 22:58:32 +01:00
jenkins-bot
7252d7f55b Merge "Removed unused getSummaryReport method" 2014-12-08 21:00:36 +00:00
jenkins-bot
e8744411f6 Merge "Display error when user tries to create self-redirect" 2014-12-08 20:53:08 +00:00
Aaron Schulz
9ed769df16 Removed unused getSummaryReport method
Change-Id: Id65c6702cc2eb75047fbfa88a6b79163c7dc2528
2014-12-08 12:52:01 -08:00
m4tx
0266068570 Display error when user tries to create self-redirect
Bug: T29683
Change-Id: Idcd7a50d12c8f124bc447805654b1a9e86dee3e4
2014-12-08 21:37:42 +01:00
jenkins-bot
25d794110e Merge "Index ResourceLoader dependency lists in startup" 2014-12-08 19:17:23 +00:00
Trevor Parscal
ecfdb88dfd Index ResourceLoader dependency lists in startup
By using the existing indexes of modules in the array being passed to
mw.loader.register we can reduce the size of the startup module by about
6% after gzip (nearly 20% before) on a wiki with very few modules (such
as my localhost). Comparing data from en.wikipedia.org shows about 9%
after gzip (nearly 30% before).

The technique adds a function to mediawiki.js which resolves the indexes
before registering the modules, which costs a little bit of data in that
payload, but it's negligible (118 bytes after gzip) in comparison to the
overall reduction.

Also, cleaned up lies in documentation and strange use of "m" as an
iterator variable.

Bonus: fix ISO8601 timestamp instead of UNIX timestamp being passed
to custom loader scripts.

Change-Id: If12991413fa6129cd20ceab0e59a3a30a4fdf5ce
2014-12-08 11:04:41 -08:00
jenkins-bot
b9705e532d Merge "xhprof: Guard against division by 0 when computing percentages" 2014-12-07 20:58:45 +00:00
Translation updater bot
dd1bf48d16 Localisation updates from https://translatewiki.net.
Change-Id: I76befd65afcc8832e06bb4eaa8ebe03c52f53afb
2014-12-07 21:34:05 +01:00
Translation updater bot
b87678e380 Localisation updates from https://translatewiki.net.
Change-Id: I243c441edba60c96d971065f328b5e96d10c11cc
2014-12-06 22:00:06 +01:00
jenkins-bot
93cc595bed Merge "resourceloader: Make timestamp handling more consistent" 2014-12-05 22:21:11 +00:00
Translation updater bot
7281e77ac2 Merge "Localisation updates from https://translatewiki.net." 2014-12-05 21:53:58 +00:00
Translation updater bot
f9755c94b9 Localisation updates from https://translatewiki.net.
Change-Id: Ie09f63ee1738a54217bf1f02dc2ba0a954e3f5d3
2014-12-05 22:49:04 +01:00
umherirrender
52553eccb6 phpcs: The abstract declaration must precede the visibility
Change-Id: I957eb6007f110252726e67c1fb7099b02fdca676
2014-12-05 21:46:40 +00:00
Timo Tijhof
6a1ec17e79 resourceloader: Make timestamp handling more consistent
* Use time() instead of:
  - wfTimestamp()
  - wfTimestamp( TS_UNIX )
  - wfTimestamp( TS_UNIX, 0 )
  - wfTimestamp( TS_UNIX, time() )
  - intval( wfTimestamp( TS_UNIX, time() ) )

* Consistently use 1 as default instead of 0. Previously the
  unwritten convention was that anything "final" max()'ed with 1,
  and any internal method would use 0, but this wasn't applied
  consistently made it fragile. There doesn't seem to be any
  value in returning 0 only to have it maxed up to 1 (because if
  the 0 would ever make it out alive, we'd be in trouble).

* wfTimestamp returns a string for TS_UNIX. In PHP this doesn't
  matter much. In fact, max() takes number-like integers so
  transparently, it even preserves it:
  > max( 1, 3, '2' );
  < 3
  > max( 1, '3', 2 );
  < "3"
  Just cast it in one place at the very end (StartupModule)
  instead of doing intval( wfTimestamp() ).

* Fix weird documentation claiming getModifiedTime can return
  an array, or mixed.

* Remove 'version > 1 ? version : 1' logic in
  ResourceLoader::makeLoaderRegisterScript. The client doesn't
  have "0 means now" behaviour so this isn't needed. And the method
  was only doing it for variadic argument calls.

Removal of quotes around timestamps reduced the size of the startup
module from 26.8KB to 25.9KB before gzip. After gzip the size was
and still is 5.7KB, though. (From 5456 bytes to 5415 bytes.)

Change-Id: If92ca3e7511e78fa779f2f2701e2ab24db78c8a8
2014-12-05 21:29:57 +00:00
umherirrender
489d793882 Fixed spacing
- Added/removed spaces around parenthesis
- Added newline in empty blocks
- Added space after switch/foreach/function
- Use tabs at begin of line
- Add newline at end of file

Change-Id: I244cdb2c333489e1020931bf4ac5266a87439f0d
2014-12-05 22:28:07 +01:00
jenkins-bot
9c785e9158 Merge "Optimize how user options are delivered to the client" 2014-12-05 19:43:06 +00:00
jenkins-bot
8c77446bd7 Merge "ResourceLoaderUserCSSPrefsModule: Remove unused dependency on mediawiki.user" 2014-12-05 19:43:00 +00:00
Ori Livneh
1c17347580 Optimize how user options are delivered to the client
We currently embed the full set of user options in a <script> tag in the HTML
output of every page. This is grossly inefficient, because the full set of
options is usually largely made up of site defaults which the user hasn't
customized.

So instead of doing that, let's emit the default options using one
ResourceLoader module and then apply the user's customizations on top.

This has the effect of slightly increasing the total bytes of JavaScript code
(because options that the user has customized will be emitted twice: once with
their default value in the user.defaults module, and then again with the
customized value in user.options). But this is more than offset by the
fact that the bulk of user options code (~4 kB uncompressed on enwiki) becomes
cacheable across requests.

Bonus round:
* Varnish gets to cache 4 kB fewer per page.
* Changes to the default options don't take 30 days to propagate.

Change-Id: I5a7e258d2d69159381bf5cc363227088b8fd6019
2014-12-05 19:36:45 +00:00
jenkins-bot
6914dc1a80 Merge "Fixing confusing function description" 2014-12-05 18:04:41 +00:00
Timo Tijhof
5f04912af1 ResourceLoaderUserCSSPrefsModule: Remove unused dependency on mediawiki.user
Follows-up 57310ab838.

Change-Id: I06ad8c37cf53643bb65f6cabd8b843f63d4f5ec3
2014-12-05 17:43:28 +00:00
umherirrender
7da1cbc78c Fix backlink for RevertAction
RevertAction::getDescription cannot set subtitle on OutputPage,
because the subtitle on OutputPage gets cleared before the
result of getDescription is added and than the subtitle is gone.

Refactored the code for building the backlink into a static function
and use it.

Change-Id: Iedad0b8e040035a9a10a0b140d2322357e6b539a
2014-12-05 14:28:18 +00:00
James D. Forrester
c393f87470 Remove jQuery Migrate and $wgIncludejQueryMigrate
As indicated in MediaWiki 1.24, removing the jQuery Migrate bridging patch
that allows legacy Javascript code that depends ancient features of
jQuery removed in jQuery 1.9 to work.

Change-Id: I0934247182e2737716c9d40f4bf93415adcdadf3
2014-12-05 01:20:57 +00:00
Marius Hoch
3d3d36fcdd Fix DatabaseBase::replaceVars for PHP 5.3
Change-Id: I78a535abfe3f444b2ccb99638a63b6f16c9f18af
2014-12-04 23:14:00 +01:00
jenkins-bot
e9e0bff301 Merge "Hygiene: rename formheader to searchProfileTabs on Special:Search" 2014-12-04 21:49:15 +00:00
jenkins-bot
40da41acca Merge "Revert "Remove deprecated profiling config parameters, clarify docs"" 2014-12-04 21:46:31 +00:00
Rob Moen
5466de4ef7 Hygiene: rename formheader to searchProfileTabs on Special:Search
It's not a header, its out of the form now, boiled down, it's
some search profile terms laid out in tabs.

Change-Id: Ic6ec29817ab7deadc6bc7125f8b4cd16686baa04
2014-12-04 21:42:46 +00:00
Aaron Schulz
7dba64f2c1 Revert "Remove deprecated profiling config parameters, clarify docs"
StatCounter still needs $wgUDPProfilerHost.

This reverts commit 88c42dc1df.

Change-Id: I4a56f6fb6bc454d15a9dc752f45dfb29b2b47a84
2014-12-04 21:40:13 +00:00
jenkins-bot
03110e938d Merge "Remove deprecated profiling config parameters, clarify docs" 2014-12-04 21:12:30 +00:00
Translation updater bot
b68cec9cc8 Localisation updates from https://translatewiki.net.
Change-Id: I7f9787dfd402817f21686bcbe2ccafce6e224269
2014-12-04 21:58:32 +01:00
Chad Horohoe
88c42dc1df Remove deprecated profiling config parameters, clarify docs
We've already broken profiling completely in this release. Make
this abundantly clear in the RELEASE-NOTES and just remove the
awful back-compat attempt from I2af28cd3 and I49c0a83e.

Change-Id: Ib0b87192e2a6e87db19f7821906dd7b2063081e3
2014-12-04 12:51:19 -08:00
Elliott Eggleston
0600c197d3 Revert wrapping sitenotice in google tags
Reverts change I95473e22de83e585044a4f917bbd1b00db7db71b

Change-Id: Ia522064df15b959e22e81abe2c607687ec2a29cb
2014-12-04 20:29:54 +00:00
jenkins-bot
8b800b9239 Merge "Split things out of search element on Special:Search" 2014-12-04 20:18:27 +00:00
Ejegg
7f54095cb3 Merge "Prevent Google indexing of the SiteNotice div" 2014-12-04 20:15:44 +00:00
Aaron Schulz
dcd639f9f9 Switched hook profiling to use scopedProfileIn
* Also made scopedProfileOut handle the case where the callback
  was null (e.g. when there are no frame methods for xhprof).

Change-Id: Ife242bda8e046990d0d8ac27d628975b7b4a14d7
2014-12-04 19:32:38 +00:00
jenkins-bot
4f5f9776ad Merge "Changed some DatabaseBase type hints to IDatabase" 2014-12-04 19:08:00 +00:00
Adam Roses Wight
d79e175a69 Prevent Google indexing of the SiteNotice div
Site notice and CentralNotice should be omitted from search snippets.
We're diluting page content.

The awkward thing about this patch is that we can only confirm the
googleoff tag is supported for the search appliance, not the public
web crawler.  See here for those docs, though:
http://static.googleusercontent.com/media/www.google.com/en/us/support/enterprise/static/gsa/docs/admin/70/gsa_doc_set/admin_crawl/admin_crawl.pdf

Change-Id: I95473e22de83e585044a4f917bbd1b00db7db71b
2014-12-04 19:01:13 +00:00
Kunal Mehta
7fe5b87e8c Make LocalisationCache::getMessagesDirs() public
So it can be used inside LocalisationUpdate

Change-Id: I2399ddd7fd4462f2c6d1bf81036af451a67c58b1
2014-12-03 23:46:47 -08:00
jenkins-bot
0add9d5ba7 Merge "Remove Profiler::isStub()" 2014-12-04 07:42:27 +00:00
jenkins-bot
9946d66d46 Merge "Fix up interwiki search results in API" 2014-12-04 05:30:48 +00:00
Chad Horohoe
52f3b13312 Remove Profiler::isStub()
Just check for ProfilerStub directly.

Change-Id: I503916599f182df4206da5282193ae6ec9324ee6
2014-12-03 20:19:56 -08:00