Commit graph

60 commits

Author SHA1 Message Date
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
jenkins-bot
073a675adf Merge "fix some spacing" 2013-03-07 17:13:27 +00:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
umherirrender
e43dc272bd Fix align of block comments
Change-Id: I88ea33a125a71671886b49e4ebf4c1d0a1cce572
2013-03-07 17:27:38 +01:00
umherirrender
f3cf109e62 remove space before semicolon
Change-Id: Ic0d890f5e27cec017c7f7910a67d53b2edf82079
2013-02-09 22:44:24 +01:00
umherirrender
570dda0455 fix some spacing
Change-Id: I88e73d47a552918880514d88a876296a6cb80d88
2013-02-04 20:09:18 +00:00
umherirrender
9d6575af15 The static declaration must come after the visibility declaration
From phpcs

Change-Id: Ieab0207f965630eda113abdc0259aa2eddcf5ca7
2013-01-26 21:03:52 +01:00
umherirrender
cb6657a178 Add missing version number to wfDeprecated calls
Change-Id: I8b9efaf5eafc6cfecb34d401574ce978899d3990
2012-10-05 20:26:00 +02:00
Brion Vibber
d45daa49d8 try/catch for bug 40037 weird timestamps in exif
Change-Id: I474bb796328baab6ca123d68c3ce7cf78fccfd3a
2012-09-06 12:10:57 -07:00
Brion Vibber
a8f5771c82 Fix exif timestamp bug
Missing a prefixed 0 on the hour for some reason, explodes.

Change-Id: I8658223d36404e73b9b4d28ce027c1abf98b3f8f
2012-09-04 18:49:47 -05:00
Siebrand Mazeland
4e1ccf0267 Replace deprecated wfMsg* calls with Message class calls.
Doing this in steps of roughly 100 changes per commit, so that it remains reviewable.

Change-Id: I4950fdf8be669b52446290768ece0b8df8399d5d
2012-08-20 22:52:17 +02:00
Reedy
8fcb5c37d8 Minor documentation tweaks
Explicitly define array variable, rather than possible conditional assignment if no iteration takes place

Patch set 2: Fix accidental revert of Ib7c7c0f3ed9382beea5fb0a9b2aa1809f75a8e1c

Change-Id: Ic1cdec163e2cf9cb5d160209596962fc985d22bd
2012-07-10 14:38:12 +01:00
Aaron
75f5bda6fd Fixed Language::isValidBuiltInCode exception.
Change-Id: Ib7c7c0f3ed9382beea5fb0a9b2aa1809f75a8e1c
2012-07-09 13:10:05 -07:00
Alexandre Emsenhuber
31003d22ea Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I26a320bcddd4122ce423f536609d5794446d743e
2012-05-03 22:22:45 +02:00
Robin Pepermans
9184dc83d6 Update core usage of getLanguageName[s]. 2012-03-08 20:56:26 +00:00
Sam Reed
0a626db6e1 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 19:29:36 +00:00
Antoine Musso
fc6bc233be Fix doxygen docs before REL1_19 branching 2012-02-01 20:53:38 +00:00
Brian Wolff
aa61882f3e Make partial dates in XMP not have the ommitted fields fulled out to 1's (reported by AVRS on irc).
Basically, in XMP you can specify partial date (for example 2011-04 for april 2011 with no day).
We were extracting that, and fulling out the day to 01 if it wasn't present (My original resoning when writing
the code was that the nice localized date functions need a full date, but that's a pretty poor rationale for displaying
wrong date). This changes it to just display such year-month things as YYYY:MM.
2011-10-08 18:40:00 +00:00
Bryan Tong Minh
f66a1c1bb9 (bug 29471) Exception thrown for files with invalid date in metadata
MediaWiki doesn't handle BC dates nicely, so check for that.
2011-06-19 21:38:58 +00:00