Commit graph

95 commits

Author SHA1 Message Date
Gilles Dubuc
4d9e07056e Have ?download parameter trigger Content-Disposition: attachment
This parameter triggers Content-Disposition: Attachment which
makes the browser download the image instead of displaying it.

This is needed by Media Viewer to allow users to click a button in
order to download an image at a given resolution or the original.

Change-Id: I470a24a09139ac65588312104995e34d97a89b0f
2014-03-25 11:04:50 +01:00
Siebrand Mazeland
f077c4b1d6 Update formatting
Change-Id: I18aff576262479c9bb1c56eb8e1d1aaae200e4b1
2014-02-06 09:27:05 +01:00
Reedy
785b888a22 Call to a member function getCommonMetaArray() on a non-object at
File.php on line 586

Bug: 59785
Change-Id: I7163f3fd122922a28519b7cb1d3d4cd4b81165ee
2014-01-08 10:28:43 +00:00
Brian Wolff
a513f46b80 Fix error handling in File::createThumb.
Was checking for null, but transform always returns either
false or an object.

createThumb isn't used in core, but some extensions use it.

Bug: 58436
Change-Id: Icaf5088a193dc1d9b9c365f92722bef1f9c1dba6
2013-12-13 01:54:20 -07:00
Brian Wolff
d0c0bad56d Add UI to discover translated SVG files.
Currently we support rendering SVGs in multiple languages,
but there is no mechanism for users to discover what languages
a file is available in. Show this information on the image page.

At the moment, if unspecified we always default the language to
english (I believe to avoid mass cache splitting, especially
if most languages wouldn't have a translation of the file in
their language). This code was written in such a way so that
this assumption should be changable in the future if we so
desire.

Long term, Jarry has a super cool svg translation extension
which would take over some of this. However I still believe
we should have an interface for this in core, since we do
support the different language renderings in core.

Change-Id: I84506436514e09d71200aa2db3932aa001b55c71
2013-12-06 20:30:31 -04:00
Siebrand Mazeland
01d41a7ccb Add more type hints in comments for static code analysis
This resolves a little over 100 "undefined method" warnings on
includes/filerepo/.

Change-Id: I87b6d875a4304d7beadfbc26a66e9a3f358707e6
2013-12-06 00:23:05 +01:00
Siebrand Mazeland
9d9ceeef9c Update documentation for File::getMetadata()
Change-Id: I24711e009f42303774b3c79ad65c38081c7c0982
2013-12-05 22:15:54 +00:00
jenkins-bot
fb2a35eced Merge "Remove unused local variable" 2013-12-05 17:36:58 +00:00
Siebrand Mazeland
417d4fbbfa Update documentation for file repo related classes
Change-Id: I626d972f92934afc9349e11d3a5550c4044dcb53
2013-12-04 23:06:53 +01:00
Siebrand Mazeland
aea7d47ebe Remove unused local variable
Change-Id: I7d94987da8d8c476e7b648e132baff9f7206fac8
2013-12-04 10:40:57 +01:00
jenkins-bot
f90977bcc5 Merge changes Ic13414f0,I26085bfc
* changes:
  Set visibility on class properties of ArchivedFile
  Set visibility on class properties of File
2013-11-26 20:11:11 +00:00
Siebrand Mazeland
3481c924e1 Set visibility on class properties of File
Change-Id: I26085bfc26b0c1d003d586354c21057c9cdf5d55
2013-11-24 09:12:23 +01:00
Siebrand Mazeland
df8a8f048e Rename File::_getIsSafeFile() to getIsSafeFileUncached()
Part of project to remove underscores from method names and class names.

Change-Id: I597565d87002ebc8f3d74f6428ca009e25040519
2013-11-23 21:17:14 +00:00
Siebrand Mazeland
f742b27dd3 Break long lines in file repo files
Change-Id: I6d95c1b3e14a947a92127efa681007baaeab89ba
2013-11-23 21:17:08 +00:00
Siebrand Mazeland
bb39b5a6e4 Update formatting of file repo classes
Change-Id: I780070e07352d84d7cda7628994b28b04e8a1ebf
2013-11-23 21:00:11 +01:00
Brian Wolff
2cbd926e34 Add an interface for getting "standard" file metadata.
Currently file metadata is handler dependant. However they usually
end up extracting the same type of data (author, date, etc) plus
one or two handler specific things. This adds a handler independent
interface for getting metadata that is likely to be common for all
types of file (At the moment, this is the exif/iptc/xmp information)

This commit used to also contain stuff adding parser functions,
which is now split to its own commit. This commit is needed
by a bunch of other commits, in particular I0d957891e0.

Change-Id: I43d9252f69dc5b8ba0b848cf40aa1b97329c85ae
2013-10-29 16:12:07 +00:00
jenkins-bot
ee1eb85b61 Merge "Add option to chose what language to fetch file description in." 2013-09-25 15:51:13 +00:00
Brian Wolff
bd7ebdec65 Add option to chose what language to fetch file description in.
I want to get the file description in a language other then
the user language in an extension (I5e6bc45f9751).

Change-Id: Ifcae821a51f4207e7816e710d3b3857c7ed438b6
2013-09-24 20:19:33 -03:00
Bryan Davis
176e012fe3 Guard against non-object returns from File::getHander()
MediaHandler::getHandler() can return false when a handler cannot be
determined for the given file's derived mime type. This change adds
guards to invocations that I could find that did not properly check for
this potential return result.

Bug: 53820
Change-Id: I8c0165311cc75f9920ac30ce2b38ccd207439198
2013-09-17 06:48:43 +00:00
kaldari
26b6aee38c Improving comments in File class
Change-Id: I5d1653f84f7e9324b234c2cc49e7ee5a1d0676ff
2013-07-08 10:36:10 -07:00
umherirrender
1bfc8feb25 Fixed spacing in actions/cache/filebackend/filerepo/job folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Idb93d34e314e5f314223b79208968d6bcd30c40e
2013-04-20 19:18:13 +02:00
umherirrender
15abcf71ca Added/Removed spaces around string concatenation
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !

Fixed windows newline style

Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
2013-04-13 13:36:24 +02:00
umherirrender
7c9a49082c Use wfAppendQuery to append a query
Also pass a array to wfAppendQuery, which than does the urlencoding.

Prefer a wfScript() over the global or string

Change-Id: Icada534cb4c99c9441938a2e8dcbc11a142360c6
2013-04-12 07:31:52 +00:00
Aaron Schulz
cfe057a603 Made sure MediaTransformOutput::getLocalCopyPath handles storage paths.
* Storage paths are passed in for several cases in File::transform().

Change-Id: I61a4058b80a37f36b78e2dfe62ffdf6f73e6f41e
2013-03-27 12:48:14 -07: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
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
umherirrender
e43dc272bd Fix align of block comments
Change-Id: I88ea33a125a71671886b49e4ebf4c1d0a1cce572
2013-03-07 17:27:38 +01:00
umherirrender
183b4dbedb Added missing @deprecated doc to File and Title
Change-Id: I32bd054e97905a5a763e47daecf4be615981a3ff
2013-02-27 07:26:24 +00:00
umherirrender
678f2da99d Pass user to File::recordUpload to avoid $wgUser
Moves the giving of a user one level up, because File::recordUpload2
already needs this (and fallback to $wgUser).
Can also use the user for the watching of the file, which was using
$wgUser before.

Change-Id: I697ae0df65b07ea59ab11b62804853cdc03cb172
2013-02-23 12:46:28 +00:00
Jan Gerber
fa80d44451 Bug 43343 add zone "transcoded" for audio/video
to allow different storage strategies for thumbnails
	and audio/video derivatives, add a new zone "transcoded".

Change-Id: I204c843dae4966b02f4807f15e6b0bac672f34dc
2013-02-05 05:53:57 +00:00
umherirrender
570dda0455 fix some spacing
Change-Id: I88e73d47a552918880514d88a876296a6cb80d88
2013-02-04 20:09:18 +00:00
Aaron Schulz
6083291f9e [FileRepo] Use getHandler() is some places that should use it.
Change-Id: I1b4b9786217b819c739f04e8bcead5c5774671a0
2013-01-28 09:54:33 -08:00
Aaron Schulz
7206580366 [FileRepo] Flipped RENDER_FORCE check order to avoid stat.
Change-Id: Ia12ea5a1152c49901a7f1157b06fd113c64fdec9
2013-01-21 13:36:01 -08:00
Reedy
d0a242abb4 Tidy up some unbalanced returns in methods
Leave a TODO

Change-Id: Ic49ac8630650b341aafb3c17abd22f3a07805d27
2012-12-09 02:59:04 +00:00
Aaron Schulz
c13bafe700 [FileRepo] Added File::getStreamHeaders() function for convenience.
Change-Id: I6881d7c70e507f26a0bd159169c51aea5b72fad6
2012-11-21 10:37:45 -08:00
Aaron Schulz
81ebc15b05 [FileRepo] [FileBackend] Added support for custom file headers.
* For backends that support it, custom HTTP headers can be set on files.
* Added a getStreamHeaders() function to MediaHandler to let subclasses
  recommend header name/value pairs to be used for responses to GET/HEAD
  requests. For example, an OGG handler could set "X-Content-Duration".
* Made LocalFile use this function to set HTTP headers of new uploads.

Change-Id: I1b017e1342513f0097fe6d142aae18e819403293
2012-11-20 14:07:02 -08:00
Aaron Schulz
3338587604 [FileRepo] Allow different file URLs for media based on file extension.
Change-Id: Ib647377312c93c8ed046f7b9510d0e656788cdc3
2012-11-08 06:19:39 +00:00
Aaron
97832b6b1d thumb.php now handles short and long thumbnail name formats when possible.
Change-Id: I33932ac0e0294dc13332dce9d4ab00a75d9cdcba
2012-09-12 21:17:09 +00:00
Aaron Schulz
5fbef994cf Revert "thumb.php now handles short and long thumbnail name formats when possible."
Doesn't quite work, since $img->transform() still saved the thumb under the normal name.

This reverts commit 5b33e66b74
2012-09-06 17:52:33 +00:00
Aaron
5b33e66b74 thumb.php now handles short and long thumbnail name formats when possible.
Change-Id: I8e53ce711e23127854185661c5ce8bddbb226623
2012-09-04 14:59:26 -07:00
Aaron Schulz
122e6813f7 Merge "Fixed and normalized content-disposition for thumbs." 2012-09-04 20:59:16 +00:00
jarry1250
2ae2c36154 Convert core to use new ThumbnailImage() constructor
See change #21321 for the introduction of that new constructor
and the reasoning behind it.

Change-Id: I15843fab4217333077e16ae187e7c09f76d47e58
2012-09-01 17:12:48 +01:00
Aaron Schulz
d22c890890 Fixed and normalized content-disposition for thumbs.
* Previously, thumbnails could have a hex tmp file name as the disposition.

Change-Id: I495860dc54c02d2b3e053e998a41674cd6d07f2f
2012-08-31 22:32:47 -07:00
Aaron
303d8be8ee [FileRepo] Added option to shorten long file names.
Change-Id: Id36e787192b32b72d3b49e2afbe41335b81ae732
2012-08-31 16:33:59 -07:00
Brian Wolff
876128f8c9 (bug 39297) Show a warning if thumbnails won't be animated
This shows a warning on the image description page if the image
is animated, but thumbnails won't be. This includes
gif images that are too big, but also svg images that are animated,
and APNG files.

The message used is file-no-thumb-animation, but will also
check for file-no-thumb-animation-<image extension> so that
admins can do per image type explanations. Gif files have a built-in
explanation that is slightly different (Since its do to resolution).
Ideally one would pass the resolution limit to the gif message,
but I couldn't think of a clean way of doing that. (Also might be
complex to explain to user. They aren't used to resolution as a single
number but as a width x height type thing).

Moves isAnimatedImage from ImageHandler to MediaHandler, so I could
safely use it from any handler class.

Change-Id: I42ee11d889e0c41de53d0951f55a4338ca55311d
2012-08-21 18:31:51 -07:00
Alex Monk
2fabea7eea Use wfMessage instead of deprecated wfMsg*
Or $this->msg in special pages.

Change-Id: I774a89d646615053c8424050e42ad95601f92543
2012-08-18 14:11:05 +02:00
Aaron
08ea8adc95 Adding more file profiling.
Change-Id: Id45e082966f1ed6105918c0732b450faf039cd96
2012-08-16 18:05:01 -07:00
umherirrender
7b2a62b74a Change File::compare to use getName, not getTitle
For files the file name with underscores is often used,
than the compare method should do that also.
This matches than the ORDER BY img_name done by some query.

Change-Id: Ia1b89577538bdfdf751c7b9584e7c008a8c2bb1e
2012-08-01 19:40:10 +02:00
Aaron Schulz
dfeec4e397 Merge "Sort result of FileRepo::findBySha1" 2012-07-13 18:14:28 +00:00
umherirrender
d6e31f68b1 Sort result of FileRepo::findBySha1
This sorts the result on Special:FileDuplicateSearch, which is unsorted,
when merged from different repos.

Adding File::compare similar to Title::compare for this

Change-Id: I32e8be92c6067f9e13f3ecd1039c337b0fc3e840
2012-07-13 11:11:39 -07:00