Commit graph

133 commits

Author SHA1 Message Date
Siebrand Mazeland
fe05f85a62 Update formatting on API classes
Change-Id: Ifd18a8de1d2580b723a5b91e8d202818fd97795a
2013-11-14 17:03:20 +00:00
Brad Jorsch
c94454687f Return errors from WatchAction
Currently, WatchAction::doWatch and WatchAction::doUnwatch return true
always. Let's have them return a status object instead.

This also cleans up the handling of Status objects in some of the API
modules.

Change-Id: I9dd9f0fd499c37f29fa12bcdb6142238a1f11e4d
2013-06-20 15:51:05 -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
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
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
umherirrender
85d8ee1f87 Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I00f369641320acd7f087427ef031f3ee7efa0997
2012-10-10 20:14:40 +02:00
daniel
c546fae8ed merge latest master into Wikidata branch
Change-Id: Id4e0f40c03679c13d8934a6add99b5cd86d0437d
2012-10-08 13:58:54 +02:00
umherirrender
36c375f766 pass user object for delete/undelete/filerevert in api/gui
Change-Id: Idd214fa1ad9d05ebb2a79225256fb344a1085e9d
2012-10-06 11:54:50 +02:00
Reedy
872b3f9d58 Bug 40756 - API: Call to a member function isGood() on a non-object in ApiDelete.php
Change-Id: I88eefe177f1f6d77bed035ebe4967a8c714615f4
2012-10-04 14:52:03 +01:00
daniel
29719f846b merging latest master
Change-Id: I36b7f2f63ab8c08f8412d521dc68ea45c8b67711
2012-08-20 16:55:28 +02:00
Reedy
e3f2a90bf0 Remove unused variables/function values returned
Fix trailing whitespace

Change-Id: I53abf75e142f0166032b98e4adb3dabe06643017
2012-08-08 00:47:25 +01:00
daniel
d87135d706 merged master
Change-Id: Iad12ee382d6aeb1fab6fefb611d290b74865ea4b
2012-07-23 22:07:18 +02:00
Aaron Schulz
85f3f3d7b6 Merge "Updated result properties in paraminfo API" 2012-07-21 09:09:02 +00:00
umherirrender
06166e334a (bug 38190) Add "required" flag to some token params
action=block/action=unblock can not have the token required because when
using the gettoken param, the token param can not set.

Change-Id: I15317f16c06f150d29c1b17de76f41a6cfa84820
2012-07-20 15:45:51 -07:00
Aaron Schulz
e6faa2fd76 Merge "escape HTML elements in docblock with double quotes" 2012-07-18 19:17:46 +00:00
Catrope
cf4da8140b Merge "API: Cleanup around comment/reason params" 2012-07-18 01:59:34 +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
Reedy
1aac87e9f1 Fix for: Fatal error: Call to undefined method ApiDelete::getErrorsArray()
Fatal error:  Call to undefined method ApiDelete::getErrorsArray() in /usr/local/apache/common-local/php-1.20wmf7/includes/api/ApiDelete.php on line 65

Caused by https://gerrit.wikimedia.org/r/#/c/7572/

Change-Id: Ib86fab94667ed50d172eb7ea3e82c99ecb3e52b0
2012-07-14 01:11:54 +01: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
4b70aea869 Updated result properties in paraminfo API
Recent changes I6e388e75 and Ia6415b39 introduced
new result properties, but didn't update getResultProperties().
This patch corrects that.

Change-Id: I18d088d76a48ec0d70408a8ac27a9af716839b61
2012-07-07 15:29:14 +02:00
Siebrand
5fb8b96195 Merge "Expose the log_id of the deletion log entry in the action=delete API" 2012-07-01 15:55:29 +00:00
daniel
a830943203 Merge branch 'master' of ssh://gerrit.wikimedia.org:29418/mediawiki/core into Wikidata 2012-06-14 12:43:43 +02:00
daniel
7a6ce6c2d8 un-deprecate WikiPage::getAutoDeleteReason 2012-06-13 12:00:28 +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
daniel
01f36b721f merged latest master 2012-05-14 23:24:18 +02:00
Catrope
3068742546 Expose the log_id of the deletion log entry in the action=delete API
This entails some refactoring to actually surface the log_id all the way
up:

* Made doDeleteArticleReal() return a Status object rather than a
  constant, and put the log_id in $status->value. This Status object is
  also passed to the ArticleDelete hook.
* Kept doDeleteArticle() the same for extension compatibility.
* Switched all core callers of doDeleteArticle() to
  doDeleteArticleReal() and surfaced the error message from the Status
  if appropriate, rather than hardcoding 'cannotdelete' all over the
  place.
* Exposed the log_id in ApiDelete
* Add 'delete-hook-aborted' message for when a hook aborts the deletion
  but does not provide an error message. Previously this just caused the
  'cannotdelete' message to appear.

Change-Id: Ia6415b390d5d4172ce96667f46ccdba2be02461f
2012-05-13 18:20:05 -07:00
Alexandre Emsenhuber
18cc220038 Don't make two database requests to load the same object, again.
I know there's no second parameter to WikiPage::newFromID(), but this will change soon.

This follows-up I098dd36619fff3610be6894037220d3472b809d5.

Change-Id: Ic28b7e05db51e55a5f49fed70c042ba11e4d97fe
2012-05-04 22:10:36 +02:00
umherirrender
e0ded894d9 (bug 30488) API now allows listing of backlinks/embeddedin/imageusage
per pageid

Move the possibles errors set by ApiBase::getTitleOrPageId to
ApiBase::getTitleOrPageIdErrorMessages and remove it from used modules

Change-Id: If037e04665d2524c1f2476bc7996d9573753a4b8
2012-05-02 01:35:04 +01:00
daniel
af28c6f55a merged from master 2012-04-29 21:41:03 +02:00
Reedy
b9e6daa3aa Simplify and refactor out api code for getting title or page id
Change-Id: I098dd36619fff3610be6894037220d3472b809d5
2012-04-27 15:58:04 +01:00
daniel
a990fd78ff merged from master 2012-04-25 19:49:09 +02:00
Alexandre Emsenhuber
fbd17f8f52 Make data loading a bit better in ApiDelete.
* Use WikiPage::newFromID() directly instead of Title::newFromID() (for now it does not change anything but it will soon)
* Directly load the data from the master when creating a page from its name, it avoids both having out-of-date information
  when doing the existence check and a second database query from LinkCache::addLinkObj() when calling (WikiPage|Title)::exists()
* Moved the page existence check to only be executed when creating a title from its name since if we have a WikiPage from its ID it must exist.

Change-Id: Ifaff725d955ce111c46d6b7f00610191820f3ced
2012-04-16 13:18:10 +02:00
Jens Ohlig
10e91851b2 Merge branch 'master' into Wikidata
Conflicts:
	.gitreview
	includes/Article.php
	includes/AutoLoader.php
	includes/EditPage.php
	includes/LinksUpdate.php
	includes/WikiPage.php
	includes/installer/Ibm_db2Updater.php
	includes/installer/MysqlUpdater.php
	includes/installer/OracleUpdater.php
	includes/installer/SqliteUpdater.php
	maintenance/refreshLinks.php
2012-04-11 14:24:29 +02:00
Daniel Kinzler
827f24deed auto-summary, auto-delete-reason 2012-04-04 19:56:43 +02:00
Sam Reed
7b25f8231f 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:30:01 +00:00
Max Semenik
c7bc27d5f8 Consistency: made all API examples a verbs 2012-01-12 17:36:06 +00:00
Sam Reed
6115b93df8 Re-instate most of the revisions for bug 33147 "API examples should explain what they do"
Using this to sync up my working copies

Should have the little niggles tidied up though
2011-12-27 16:22:35 +00:00
Alexandre Emsenhuber
4f68ae8939 * Integrate $wgDeleteRevisionsLimit in Title::getUserPermissionsErrors() (only if doing expensive checks)
* Moved WikiPage::estimateRevisionCount() and WikiPage::isBigDeletion() to Title and marked those WikiPage methods as deprecated (only call in extensions removed in r107385)
* Show an error message when deleting a page to move another one in Special:MovePage and the deletion fails due to permissions errors (previously the form would simply show again)
* Cache the result of Title::estimateRevisionCount() since it's called two times when showing the deletion form and the user doesn't have 'bigdelete' right (one for the permissions check and the other when showing the number of revisions)
2011-12-27 15:29:44 +00:00
Brion Vibber
02bb594ac7 Revert r106521: creates lots of long, unwrappable lines in help output 2011-12-20 21:26:57 +00:00
Sam Reed
b0818acd86 More example conversions/additions
Ping r106439
2011-12-17 19:10:33 +00:00
Sam Reed
53000baecf Oh noes, moar http:// -> https:// 2011-11-28 15:43:11 +00:00
Alexandre Emsenhuber
2bb8c2ea4d * Use WikiPage instead of Article
* Create the WikiPage object directly in execute() and pass it to both delete() and deleteFile()
* Reordered parameters of delete() and deleteFile() to be consistent and take both on the WikiPage and User objects (instead of relying on $wgUser); no callers outside of this class
* Fixed deleteFile() to match the behaviour of FileDeleteForm with oldimage parameter
* Pass the User object to getPermissionsError()
* Factorised duplicated code
* Added missing error code to ApiBase (and also a new one)
* Added missing possible error codes (with a new one too)
2011-11-16 15:57:56 +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
Sam Reed
fa65fa3243 Documentation
Deprecated code updates
2011-10-27 00:46:17 +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
Aaron Schulz
55c6aed1ab Removed raw Article->field accessing 2011-06-28 14:10:55 +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
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
Happy-melon
bc4a096805 Revert r86001: Brion says it's too scary :D will recommit in pieces 2011-04-13 23:36:27 +00:00