Commit graph

78 commits

Author SHA1 Message Date
jenkins-bot
171255101f Merge "Use file width/height instead of metadata for getContentHeaders" 2017-05-24 06:44:54 +00:00
Kunal Mehta
e37a7f257a media: Avoid deprecated wfMemcKey()
And ObjectCache::getMainWANInstance() while we're at it.

Change-Id: Ib22bd134c3faa56f8d8f111bb9ed99d826cbed40
2017-05-23 21:01:09 -07:00
Gilles Dubuc
84e4d75088 Use file width/height instead of metadata for getContentHeaders
This allows us to populate X-Content-Dimensions without touching the
existing metadata format. Which makes the migration of existing content a lot faster by
only having to run refreshFileHeaders.

Bug: T150741
Change-Id: I2c0f39b2b01f364c3fab997ccc2f874b7f101d8a
2017-05-23 19:18:58 +00:00
Gilles Dubuc
cdfe08439c Store original media dimensions as additional header
For storage repos that support headers (such as Swift), this will store the original
media dimensions as an extra custom header, X-Content-Dimensions.
The header is formatted to minimize its length when dealing with multipage
documents, by expressing the information as page ranges keyed by dimensions.

Example for a multipage documents with some pages of different sizes:
X-Content-Dimensions: 1903x899:1-9,11/1903x873:10

Example for a single page document:
X-Content-Dimensions: 800x600:1

Bug: T150741
Change-Id: Ic4c6a86557b3705cf75d074753e9ce2ee070a6df
2017-05-09 15:49:28 -07:00
Kunal Mehta
a57b64436c Use wikimedia/timestamp
Bug: T100924
Depends-On: I0a067367cda6885fa45631ed7c18799d653dc9bf
Change-Id: I69ba64e364df8af089c1c918cdf32f99454e693a
2017-02-28 21:15:38 -08:00
umherirrender
34fe90ac52 Remove empty lines at end of functions
It looks like there is something missing after the last statement
Also remove some other empty lines at begin of functions, ifs or loops
while at these files

Change-Id: Ib00b5cfd31ca4dcd0c32ce33754d3c80bae70641
2016-11-05 11:55:10 +01:00
Bartosz Dziewoński
d0243c22ba FormatMetadata: Do not format 'UserComment' as a number
It's a freeform text field.

Change-Id: Ic3150f48c2e38fa26728bc22017b992d8ddfd152
2016-10-31 13:51:12 +01:00
Kevin Israel
890c82f419 FormatMetadata: Use binary integer literals instead of bindec()
We can do this now that we have dropped support for PHP 5.3.

Change-Id: I1e78249e244105496e976bf01e35f4067410b2f0
2016-06-14 00:26:29 -04:00
Bartosz Dziewoński
fed31bdc92 FormatMetadata: Fix comment indentation and whitespace
Change-Id: I55d2e6fd160c84208fb323b4c1d31f3291ed12f2
2016-06-13 21:26:39 +02: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
Brian Wolff
c716958795 Support all values for exif PhotometricInterpretation
I just happened to notice that it wasn't displaying properly on
File:Great_falls_of_the_potomac_river_washington_dc.tif .
The original implementation only used values found in JPEG images,
extend it to all allowed values in tiff files.

See http://www.awaresystems.be/imaging/tiff/tifftags/photometricinterpretation.html
for what the values mean

Change-Id: I31b78d093668cec076b7f3599acee528229737f6
2015-11-04 13:44:37 -07:00
Aaron Schulz
75f42aa8ea Convert DjVU cache to WANObjectCache
Also unified the total and per page dimensions cache

Change-Id: Ib6ad7c3cdfb4fe3a88d25240c3e362664a9b41fd
2015-10-28 04:47:18 +00:00
Legoktm
41c7da93e2 Revert "Add // @codingStandardsIgnoreFile to FormatMetadata"
For testing.

This reverts commit df706d2457.

Change-Id: If63199293ac3539030f3503fbcbd5e0f4aa2eece
2015-10-14 09:38:30 +00:00
Vivek Ghaisas
c54766586a Fix issues identified by SpaceBeforeSingleLineComment sniff
Change-Id: I048ccb1fa260e4b7152ca5f09b053defdd72d8f9
2015-09-26 23:06:52 +00:00
Kunal Mehta
df706d2457 Add // @codingStandardsIgnoreFile to FormatMetadata
PHPCS can't handle the level of nesting in this file and the tokenizer
dies.

Change-Id: Ib660e034ad21202303dd443e573e54dd8ed05a43
2015-09-25 10:56:57 -07:00
Jackmcbarn
c4f69827bc Fix some PHPCS issues
Change-Id: I6289ce362f8dfde7baf2b665f082820898844973
2015-06-26 01:32:28 -04:00
umherirrender
70f3afd548 Remove unneeded empty lines at begin of if/else/foreach body
An if body must not begin with an empty line

Change-Id: I62b058be337fcc85a120fcd3dadce564db59a271
2015-06-19 20:05:45 +02:00
Alex Monk
e7c9096ecc HTTPS-ify links to Wikimedia's sites in MW core source
See https://blog.wikimedia.org/2015/06/12/securing-wikimedia-sites-with-https/

Ignoring SVN stuff because svn.wikimedia.org's SSL certificate has expired, and
ignoring wgSharedUploadPath because T25122 wants to get rid of it.

Also a couple of BZ -> phab changes

Change-Id: I02fd23ac6c30a4a4c718e57d4dedbc693dd653c0
2015-06-13 19:23:23 +01:00
Brad Jorsch
cd56c087a4 Protect API metadata keys from FormatMetadata::fetchExtendedMetadata()
Bug: T97469
Change-Id: If5d101231ca913621c88e6683f6ef07f6dae1ee8
2015-04-28 16:34:03 -04:00
Thiemo Mättig
e90513c5cd Drop unused FormatMetadata::flattenArray method
This is a pure helper method, not closely related to this class, and
currently unused.

Change-Id: I278058677ad407aae8cd2ba8fe34c12b1e86033f
2015-04-20 15:41:28 +02:00
Gergő Tisza
25e226b652 Ignore EXIF data in FormatMetadata::fetchExtendedMetadata()
fetchExtendedMetadata() gets extra data such as file templates
via the GetExtendedMetadata hook; keys which are absent in the
extended data default to their EXIF value.

This turned out to be a bad idea as EXIF data is too messy in
practice with various devices putting e.g. manufacturer name for
author name; completely ignoring EXIF data in the extmetadata API
is still the better option.

Bug: T73719
Change-Id: I77b1df67d08097504b3b1026c584063488e03b6e
2015-01-14 03:04:02 +00:00
Ricordisamoa
2ae155da52 Fix phpcs errors in includes/
Mostly Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines

Change-Id: I678b2f0902f11cd1dfa1611b9da24e7237df9122
2015-01-08 20:15:07 +01:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00
Aaron Schulz
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08:00
Gergő Tisza
b8d2ca8020 FormatMetadata::fetchExtendedMetadata: Ignore multiple EXIF/XMP values
Ignore all but the first value of multivalued metadata fields. Before
this, the function returned an array of values for such fields,
causing various errors.

Bug: 72652
Change-Id: I0fd22b78e4938eecc506d870e352b3b196ee3ace
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/973
2014-11-12 19:10:05 +00:00
umherirrender
dd8921c9d9 Cleanup some docs (includes/[m-r])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I8ebfbcea0e2ae2670553822acedde49c1aa7e98d
2014-07-24 19:43:25 +02:00
umherirrender
0c1b1f8cfb Remove @private/@public/@void where visibility already set
When private is set php side on the function, no need to have it in the
param docs.

Change-Id: Ieaeac99c131b7360b1f324244d8be6f9ff854dd2
2014-07-04 22:41:05 +02:00
umherirrender
2df720d88b Remove deprecated class FormatExif
Deprecated and warnings since 1.18

Change-Id: I2461383bb2d3c5fc00ffb5f45bc8e931ed9acb58
2014-07-04 07:12:59 +00:00
umherirrender
8ad1c92441 Fixed some @params documentation (includes/*)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
2014-04-20 21:16:57 +02:00
Siebrand Mazeland
37bc4ec3dd Update documentation for media related classes
Change-Id: I7a9c8d59f88c68dc3835cb8a18f22a77cd7890fc
2013-12-06 23:03:06 +01:00
Siebrand Mazeland
a5519e4b4a Declare visibility on class property of FormatExif
Change-Id: Id5e7b3d29035946e44a0dd5939b9daec2e99aad0
2013-12-05 14:58:02 +01:00
Siebrand Mazeland
370101602c Break long lines in media related classes
Change-Id: I94653b4cde14f75180dae795d1fdaa1b073ec1d1
2013-12-05 12:33:18 +01:00
Siebrand Mazeland
d39ad9ea64 Remove PHP4 style constructor
Change-Id: Ic0eaac33286deef3e1ea8078ebc25cfc1cecf422
2013-12-05 12:06:45 +01:00
Siebrand Mazeland
c7dbaa0f58 Update formatting for media related classes
Change-Id: Iaa81af5b65a650222fa65bf8c368e4f1ec3ce9c0
2013-12-05 11:05:05 +01:00
umherirrender
5ca5672aac Fixed spacing
- Place commas correct
- Moved comments
- Add space after if/foreach/catch
- Reformat some conditions
- Removed trailing spaces/tabs

Change-Id: I40ccda72c418c4a33fcd675773cb08d971510cdb
2013-12-01 20:58:51 +01:00
Platonides
73fd2d2497 Add missing wfProfileOut()s
Change-Id: I072224fdeda25f8fe8a76338e7e767ab4c0619f0
2013-11-23 19:15:07 +01:00
umherirrender
db24b10ca8 Use lowercase key words
Change-Id: I57569b7082a0decc8128ecadd8ec5d1a5c327673
2013-11-23 15:56:42 +01:00
umherirrender
f153998317 Fixed spacing
- Removed double spaces
- Added space after if/switch/foreach
- Removed space on elseif
- Added space around parentheses
- Added newline at end of file
- Removed space before semicolon at end of line

Change-Id: Id40b87e04786c6111e6686d7f7eea1e588bdf37d
2013-11-19 19:03:54 +01:00
jenkins-bot
c90f18e7e1 Merge "Change mode of non-executable files back to 0644" 2013-11-06 19:06:42 +00:00
Reedy
fe7c284e7b Invalid argument supplied for foreach() in FormatMetadata.php on line 1566
Bug: 56585
Change-Id: I5f65333cc94b66fd80fcf5abcfad7e10e4669310
2013-11-05 15:05:12 +00:00
Alexandre Emsenhuber
2d0e98df31 Change mode of non-executable files back to 0644
Change-Id: Ib9dce1eea8c34986364aabed7f1770101c72c649
2013-11-05 08:13:32 +01:00
tgr
042f1c77a6 Add language handling to imageinfo/extmetadata API
Adds options to return metadata in all available languages, or in
a single selected language.

Change-Id: I78f096318904a08abd317a5ed3f74ee33d3289cb
2013-10-29 17:49:19 +00:00
Brian Wolff
d141781396 Add "extended" file metadata to API
Part of the point of this, is to add a hook to allow extensions to add
their own metadata (I intend to create a companion extension to parse
Commons description pages - I5e6bc45f9751)

It's hoped that this would provide a simple system to get file metadata,
and would be able to return information on any wiki (even without any
extensions installed to provide additional information). So it could
fallback to exif data, if there's no better source of information for
the file available. It's also meant to be done in such a way that, in
the future, when Wikibase is deployed on Commons, it could be integrated
without too much fuss.

marktraceur changed this patch to be a little less heavy-handed: it will
now return unformatted data by default from the API, but there's also a
method for formatting that data in the way that bawolff originally
intended. I'm still trying to figure out if there's much use in that
method, but for now it's not particularly useful.

Change-Id: I77303d8e535fc1c42e14cfb853814e5c434a81ec
2013-10-29 17:47:59 +00:00
Brian Wolff
b6aa32bf01 Make FormatMetadata accept RequestContext, instead of hard coding $wgLang.
The point of this patch is to allow someone to use this class
to get the metadata formatted in the language of their choice
(by passing in an appropriate context object), instead of
forcing $wgLang. This is important for future evil plans I
have.

To do this, some of the previous static methods were changed
to non-static. I checked and fixed all users of such methods
(including extensions). Some of the implied private methods
were also explicitly marked as such.

Change-Id: I673d99fa36280d1baf14c150f4aaff039676830a
2013-10-29 16:12:15 +00:00
Antoine Musso
15f68b16d0 newlines in wfDebug() calls
Spotted while running unit tests.

Change-Id: Idf863bed71b5f11b41b81d37fb190e6e7a4d0268
2013-05-20 20:57:43 +02:00
umherirrender
9f14ecf829 Added space after switch/Removed spaces after unset
While at it, added/removed some other spaces in the same files

Change-Id: I84d8001aa123a008807ad5eb76f396aed7c899a4
2013-04-26 16:42:31 +02:00
umherirrender
ee31d37821 Fixed spacing in context/installer/media/templates/upload folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I9761be9fa47adc3554852a97b19792b4648466ad
2013-04-21 06:22:06 +00:00
umherirrender
6c278b6d7e fix some spacing
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
  calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays

Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
2013-03-25 22:22:46 +00:00
Yuri Astrakhan
9506e3d812 Spellchecked /includes directory
* Ran spell-checker over code comments in /includes/
* A few spellchecking fixes for wfDebug() calls

Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?"

Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
2013-03-13 03:42:41 -04:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00