Commit graph

151 commits

Author SHA1 Message Date
Siebrand Mazeland
59f6fd0199 Change EXIF to Exif
Per https://en.wikipedia.org/wiki/Exchangeable_image_file_format. Spotted
by Shirayuki and documented on
https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Sesp-property-exif-data/en

Change-Id: I92ba67ec60ccfe7a173d950593357b86792b8ed3
2013-05-10 13:51:06 +02:00
Catrope
8457ee8591 Allow iiurlheight to be used without iiurlwidth
Wanting to get a thumbnail with only the height constrained is a
reasonable use case, the only reason we don't support it in the
API is because the backend doesn't support it directly. This is
easy enough to emulate by setting the width to the full width of
the image if only the height is specified. This makes the transform
function use a bounding box of size w x h, and if w is the width of
the original image that's equivalent to just bounding the height.

Change-Id: I28c7c22ee91669469cbd9e7d25f09100933582de
2013-05-02 17:34:07 -07:00
umherirrender
a35cce4be0 Fixed spacing in api folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Id7779dca4d1185245cf5764102b8de8b232c34b6
2013-04-20 07:47:36 +00:00
umherirrender
b68ef07ebb Update limit/urlwidth param doc of prop=imageinfo
Follow up Id0ec6a and to clarify things like bug 46782

Change-Id: I2215d022a47cd8ceeadd2f5d38064495f3197772
2013-04-11 17:13:01 +00:00
Brad Jorsch
4f82e77122 Honor transform limit for images with many old revisions
When preparing Id0ec6a0a, for some reason I thought the thumbnailing
only applied to the current revision. Fix that oversight.

Change-Id: I2e8aecc76a1190bac353a2b9855bc6a19ec06dec
2013-04-09 22:56:55 +00:00
Siebrand Mazeland
6d3bbbbdd9 Update PHPDoc comments
Change-Id: Id20f632762d705ba5e5eb18088f6e9e551b3f42b
2013-04-02 13:42:10 +02:00
umherirrender
8764b3aa7c Remove spaces in function signature
Change-Id: I45aea7a7af88cd913b2f485913620a8af0ab2fed
2013-03-18 20:44:43 +01: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
493b766fdb Merge "Fixed many small spelling mistakes and php docs, var decl." 2013-03-11 14:17:08 +00:00
Yuri Astrakhan
0aa24ae558 Fixed many small spelling mistakes and php docs, var decl.
Change-Id: I1508ed7eb77e5e4f700fb63955d626c4f5915840
2013-03-10 23:45:51 -04:00
Reedy
c3e4057e06 Kill off numerous unused variables
Change-Id: I7039f1328f37ee669b694f73ee282602186bffd1
2013-03-08 02:36:24 +00:00
Brad Jorsch
89a222dd86 Limit ApiQueryImageInfo transform calls
Apparently calls to File::transform can be slow. Add code to limit these
calls in prop=imageinfo.

The only effect for clients will be a possibility of seeing iicontinue
more often.

Once this is merged, TimedMediaHandler's ApiQueryVideoInfo.php should be
updated in the same way.

Change-Id: Id0ec6a0afb85ca73eefb5b8370c2147c37f037e9
2013-02-20 13:51:16 -05:00
Brad Jorsch
2c9dfcb7d1 Clean up ApiQueryImageInfo continuation
Reviewing this code, I spotted a few issues:
* 'imagerepository' is added to non-images, and to images that were
  skipped this round due to iicontinue. The latter is particularly
  troublesome, as clients may wind up with an incorrect value when
  merging continued results.
* Say two images are being queried, A.jpg and B.jpg. If the query needs
  to be continued somewhere in the middle of A.jpg's old versions, but
  then A.jpg is deleted before the client sends the continuation query,
  it will start in the middle of B.jpg's old versions instead of at the
  beginning of B.jpg's revisions.
* If the query needs to be continued somewhere in the middle of A.jpg's
  old versions, but in the continuation query some other module that is
  also being continued fills the result object, iicontinue will be
  reset to the *beginning* of A.jpg's old versions instead of preserving
  the position in the middle.

Change-Id: I08e2941010c7a70ff90b6244bfddd5ed0540fc9f
2013-02-07 16:50:17 -05:00
umherirrender
f97a3a4027 fix some spacing
Change-Id: I670a7baf3ba1e70d18346bb00938d518ba2063bd
2013-02-04 19:59:14 +00:00
Brad Jorsch
6a9ec23612 (bug 31849) API imageinfo correctly handle redirects
RepoGroup::singleton()->findFiles() returns an associative array mapping
the redirect *target* to the image object; the image object refers back
to the original title queried.

If a redirect and its target are both queried,
RepoGroup::singleton()->findFiles() will return an entry for the target
title only, mapping to an image object that may have getOriginalTitle()
returning the redirect. If this happens, prop=imageinfo will never see
an entry for which getOriginalTitle()->isRedirect() is false and so will
not return any information about the image.

The fix is to ignore getOriginalTitle() entirely. Instead, we just go
through each of our queried titles and see if we got any result back.

Note this automatically handles a "redirects=1" query correctly, since
in that case any local redirect will already have been followed before
we ever got the list of titles to query.

Change-Id: I0b2982901e2dc4491e2933291fd97697b2a622a9
2013-01-22 14:31:38 -05:00
Yuri Astrakhan
503cd2f4ae (bug 35885) remove api version string and parameter
API was using SVN's version keyword which GIT does not support.
All related methods were either removed, or for those that
could have been used from extensions, emptied out.
api.php?version now shows unrecognized param warning.

Change-Id: I910ca1448ed2ed697ac19b17c486d130aa1d7e03
2013-01-18 12:41:18 -05:00
Yuri Astrakhan
983545c362 API Cleanup: renamed '_badcontinue'->'badcontinue', one die()
* If a query module has 'continue' parameter, it will auto-report
that it has 'badcontinue' error.
* Added APIQueryBase::DieUsageContinueIf( $condition ) that shows
correct badcontinue error if $condition is true.

Change-Id: I9c48bda6de0cde3c117ad24460bddf6980279633
2013-01-14 21:19:16 -05:00
Yuri Astrakhan
32fd68f81c Minor cleanup
Fixed spacing, eol chars, "string" --> 'string'

Change-Id: I630247c6c5b469efb67ec9de32e8533ae88e59fb
2013-01-12 01:50:48 -05:00
btongminh
f14f01a33b (bug 36751) InstantCommons doesn't follow redirects
This fixes r56837: now redirects are only skipped if the redirects query
parameter is not set. This was presumably the intent of that commit, see
https://www.mediawiki.org/wiki/Special:Code/MediaWiki/56837#code-comments

Change-Id: I27485bba9fe196211baeeb84238e4a397c620a1d
2012-12-22 16:36:16 +01:00
umherirrender
dd26d2b8e7 Add 'dimensions' and 'thumbmine' to resultproperties in prop=imageinfo
This also effects list=allimages/prop=stashimageinfo

Change-Id: I5fee9539f376a2164f3143f23c23aa18fb96a4b8
2012-11-18 18:25:19 +00:00
Reedy
25231f842e Bug 41234 - api prop=imageinfo broken on PHP 5.4
Fix by Roan

Change-Id: I14d8da45f7655ded501e3dd48dbdd424ecacc885
2012-10-20 03:23:27 +01:00
btongminh
5aab0ff71e (bug 35693) ApiQueryImageInfo now suppresses errors when unserializing
metadata

Change-Id: I7c9649b54a9d1d8f8b79beff7435a32860b80a61
2012-09-23 20:52:00 +02:00
umherirrender
a57ea5c3ad Add localonly= to prop duplicatefiles and imageinfo
When looking only for local files, the localonly param skipped the
mabye expensive look up inside the file repos.

Change-Id: Ib8f38d6abf9238a349bbfd617a36933bdfe74b5c
2012-08-01 19:51:23 +02:00
Aaron Schulz
e6faa2fd76 Merge "escape HTML elements in docblock with double quotes" 2012-07-18 19:17:46 +00:00
Catrope
2217f124da Merge "prop=imageinfo&iiprop=url|thumbmime needs iiurlwidth=" 2012-07-18 01:42:33 +00:00
Antoine Musso
4f5d2386f3 escape HTML elements in docblock with double quotes
Doxygen choke on text enclosed by '<' and '>' since it tries to
interpret them as HTML or XML elements. This patch adds double quotes
in includes/api/*.php files around the two following strings:

 <Firstname>.<Lastname>@gmail.com
 <Firstname><Lastname>@gmail.com

Which becomes:

 "<Firstname>.<Lastname>@gmail.com"
 "<Firstname><Lastname>@gmail.com"

Tested locally, it prevents doxygen 1.8.0 related warnings.

Change-Id: I36d82eb3fd4989ee3ffc65b0b527b83711d1ba69
2012-07-15 22:15:45 +02:00
umherirrender
87524b1e75 (bug 38376) call to undefined method ThumbnailImage::getPath()
* Added MediaTransformOutput::getExtension() function and use it instead.
* Also fixed getScriptedTransform() to not pass the page as the path parameter.

Change-Id: I6c530aa155d62a6bfd5727c6f3d104fe91453745
2012-07-15 14:09:43 +02:00
umherirrender
dbea761c29 prop=imageinfo&iiprop=url|thumbmime needs iiurlwidth=
A thumb is only generated when prop=url and a urlwidth is given. Adding
a hint to param description.
list=allpages does not have a urlwidth param and therefor cannot get the
thumbmime, adding thumbmime to the filter list to remove it from output

Change-Id: Ic1dbdb9b07f6325756058d6a0aa6ea148499fdfb
2012-07-13 17:25:22 +02:00
umherirrender
a9a71011ff Change some NS_IMAGE to NS_FILE
Change-Id: Id530c88d24df1a47a2f6565911184008b67fe04d
2012-06-24 21:50:10 +02:00
Petr Onderka
80aa025528 Added result properties to action=paraminfo
Added information about the properties of the results of API calls
to action=paraminfo, including information about "property groups":
what should the prop parameter be set to to get that property.

Uses the same format for types as parameters already do.
The output format of some modules doesn't fit this, so the result
properties for them weren't added, or only partially.

Partially implemented modules:
* expandtemplates:
  parsetree is in its own tag
* protect, allusers, backlinks, deletedrevs, info, imageinfo,
  logevents, querypage, recentchanges, revisions, searchinfo,
  usercontribs, userinfo, users, watchlist, upload:
  response with partially complex structure

Not implemented modules:
* feedcontributions, feedwatchlist, opensearch, rds:
  non-standard reponse
* help:
  error is normal response; not very useful for automated tools anyway
* paraminfo, parse, pageprops, siteinfo, userrights:
  response with complex structure

Change-Id: Iff2a9bef79f994e73eef3062b4dd5461bff968ab
2012-06-06 19:24:59 +02:00
Reedy
2173e1fbee Make getContinueStr protected as it's used in subclass by TMH
Change-Id: I3bd265805122d3ae12b986d1396ca634ca9f8097
2012-05-08 19:08:43 +01:00
Sam Reed
53000baecf Oh noes, moar http:// -> https:// 2011-11-28 15:43:11 +00:00
John Du Hart
2e7d867478 Removed the 'eclipse helper' bit on top of every API module
It's a parctice that dates back to 2006 when the API was first written, and frankly isn't covered by the coding conventions. Same thing with the docblocks, they're all copypasted with some bits changed and don't even make sense if you look at them in the genereated code docs.
I don't feel that any of us depend on this anymore (get a better IDE), so in the inerest of consistancy it's time we said goodbye to it.
2011-11-16 00:17:26 +00:00
Alexandre Emsenhuber
da4edaaf40 Call Linker methods statically 2011-09-16 19:35:14 +00:00
Roan Kattouw
d8a2733757 Make the PROTO_ parameter to wfExpandUrl() explicit in all calls. There are now no calls to wfExpandUrl() in core that rely on PROTO_CURRENT being the default. Also switch to using getCanonicalUrl() for.... rel="canonical" :D (I picked the right name, I KNEW IT) 2011-08-19 15:46:08 +00:00
Sam Reed
a5628f5734 Based on diff to wikia, set more functions consistently public rather than protected 2011-08-17 22:24:21 +00:00
Roan Kattouw
fbdba8b26f Revert r93802 per CR. Will avoid cache pollution by splitting the cache instead 2011-08-03 07:54:23 +00:00
Roan Kattouw
541aa4cbdd Followup r92044: force HTTP on URLs output by the API, now that wfExpandUrl() has a flag for this 2011-08-03 07:05:21 +00:00
Sam Reed
d5e46f9614 Followup r92396
More modules documented, pretty much only action=query&list= to be done (ie links added where documentation pages exist already)
2011-07-17 16:51:11 +00:00
Roan Kattouw
7b8b23e8b4 Per wikitech-l, run a bunch of URLs in the API output through wfExpandUrl(), so they become fully-qualified even if they were originally protocol-relative 2011-07-13 01:27:07 +00:00
Sam Reed
bdf84cb20e Swap else if for elseif
Trimming trailing whitespace also

Doing in 3 commits, so hopefully reviewable in CR...
2011-06-17 16:03:52 +00:00
Sam Reed
202f4d7443 Fixup error message
Remove {} (documentation tweaks)

Remove whitespace
2011-06-05 23:44:37 +00:00
Sam Reed
f4b92d6b4b Add missing word to r89505 2011-06-05 15:12:38 +00:00
Sam Reed
ef6afb5d9e Tweak documentation
Add braces
2011-04-29 23:34:37 +00:00
Chad Horohoe
783d4e0862 Remove @static from all over the place. That's what the static keyword is for, this being PHP5 and all 2011-04-21 00:07:09 +00:00
Brian Wolff
74f16767e7 Merge to trunk everything in img_metadata branch.
Hope I did this in an ok fashion. svn merge --re-integrate was giving me issues
so I just essentially over-wrote my working copy with the version at img_metadata.
2011-04-16 01:23:15 +00:00
Sam Reed
ea056f5171 Fixup a few undefined variables and alike while checking REL1_17 2011-04-04 21:13:34 +00:00
Bryan Tong Minh
100ecff40e Get the thumbmime from the handler instead of guessing it with UnregisteredLocalFile. 2011-04-02 14:49:12 +00:00
Sam Reed
9818053bd3 * (bug 27589) list=allimages&aiprop=archivename is useless
Followup r84433

Add way to filter returned properties/descriptions
2011-03-21 23:51:26 +00:00
Sam Reed
db3698860a Start of bug 27586/bug 27589
Turn properties into a filterable key/value pair, but leave exisiting wrapper methods in place for the moment

Will finish it off later
2011-03-20 23:50:59 +00:00