Commit graph

82 commits

Author SHA1 Message Date
Szymon Świerkosz
44d988fb72 (bug 32434) API allows reblocking the user without reblock parameter.
This change adds special case in processing of the block form.
An unused parameter 'AlreadyBlocked' was replaced by 'Reblock'.
Parameter 'PreviousTarget' was added so API user can block him/herself.

Change-Id: I29275eb4b5f425b7382ba8b7dec050209878f81b
2012-12-20 17:02:40 +01:00
Aaron Schulz
e6faa2fd76 Merge "escape HTML elements in docblock with double quotes" 2012-07-18 19:17:46 +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
89bb46e2e4 API: Cleanup around comment/reason params
* Moving setting of empty string to param description.
* Removing word "(optional)" from comment/reason param, because all not
  required params are optional.
* Correct description of action=rollback for default comment.

Change-Id: Ifa5b60a7b55b216c43049cd81cb584b2e0518eed
2012-07-08 23:31:26 +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
Aaron Schulz
fdb74872a8 Merge "multi dbms support in api" 2012-05-20 18:15:42 +00:00
umherirrender
278bb4414f multi dbms support in api
Add some calls to Database::timestamp
Change some calls from Database::strencode to
Database::addQuotes to avoid ' in raw sql
Remove ' from ints in raw sql
Rename some vars to avoid duplicate names

Change-Id: I63f5602fa968f969a42932902a3ccc45fc54b432
2012-05-16 19:22:36 +02:00
Reedy
c87a63935a Merge "(bug 19195) Make user IDs more readily available with the API" 2012-05-10 18:47:42 +00:00
Szymon Świerkosz
aa86d2d3e6 (bug 35993) gettoken should go die in a fire (part 1)
Mark gettoken param as deprecated, so users can fix their tools.
The second part will remove the support for gettoken from ApiMain,
but that is in the future.

Change-Id: I369ddc740c38d80aa8389544087ac6671cabc618
2012-05-06 16:43:09 +02:00
umherirrender
426ccbf42e (bug 19195) Make user IDs more readily available with the API
Add some block ids and user ids to the result of some modules

Change-Id: If50604b888a54827eddde76574e779db6c7263ec
2012-04-22 14:20:46 +02:00
Reedy
df3e3943bd Bug 35646 - ApiBlockTest::testMakeNormalBlock() broken
Change-Id: I964cde249ce7193cb1ba8c3430645c36067876fb
2012-04-02 19:12:20 +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
56508fdca6 Removed usage of $wgUser in block and unblock processing:
* Made HTMLFormField pass the HTMLForm object to the validation and filter callbacks (so that they can get a context)
* Added new parameter to SpecialBlock::checkUnblockSelf() to pass the user doing the request
* SpecialBlock::processForm() and SpecialUnblock::processUnblock() now require a context as second parameter; added SpecialBlock::processUIForm() and SpecialUnblock::processUIUnblock() as adaptators from HTMLForm as second parameter to context
2011-11-13 07:25:56 +00:00
Sam Reed
fa65fa3243 Documentation
Deprecated code updates
2011-10-27 00:46:17 +00:00
John Du Hart
40f19e6def Adding context to the API
This will probably break something somewhere so when it does please yell at me on IRC and I'll fix it.
2011-10-26 23:27:01 +00:00
Aaron Schulz
7d5c9504b5 (bug 31679) Fixed use of 'allowusertalk' 2011-10-13 22:23:13 +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
Sam Reed
6e84e9ccd9 Followup r92396, add help urls for most of the core (non query) modules 2011-07-17 16:38:24 +00:00
Antoine Musso
6a8e32e986 Single messages can be passed as strings to Api::dieUsageMsg()
Since r88045
2011-05-19 17:51:16 +00:00
Paul Copperman
f7e6dfb4a3 Various fixes for PHPUnit tests:
* Block.php: Set mExpiry to the value we store in the database, so that Block::equals() returns true. Fixes BlockTest::testInitializerFunctionsReturnCorrectBlock.
* In Title::checkUserBlock(): Convert message parameters to plain strings to make strict comparisons work. Fixes TitlePermissionTest::testUserBlock().
* ApiBlock.php: Follow-Up r85166, add 'Confirm' parameter to data array. Fixes ApiBlockTest::testMakeNormalBlock().
* ApiQueryTest.php: Use $wgMetaNamespace instead of $wgSitename	to account for customizations.
* RandomImageGenerator.php: Use default value for constructor param to prevent fatals.
* ApiTestCaseUpload.php: 
** Fix undefined variable $fileName.
** Remove stray ini_set statements, they don't belong there. Especially ini_set( 'error_reporting', 1 ) will effectively disable all reporting, which makes errors hard to track.
* ArticleTablesTest.php: Put testbug14404() in group Broken, as the fix for the bug has been reverted in r83868.
2011-04-07 14:54:38 +00:00
Platonides
b37e81b76b Use class name Html in canonical form.
Removed unused globals $wgHooks, $wgBlockAllowsUTEdit, $wgUser, $wgOut
$wgUser was already set global at function beginning.
Moved global out of switch
2011-03-24 21:35:14 +00:00
Happy-melon
6dbcdc1be0 Blame hashar for this giant commit; he teased me for making so many smaller ones earlier... :D
* Internalise $mAddress/$mUser, $mBy/$mByName, $mEnableAutoblock, $mId as getTarget(), getBlockers(), isAutoblocking(), getId().  
* This required editing AbuseFilter and CheckUser backwards-incompatibly, so push the rest of the changes out to those extensions.
* Attack the evil 14-parameter constructor and gratuitously-confusing newFromDB( $notVeryImportantParameter, $moreImportantParameter)
* Reimplement the hack for bug 13611 in a slightly less fragile fashion; could still do with further cleanup, but then again the login frontend is its own can of worms... :S
* Remove transitionary getTargetAndType() and newFromTargetAndType() methods
* Some optimisation in parseTarget()
* Fix the broken phpunit test mentioned in r84251
2011-03-21 19:12:41 +00:00
Happy-melon
21fcf991d0 Follow-ups to r84258 2011-03-18 22:28:39 +00:00
Happy-melon
04aad77ea1 Follow-up r83825: fix fatal in API 2011-03-13 17:02:50 +00:00
Happy-melon
7805997608 Divert a river through the Augean Stables that is SpecialBlockip.php.
* Move to SpecialBlock.php, and rename class appropriately
* Complete refactor
* Use HTMLForm in block form.  This changes most of the ids and field names on the form, but allows proper validation, nicer formatting, clears up several fixmes, and is generally Better(TM).
* Spin various parts out into static functions, several of which properly belong in the backend (but Block.php is a worse mess still)
* Invert some of the block options so that every checkbox makes the block more severe (so "check to disable email" is fine, but "check to allow usertalk edit" (default true) is inverted to "check to disable usertalk edit" (default false). 
* revert r40359 (move doMassUserBlock() to core).  No one seems to be using this function, which has nothing to do with the frontend UI in SpecialBlock (it might perhaps belong in Block.php); it is pretty bespoke for CheckUser, doesn't seem to have very much utility elsewhere.
2011-03-12 21:54:35 +00:00
Alexandre Emsenhuber
60f1302644 Per Platonides, fix for r82686: make ApiUploadTest work again
Added option request parameter to User::editToken() and User::matchEditToken() and use them where possible from the api.
Also removed $_SESSION usage since it's no longer needed
2011-03-02 12:52:47 +00:00
Sam Reed
27ca6b2fa8 Tweak comments, remove some unused stuff.
Explicit definitions, move a few minor bits around
2011-02-27 21:10:11 +00:00
X!
867c9402be -Add &watchuser option to ApiBlock
-Write tests for ApiBlock
2011-01-02 19:58:27 +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
Roan Kattouw
17487e40ba Replace my old e-mail address with my new one in API comments. A bit outdated (dropped the old one in September '08) 2010-12-22 20:48:10 +00:00
Bryan Tong Minh
b98f2a5a71 (bug 25174) Add equal sign to boolean parameters in examples, so that the examples work immediately when posted 2010-11-23 22:05:27 +00:00
Sam Reed
42b5c265c0 * (bug 25248) API: paraminfo errors with certain modules
Added a needsToken() function, rather than calling getTokenSalt, which can throw silly errors due to dependencies on parameters
2010-10-01 20:12:50 +00:00
Alexandre Emsenhuber
457eb73b61 Standardised file description headers, added @file 2010-08-07 19:59:42 +00:00
Sam Reed
f77fff0ffb Followup r70461 if PARAM_REQUIRED is set, use for missing param in getPossibleErrors in ApiBase
All but ApiQueryBacklinks
2010-08-04 19:20:15 +00:00
X!
1afd723c5b Followup to r70460 and r70461: Use true instead of 1 2010-08-04 14:29:39 +00:00
X!
8b466d3d0d Followup to r70460: Committed wrong version of ApiBase.php, convert all core API modules to PARAM_REQUIRED syntax 2010-08-04 14:15:33 +00:00
Sam Reed
5387b8a806 Stylize API up to date
Fix spaces from r69755

Minor update to RELEASE-NOTES per r69753
2010-07-23 07:33:40 +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
50b88a5b1b Remove arrays from getDescription where we are only using 1 line 2010-05-25 20:46:09 +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
Roan Kattouw
7e9dcdd61b Fix coding style in r64230, r64256 2010-03-27 21:31:10 +00:00
Happy-melon
9990ba163e Per r64228 CR: make the check a static method in IPBlockForm to reduce duplication. 2010-03-27 15:05:56 +00:00
Happy-melon
d6fe6de7a8 Followup to r64228 - apply restrictions in API. 2010-03-26 23:02:10 +00:00
Jack Phoenix
ab5436aa56 ApiBlock.php: spacing & coding style tweaks, more braces, fixed copyright symbol 2010-02-21 12:32:46 +00:00
Sam Reed
878c7da630 Followup to r62557 as per Roans comment 2010-02-16 21:59:16 +00:00
Sam Reed
0e8b0b41ac Refactor requiresToken to getTokenSalt - Returns salt if exists, null if no salt, else false if no token required
Move sessionfailure (token validation checking) up a couple of levels

Part of bug 21991

Followup to r62482 and r62504
2010-02-15 23:53:43 +00:00
Sam Reed
80f9448690 Start of "Bug 21991 - Move common query parameter (uc, rc) validation, token requiringness/checking to ApiBase/Similar"
Move token requringness check to the ApiMain

Adding an exception if we're using "gettoken" (block/unblock)

Remove array( 'missingparam', 'token' ), from the getPossibleErrors of modules that set requireToken method to true
2010-02-14 22:20:27 +00:00
Sam Reed
bd1a643e6e Change layout of the mustBePosted format to standardise it 2010-02-14 21:12:11 +00:00
Sam Reed
72df21ef49 Followup to bryans comment for r62328
Rename possibleErrors to getPossibleErrors
2010-02-11 21:53:57 +00:00