Commit graph

65 commits

Author SHA1 Message Date
Jackmcbarn
e684a21782 Restructure output of ApiExpandTemplates
Create a new output format of ApiExpandTemplates and deprecate the old
one.

Change-Id: Id12cbe4aeaa39bea382cf3b78810589bb1c9368f
2014-06-03 16:25:08 -04:00
umherirrender
e63299d208 Fixed some @params documentation (includes/api)
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: I758fa4ad80ac95e2ddd3770bcb9b7d2e57ec34ea
2014-04-18 13:55:36 +00:00
umherirrender
e965a1459d treat true as empty string, skip false in xml format
The xml format gives a empty attribute to indicate a true, for example
top="" or anon="". The new meta=filerepoinfo module gives natural
booleans to the xml formatter, which than will converted to strings,
that gives a empty attribute for false and a attribute with the value
"1" for true attributes. Change this behaviour in xml formatter to allow
the natural booleans on the other formats like json, which support that
better than xml.

Bug: 59953
Change-Id: Iedf43aae2e624e8e15c9cf102d24b8365110164a
2014-01-19 10:42:47 +01:00
Siebrand Mazeland
d026e1a403 Address errors and warnings in CodeSniffer in api/
Change-Id: I06de371393d50eada33154626874b106d814642b
2013-11-17 16:52:24 +01:00
Siebrand Mazeland
a60643422b Update formatting on more API classes
Change-Id: I1e6325b628359a557ceaa1e1ae30043aa5fc1402
2013-11-14 18:11:13 +00: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
Kevin Israel
9d10834864 ApiFormatXml: remove broken xmldoublequote param
r55641 was a refactoring of ApiFormatXml::recXmlPrint() that added
a $doublequote parameter, yet the parameter was not actually passed
along in recursive calls, rendering the formatter's xmldoublequote
parameter useless.

XPath support was the sole reason this parameter was added. It was
argued that because in the XPath 1.0 grammar, a Literal is:

    '"' [^"]* '"' | "'" [^']* "'"

it is not possible to match attribute values that contain both an
apostrophe and a double quote.

However, conforming XPath implementations include a concat() function
that can be used to work around this limitation. Furthermore, XPath 2.0
allows escaping a double-quoted " as "" (and a single-quoted ' as '').

Because there was no Bugzilla report (other than mine) filed in the
last 3-1/2 years, and working around the XPath flaw is possible, I
think it's safe to remove the parameter. The worst that could happen
is that a not-very-robust API client chokes on the "Unrecognized
parameter" warning.

Bug: 46626
Change-Id: I9a4d8c13b78ffd2634d03c8c8b4bbeff69f4bc08
2013-04-10 00:32:43 +00:00
umherirrender
3dd97bf651 Use gettype only for debugging text
Changed some gettype == 'array', 'object' and similar to is_array,
is_object or similar

Output of gettype must not stable across versions and it is slow

Change-Id: I07bfc063b03be1200989dd6facee66b35ab51d77
2013-03-15 22:50:42 +01:00
umherirrender
f97a3a4027 fix some spacing
Change-Id: I670a7baf3ba1e70d18346bb00938d518ba2063bd
2013-02-04 19:59:14 +00:00
Antoine Musso
b2fba3f27f api: remove duplicate __contruct calls
For historical reasons, all our API class had a dummy __construct which
simply calls their parent constructor.  This patch removes all such
occurences to save out some bytes.

Change-Id: I667955d7821f780fc5ce23823d74dedb1729b9fa
2013-01-29 09:38:17 +01:00
Petr Onderka
deaffd8262 Don't return invalid XML from paraminfo when one of parameter values is null
The module setglobalaccountstatus currently has null
as one of the values for one of its parameters,
which causes paraminfo to return invalid XML (unclosed tag).

I believe values shouldn't be null, but paraminfo
shouldn't return invalid XML even when they are.

This problem occured only with values that go into element content,
those that are rendered as attributes were already fine.

This change modifies ApiFormatXml, so it affects all modules.

Change-Id: Ibf5c329e7bfa375b06f0976ebb9e449f2cb1c927
2013-01-24 11:39:05 +01: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
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
Antoine Musso
4a69fceb79 prettify documentation
Change-Id: Icfd267a94ac981b4c15e51add18c6d8ceb68454e
2012-07-10 17:18:20 +02:00
Liangent
69ebd8d7ce Add some more detailed info about the xslt param of format=xml
Change-Id: I77e1dcbdf3ff1d201a2346c5a397469b4fc21d74
2012-05-25 08:56:02 -07:00
Jeroen De Dauw
4544a78316 rem use of escapeLocalURL 2011-12-13 04:58:48 +00:00
Sam Reed
124f6229ac Followup r104445, swap the xmlnamespace url back to http:// 2011-11-28 20:04:40 +00: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
Brion Vibber
c9873a9230 Partial revert of r101912 -- restores r99315 'includexmlnamespace' parameter for API, but keeps the logic to keep that from clobbering alternate XML output formats with their own namespaces. 2011-11-04 01:31:15 +00:00
Brion Vibber
abb23bb7b9 * (bug 31878, bug 31542) Fix XML namespace output in API; removed now-unneeded includexmlnamespace parameter.
Any existing uses of includexmlnamespace should be ignored and harmless.

If output data already includes a specific default namespace as an xmlns attribute, it is now retained -- so for example the RSD API discovery module outputs the appropriate namespace instead of the generic API one.

Partial revert of r99135 which added the includexmlnamespace parameter as a temporary requirement to get the xmlns attribute included.

Followup to r88007 which added the xmlns originally, but in the wrong order so it overrode existing output data.
2011-11-03 23:14:58 +00:00
Mark A. Hershberger
03e69126c5 eol w/s 2011-11-03 21:22:34 +00:00
Bryan Tong Minh
504d37d6fc (bug 24781) The API will include an XML namespace if the includexmlnamespace parameter is set.
Partial revert of r88007, which adds the namespace unconditionally, since it breaks stuff as per the bug discussion.
2011-10-06 20:11:44 +00:00
Sam Reed
4065e65d03 Even more documentation in various files 2011-05-29 14:24:27 +00:00
Roan Kattouw
abaa9ae3f3 (bug 24781) Define XML namespace for API output. Also created the referenced URL on the cluster. 2011-05-13 16:34:36 +00:00
Sam Reed
6309c920dd Delete all the "API for MediaWiki 1.8+" comments
Add since to ApiQueryQueryPage
2010-12-22 20:52:06 +00:00
Sam Reed
ee40f73227 Remove some unused keys from foreach
Documentation tweaks
2010-09-25 16:56:03 +00:00
Alexandre Emsenhuber
457eb73b61 Standardised file description headers, added @file 2010-08-07 19:59:42 +00:00
Derk-Jan Hartman
921619b119 Correct the address of the FSF in some of the GPL headers
59 Temple Place -> 51 Franklin Street
2010-06-21 13:13:32 +00:00
Sam Reed
e55ed729c4 Mixture of things.
Couple of class comments

Normalisation of "." usage at end of lines (removed)

Normalisation of {prefix}parameter as per bug 23461
2010-05-11 22:30:18 +00:00
Jack Phoenix
c286869e38 API: fix copyright symbol, coding style cleanup, more braces 2010-02-23 18:05:46 +00:00
Sam Reed
d2d950d256 Start of blanket coverage of dieUsageMsg in getPossibleErrors
Only basic ones done.

Couple of other modules done manually
2010-02-13 00:09:05 +00:00
Bryan Tong Minh
843acd3aab (bug 19528) Revert 55749: "according to the XSLT 1.0 spec, the MIME type should be text/xml or application/xml. In XSLT 2.0, it is application/xslt+xml. Either way, text/xsl is wrong." The mime type text/xsl is the only one supported by all modern browsers. 2010-01-23 15:27:53 +00:00
Aryeh Gregor
3758769f0d stylize.php on API code
"I wouldn't object to stylizing the API code to bring it in line with
the rest of MW on principle, but I'm not gonna bother myself." --Roan
<http://www.mediawiki.org/wiki/Special:Code/MediaWiki/60657#c5108>

If you're seeing this commit in blames, tell your blame tool to ignore
whitespace, e.g., git blame -w or svn blame -x -w.
2010-01-11 15:55:52 +00:00
Brion Vibber
ecf95fd877 Cleanup for r55641: call static function statically 2009-09-08 23:54:03 +00:00
Tim Starling
f4d32ce48b Fix for r53194: according to the XSLT 1.0 spec, the MIME type should be text/xml or application/xml. In XSLT 2.0, it is application/xslt+xml. Either way, text/xsl is wrong. 2009-09-02 08:05:47 +00:00
Roan Kattouw
3ac3ccaaf0 API: Refactor the XML formatter a bit so that ApiFormatXml::recXmlPrint() is now actually usable as a generic XML formatter 2009-08-27 21:15:20 +00:00
Bryan Tong Minh
e94bc9516d (bug 19528) Added XSLT parameter to API queries in format=xml 2009-07-13 21:37:49 +00:00
Roan Kattouw
a4d055587e API: (bug 18617) Add xml:space="preserve" attribute to relevant tags in XML output so overzealous XML parsers will leave whitespace in e.g. revision content alone 2009-04-29 13:12:27 +00:00
Roan Kattouw
bb81750f27 * API: (bug 17326) BREAKING CHANGE: Changing output format for prop=imageinfo&iiprop=metadata to something based on name/value pairs. This means we don't use parts of the metadata in attributes anymore, something that caused invalid XML to be output. For more info on the exact format, see the mediawiki-api mailing list
* Removed the spaces-to-underscores hack in the XML formatter
2009-02-03 16:25:50 +00:00
Chad Horohoe
be374a912a War on wfElement() and friends. Call the Xml members directly, rather than using old wrappers. 2008-12-14 19:14:21 +00:00
Roan Kattouw
f8dc72921f API: (bug 16105) Image metadata attributes with spaces produce invalid XML. Just replace spaces with underscores in the XML formatter and be done with it. 2008-10-25 15:53:58 +00:00
Tim Starling
f48c6070df Removed all instances of empty() where error suppression was not intended. Replaced with conversion to boolean, count() or empty string check as appropriate. Fixes a number of bugs due to incorrect conversion to boolean: suppressed edit summaries containing '0', ignored titles called '0', searches for '0' ignored, etc. 2008-10-25 14:04:43 +00:00
Roan Kattouw
6a2f8c1193 * (bug 15497) Removed encoding attribute from <?xml ?> tags 2008-09-10 13:39:24 +00:00
Brion Vibber
dae4d46723 Revert r37009 -- turns out you can do these structures, it's just very nonobvious. :)
An anonymous sub-array allows creating sub-elements in addition to the attributes:
array(
    'attrib1' => 'val1',
    'attrib2' => 'val2',
    array(
        'tag' => 'stuff',
        'tag2' => 'stuff2',
    )
)
2008-07-04 22:44:57 +00:00
Brion Vibber
4e4be177e4 Have been playing with custom API modules and been a bit frustrated with the XML output mode...
Adding pseudo-element _attribs alongside _element for XML output. There doesn't seem to be a good way currently to specify both attributes *and* subelements -- '*' lets you have text and attributes, but not sub-elements and attributes. Contents of _attribs will be added as attributes without disturbing the sub-elements.
2008-07-03 21:25:20 +00:00
Alexandre Emsenhuber
087a9f70c5 WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>

Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage

One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Bryan Tong Minh
3e0efaef14 (bug 11401) Added xmldoublequote to xml formatter 2008-03-03 22:19:03 +00:00
Roan Kattouw
19358606a1 API: Changing all modules' getParamDescription(), getAllowedParams() and getDescription() methods to public. ApiParamInfo needs them, and some versions of PHP threw fatal errors because they were protected. Oddly, other versions didn't (maybe because the caller and the callee have a common ancestor?) 2008-01-28 19:05:26 +00:00