Commit graph

320 commits

Author SHA1 Message Date
Jack Phoenix
4228459b24 ApiBase.php: coding style cleanup, added more braces, trimmed trailing spaces, changed copyright symbol to the proper one 2010-02-20 19:39:51 +00:00
Sam Reed
878c7da630 Followup to r62557 as per Roans comment 2010-02-16 21:59:16 +00:00
Sam Reed
eb9aa1686c Followup to r62557
Add array( 'sessionfailure' ) to getPossibleErrors for token using modules (missed adding when removing from individual modules!)
2010-02-16 01:27:19 +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
Roan Kattouw
3a953c8e30 API performance fixes: avoid unstubbing $wgContLang and $wgUser 2010-02-15 20:50:21 +00:00
Mark A. Hershberger
26a4587d80 follow up r62353 Make ApiBase::requireOnlyOneParameter() accept parameters that are set, but false. This means that you can pass in more than one parameter, as long as it is the same as the default (false). Have to do it this way since we'd like to default boolean parameters to false in getAllowedParams() but by the time requireOnlyOneParameter() is called, the defaults are set, so we can't tell the difference between passing in a parameter set to the default and just getting the defaults. 2010-02-15 07:06:49 +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
fcdb5b846c Move ( 'code' => 'show', 'info' => 'Incorrect parameter - mutually exclusive values may not be supplied' ) to messageMap 2010-02-14 15:16:09 +00:00
Mark A. Hershberger
8b36a2b969 various eol whitespace now instead of when someone needs to do CR 2010-02-12 06:44:16 +00:00
Sam Reed
bd7da13869 Simplification as per Bryan on r62339 comment 2010-02-11 23:09:38 +00:00
Sam Reed
c1af4821bf Cater for some more errors in ApiBase.php 2010-02-11 22:28:30 +00:00
Sam Reed
20206755ee $this->mModuleName to $this->getModuleName() 2010-02-11 22:18:16 +00:00
Sam Reed
8eb8e2e0d4 Update code documentation with Bryans help for r62282 and r62331 2010-02-11 22:06:45 +00:00
Sam Reed
72df21ef49 Followup to bryans comment for r62328
Rename possibleErrors to getPossibleErrors
2010-02-11 21:53:57 +00:00
Sam Reed
fe722d85a5 Move mustBePosted error into messageMap
Switch call to dieUsage to dieUsageMsg
2010-02-11 21:51:15 +00:00
Sam Reed
aa973b9eb7 More of bug 18771 - List possible errors in action=paraminfo
Followup to comments of r62282
2010-02-11 21:34:35 +00:00
Sam Reed
ee60482546 Start implementation of bug 18771 - List possible errors in action=paraminfo
Base has empty array() returning method, ApiBlock has implementation of possibleErrors from code above (possibly not complete)

Can be finished incrementally, so serves as a review point for Roan
2010-02-11 01:13:45 +00:00
Mark A. Hershberger
15fec3ab7f * Fix up ApiTest a bit, cookie handling works
* Start upload chunks testing
* found some problems with messages
2010-02-09 08:37:38 +00:00
Sam Reed
b15f2c8c46 Normalise comment usage (# --> //) 2010-01-23 22:52:40 +00:00
Sam Reed
47c24175d3 Add/remove whitelines to increase readability in API code files 2010-01-23 22:26:40 +00:00
Roan Kattouw
51107443dc API: Fix bug where deprecated boolean parameters would always trigger the deprecated warning. 2010-01-23 17:48:02 +00:00
Mark A. Hershberger
b15cccb688 ws only cleanup 2010-01-22 03:14:52 +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
Tim Starling
bd8fffe24d Reverted r58646 as per my comments on bug 20554. 2009-12-01 01:55:04 +00:00
Roan Kattouw
1b89cd274a API: (bug 20554) Expose average slave lag (avglag) as well as maxlag. Patch by Sam Reed. 2009-11-06 14:38:55 +00:00
Raimond Spekking
a0d01f9cae Follow-up r58237: fixing PHP Notice: Undefined variable: deprecated in /var/www/w/includes/api/ApiBase.php on line 633 2009-10-28 05:20:17 +00:00
Chad Horohoe
c660ee428f (bug 21106) tag deprecated parameter in action=paraminfo. Add new PARAM_DEPRECATED const for automagically tagging deprecated parameters. Keeps action=help and action=paraminfo up to date 2009-10-28 00:56:07 +00:00
Alex Z
216e60d01e (bug 18019) Warn users when moving a file to a name in use on a shared repo.
Allow only users with the 'reupload-shared' right to complete the move.
2009-10-24 04:36:11 +00:00
Siebrand Mazeland
f854edfe87 New permission 'sendemail' added. Default right for all registered users. Can for example be used to prevent new accounts from sending spam.
* hide some user settings if user is not allowed to send e-mail, but can receive e-mail
* update API 'cannot send e-mail' message
* FIXME: gives 'mailnologin'/'mailnologintext' as error. Error handling should be made more fine grained
2009-09-26 23:11:45 +00:00
Roan Kattouw
e3ab8ed99a API: BREAKING CHANGE: (bug 20426) Instead of throwing an error when a limit is set too high/low, throw a warning and continue with the limit set to the maximum/minimum 2009-08-28 16:37:48 +00:00
Bryan Tong Minh
05a916153f * Cleanup ApiUpload
* UploadBase::verifyUpload now always returns a status array
* Disabled async upload by url because wfShellBackgroundExec is broken
2009-08-26 19:38:38 +00:00
Roan Kattouw
9e881e1b2e Elaborate docs added in r53753 per CR comment 2009-07-26 18:24:47 +00:00
Roan Kattouw
4353f7b321 Followup to r53702: document $extradata parameter 2009-07-25 18:29:13 +00:00
Aryeh Gregor
da31137022 Better documentation for dieUsage()
If I got it wrong, please improve.
2009-07-23 23:50:04 +00:00
Michael Dale
369402239c other part of the r53342 commit 2009-07-15 23:15:51 +00:00
Michael Dale
aefc40d749 here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview

= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions

== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php

* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)

== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.

= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader

* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html  )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.

= js2 system  / mwEmbed=
$wgEnableJS2system = false

* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)

* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.

= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs  <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)

== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.

== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
Bryan Tong Minh
31d9947618 (bug 18533) Add readonly reason to readonly exception 2009-07-12 12:38:03 +00:00
Roan Kattouw
91271d809e API: (bug 18731) Show correct SVN links for extension modules in api.php?version . Guesswork to get the path assumes extensions are in a directory called extensions/extensionname , which should be a valid assumption on sane installs. 2009-05-09 12:52:38 +00:00
Chad Horohoe
c5ae50df41 Don't explicitly check for false. Most modules without params return an empty array rather than false, in which case we still don't want to output this. 2009-05-07 20:02:20 +00:00
Roan Kattouw
e484ef763d API: Fix regression from r32224 with caused bug 18597 (internal error for empty generator= parameter) 2009-04-27 14:21:16 +00:00
Roan Kattouw
1083d741dc Followup to r49013: forgot to commit ApiBase.php 2009-03-29 16:40:31 +00:00
Roan Kattouw
5e7acff52b API: Add nosuchuser message to ApiBase::$messageMap 2009-03-26 13:01:53 +00:00
Alexandre Emsenhuber
c53e76ad34 Changed ereg(i)_replace to preg_replace, the former is throwing E_DEPRECATED since PHP 5.3 2009-03-18 19:25:29 +00:00
Alexandre Emsenhuber
9dd9379eb4 Per anomie's report on IRC: $wgMaxArticleSize is in kilobytes, not bytes 2009-03-07 17:37:29 +00:00
Roan Kattouw
21fd7af97e * API: (bug 17774) API pretends action=query doesn't exist for users without read rights
* Instead of hiding read-restricted modules, throw an error when a user without read rights tries to use them
* Do the same for write modules when $wgEnableWriteAPI is false
* Indicate whether a module needs read or write rights in action=help and action=paraminfo
* BREAKING CHANGE: action=purge now requires write rights and, for anonymous users, a POST request
2009-03-06 13:49:44 +00:00
Roan Kattouw
5349ea2dd8 * API: (bug 13209) Add rvdiffto parameter to prop=revisions
* Add $wgAPIMaxUncachedDiffs (default 1) which controls how many non-cached diffs will be served per request
* Tweak DifferenceEngine.php a bit to make cache status accessible, and remove a useless 'parseinline' which broke diff generation in the API
2009-02-28 13:25:21 +00:00
Roan Kattouw
a4b89293d6 API: (bug 17703) Fix regression from r47039 causing error code and error text to be switched for some errors. r47039 was backported to the 1.14 branch, will backport this one too. 2009-02-27 14:28:12 +00:00
Roan Kattouw
fdb926bca4 * API: Add documentation to important API classes
* Move page_is_redirect up in ApiPageSet::getPageTableFields()
2009-02-11 19:25:25 +00:00
Roan Kattouw
81bf8d0a3a * API: (bug 17357) Add subpage moving to the API
* Added Title::moveSubpages() as a backend function
** Didn't update SpecialMovepage to use this; left to braver souls
* Fix handling of errors on talk page move (will backport)
2009-02-09 14:16:51 +00:00
Roan Kattouw
2df33ff098 * API: BREAKING CHANGE: (bug 11430) Return fewer results than the limit in some cases to prevent running out of memory
* This means queries could possibly return fewer results than the limit and still set a query-continue
* Add iicontinue, rvcontinue, cicontinue, incontinue, amfrom to faciliate query-continue for these modules
* Implemented by blocking additions to the ApiResult object if they would make it too large
** Important things like query-continue values and warnings are exempt from this check
** RSS feeds and exported XML are also exempted (size-checking them would be too messy)
** Result size is checked against $wgAPIMaxResultSize, which defaults to 8 MB

For those who really care, per-file details follow:

ApiResult.php:
* Introduced ApiResult::$mSize which keeps track of the result size.
* Introduced ApiResult::size() which calculates an array's size
  (which is the sum of the strlen()s of its elements).
* ApiResult::addValue() now checks that the result size stays below
  $wgAPIMaxResultSize. If the item won't fit, it won't be added and addValue()
  will return false. Callers should check the return value and set a
  query-continue if it's false.
* Closed the back door that is ApiResult::getData(): callers can't manipulate
  the data array directly anymore so they can't bypass the result size limit.
* Added ApiResult::setIndexedTagName_internal() which will call
  setIndexedTagName() on an array already in the result. This is needed for the
  'new' order of adding results, which means addValue()ing one result at a time
  until you hit the limit or run out, then calling this function to set the tag
  name.
* Added ApiResult::disableSizeCheck() and enableSizeCheck() which disable and
  enable size checking in addValue(). This is used for stuff like query-continue
  elements and warnings which shouldn't count towards the result size.
* Added ApiResult::unsetValue() which removes an element from the result and
  decreases $mSize.

ApiBase.php:
* Like ApiResult::getData(), ApiBase::getResultData() no longer returns a
  reference.
* Use ApiResult::disableSizeCheck() in ApiBase::setWarning()

ApiQueryBase.php:
* Added ApiQueryBase::addPageSubItem(), which adds page subitems one item
  at a time.
* addPageSubItem() and addPageSubItems() now return whether the subitem
  fit in the result.
* Use ApiResult::disableSizeCheck() in setContinueEnumParameter()

ApiMain.php:
* Use ApiResult::disableSizeCheck() in ApiMain::substituteResultWithError()
* Use getParameter() rather than $mRequest to obtain requestid

DefaultSettings.php:
* Added $wgAPIMaxResultSize, with a default value of 8 MB

ApiQuery*.php:
* Added results one at a time, and set a query-continue if the result is full.

ApiQueryLangLinks.php and friends:
* Migrated from addPageSubItems() to addPageSubItem(). This eliminates the
  need for $lastId.

ApiQueryAllLinks.php, ApiQueryWatchlist.php, ApiQueryAllimages.php, ApiQuerySearch.php:
* Renamed $data to something more appropriate ($pageids, $ids or $titles)

ApiQuerySiteinfo.php:
* Abuse siprop as a query-continue parameter and set it to all props that
  couldn't be processed.

ApiQueryRandom.php:
* Doesn't do continuations, because the result is supposed to be random.
* Be smart enough to not run the second query if the results of the first
  didn't fit.

ApiQueryImageInfo.php, ApiQueryRevisions.php, ApiQueryCategoryInfo.php, ApiQueryInfo.php:
* Added continue parameter which basically skips the first so many items

ApiQueryBacklinks.php:
* Throw the result in a big array first and addValue() that one element at a time if necessary
** This is necessary because the results aren't retrieved in order
* Introduced $this->pageMap to map namespace and title to page ID
* Rewritten extractRowInfo() and extractRedirRowInfo() a little
* Declared all private member variables explicitly

ApiQueryDeletedrevs.php:
* Use a pagemap just like in Backlinks
* Introduce fake page IDs and keep track of them so we know where to add what
** This doesn't change the output format, because the fake page IDs start at 0 and are consecutive

ApiQueryAllmessages.php:
* Add amfrom to facilitate query-continue

ApiQueryUsers.php:
* Rewrite: put the getOtherUsersInfo() code in execute()
2009-02-05 14:30:59 +00:00
Roan Kattouw
bb3980dd8d * API: (bug 17007) Add action=import
* Add intoken=import to prop=info
* Store message key and arguments in WikiErrorMsg
2009-02-04 20:11:27 +00:00
Roan Kattouw
8e361227a2 Revert r46512 (Add "check" parameter to action=email) and its followups r46515 and r46517. This functionality is already present in list=users (as usprop=emailable), where it belongs 2009-01-31 13:20:36 +00:00
Roan Kattouw
7babbd2fc5 Add the 'movenotallowedfile' message to the API message map. Turns out that's all I needed to do to support file moving through the API :D 2009-01-29 23:01:13 +00:00
X!
a9b78e1db9 Add "check" parameter to action=email 2009-01-29 01:25:17 +00:00
Roan Kattouw
6449867508 * API: (bug 15949) Add undo functionality to action=edit
* Move undo text generation from EditPage::getContent() to Article::getUndoText()
* Add some more examples for action=edit
* ApiEditPage.php: don't mix !is_null() and isset(), be consistent
2009-01-26 13:51:03 +00:00
Roan Kattouw
cd910c6544 API: Fix profiling errors caused by calling wfProfileClose() from dieUsage() 2009-01-23 20:23:34 +00:00
Alex Z
ff00dda0d0 Make API action=delete respect $wgDeleteRevisionsLimit 2009-01-20 23:37:39 +00:00
Roan Kattouw
781597bdce API: Fix weird ==/=== bug in API help: a possible value of zero is interpreted as "can be empty". 2008-12-21 00:21:01 +00:00
Roan Kattouw
8504bf43e2 API: Crusade against extract(). Left one extract() call alone in ApiQueryBacklinks.php because I don't have a better alternative for it. 2008-12-17 16:34:01 +00:00
Roan Kattouw
ec6060e5c9 API: Fix r42813, committed some stuff that shouldn't be committed just yet 2008-10-30 17:24:40 +00:00
Roan Kattouw
095803abf5 API: Tweak r42794 (add docs for ApiBase class constants) a little 2008-10-30 14:51:57 +00:00
Chad Horohoe
072649ebe8 Add some docs on these class constants 2008-10-30 00:39:21 +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
6ad1e45cd9 API: * BREAKING CHANGE: (bug 16074) Providing prop=revisions&rvprop=content with too many titles or revisions (typically through a generator) no longer causes an error, but a warning
* Added ApiBase::truncateArray() and used it in ApiBase::parseMultiValue()
2008-10-24 13:05:44 +00:00
Roan Kattouw
3ff1f89e0c * (bug 15845) API: Added pageid/fromid parameter to action=delete/move, making manipulation of legacy pages with invalid titles possible
* Fix an E_STRICT while I'm at it
2008-10-07 14:57:59 +00:00
Roan Kattouw
212720fa28 API: * (bug 15785) Allow for different expiry times for different protections, like the UI does
* BREAKING CHANGE: Alter action=protect output to display multiple expiry times
* BREAKING CHANGE: Error messages invalidexpiry and pastexpiry now state the expiry they're about
* Add ApiBase::PARAM_ALLOW_DUPLICATES and honor it in ApiBase::getParameterFromSettings()
2008-10-04 14:58:13 +00:00
Alex Z
1f5da24b79 *Don't let the API action=protect set actions that aren't in $wgRestrictionTypes or levels not in $wgRestrictionLevels
*Pass an array to Article::updateRestrictions for the expiry. Though it should allow for separate expiry times, like the normal UI.
2008-09-18 21:30:51 +00:00
Thomas Bleher
4e9dacf069 Escape $1 in message (was PHP syntax error) 2008-09-14 14:24:54 +00:00
Roan Kattouw
76635483de (bug 15359) Add APIGetAllowedParams and APIGetParamDescription hooks 2008-09-07 19:04:51 +00:00
Roan Kattouw
b624df0d43 (bug 15466) Added action=purge to the API. Modified patch by ^demon 2008-09-04 21:53:43 +00:00
Roan Kattouw
bd3bf5d2a7 * Split patrol code
** Backend code moved to RecentChange::reallyMarkPatrolled() and doMarkPatrolled()
** Adapted Article::markpatrolled()
* (bug 15466) Added action=patrol to the API. Modified patch by Soxred93
* Added rctoken=patrol to list=recentchanges
* Detect duplicate warnings in ApiBase::setWarning()
2008-09-04 15:17:51 +00:00
Bryan Tong Minh
a66bffaedf Fix for my previous commit: Filter out null values 2008-08-29 21:49:36 +00:00
Bryan Tong Minh
145775132b Add a function to require one and only one parameter of a list. 2008-08-29 21:09:18 +00:00
Roan Kattouw
f35031994a Fix fatal error caused by missing comma 2008-08-27 16:40:29 +00:00
Bryan Tong Minh
a9fd7beaef * Fixup validation methods in UserEmailForm a bit so that they don't return arrays when it's not necessary.
* Add email errors to the API's message map
2008-08-27 13:36:39 +00:00
Roan Kattouw
34a22d81f5 API: Improvements to action=emailuser:
* Add two messages from ApiEmailUser to ApiBase::$messageMap
* Add email tokens to prop=info
2008-08-26 21:34:47 +00:00
Roan Kattouw
1d3b95ab8d API: Throwing a more specific error message when the client tries to create empty new sections, which isn't allowed. Unknown error: ``228'' isn't very user-friendly. 2008-08-26 20:40:44 +00:00
Roan Kattouw
5331e82bd5 API:
* (bug 15048) Added limit field for multivalue parameters to action=paraminfo output.
* When the limit on multivalue parameters is exceeded, a warning is issued
2008-08-05 16:32:28 +00:00
Chad Horohoe
dc91b3b12d Badaccess-group1/2 no longer exist. 2008-08-05 14:44:00 +00:00
Roan Kattouw
042a034033 API: Add nocreate parameter to action=edit 2008-06-15 20:37:28 +00:00
Roan Kattouw
8b86f3bc01 (bug 14459) Added prependtext and appendtext parameters to action=edit 2008-06-12 13:05:07 +00:00
Roan Kattouw
cf5484e56f API: Added optional md5 parameter to action=edit. If set, the edit will only be committed if the MD5 hash of the text parameter equals the md5 parameter. 2008-05-28 09:22:40 +00:00
Roan Kattouw
d478350295 * Refactor Title::isValidMoveOperation() and Title::moveTo() to return an array of arrays like Title::getUserPermissionsErrors() does; other functions used by the write API have undergone similar refactoring earlier
* Handle these return values in MovePageForm::doSubmit() and ApiMove::execute()
* Remove separate AbortMove hook calls from MovePageForm and ApiMove; these were used to capture the hook error, but the new return type handles that. Also, it resulted in two calls to that hook for each move
* Remove comment about SpecialMovepageAfterMove hook from ApiMove::execute(): we don't need it, there's the TitleMoveComplete hook for that. SpecialMovepageAfterMove is a UI hook that doesn't belong in the API
* Add imagenocrossnamespace and imagetypemismatch errors to ApiBase::$messageMap
2008-05-27 14:42:51 +00:00
Roan Kattouw
000f346c1b Handle multiple warnings correctly in ApiBase::setWarning(). Calling this function twice from the same module used to throw a fatal error. 2008-05-20 19:43:50 +00:00
Roan Kattouw
119ca6e2ed API: Unrecognized values for multivalue parameters now don't cause the API to abort with an error anymore, but just throw a warning and are ignored. This is useful for ??prop parameters, but also applies to other multivalue parameters such as list, meta and prop. Single values still throw an error like they used to. 2008-05-20 19:31:45 +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
Victor Vasiliev
8f98402e51 * (bug 13965) Hardcoded 51 limit on titles is too limiting 2008-05-06 05:12:47 +00:00
Aaron Schulz
b76e7e0db0 Put some upper limit here 2008-05-03 04:17:03 +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
06d1b8087d (bug 11673) Return error 'unknown_action' in specified format 2008-04-05 19:32:21 +00:00
Roan Kattouw
07c2553b86 API: Forgot a whole bunch of messages specific to ApiEditPage 2008-03-30 18:59:27 +00:00
Roan Kattouw
b15f80ba74 Remove stray backslash 2008-03-28 16:17:04 +00:00
Roan Kattouw
6090218f2a API: Rename dontcreate to createonly, which actually makes sense 2008-03-25 21:12:01 +00:00
Roan Kattouw
e0a6679e8c Fixing E_NOTICE 2008-03-25 21:01:30 +00:00
Roan Kattouw
6afa8f9d63 API: Adding dontcreate parameter to action=edit 2008-03-25 20:41:55 +00:00
Roan Kattouw
53b7bdb63f API: Added help text message that specifies whether a module is POST-only 2008-03-25 15:47:23 +00:00
Alexandre Emsenhuber
2ed1bedb94 * Fixed call to deprecated functions
* Remove unused global declaration of $wgArticle in SkinTemplate::buildNavUrls()
2008-03-24 15:04:55 +00:00
Aaron Schulz
7389d07057 $value should come in as a string (if it doesn't, trim() will cast it to one anyway). Once trimmed, a truly empty list should be "" not "0". This fixes the massive namespace param breakage. 2008-03-21 06:28:02 +00:00
Victor Vasiliev
3cb5a4f858 Handle empty sets correctly 2008-03-20 16:28:38 +00:00
Roan Kattouw
69653bd247 API: Fixing limit=max output; previous implementation threw fatal errors under certain conditions and didn't accomodate for some modules having different limits in some cases. 2008-02-25 14:12:55 +00:00
Roan Kattouw
3f48af6d30 Fixing some messages in ApiBase 2008-01-25 12:52:14 +00:00
Roan Kattouw
491cc4a320 API: Making a bunch of state-changing modules require POST requests. 2008-01-18 20:43:59 +00:00
Roan Kattouw
0ffedad161 * Changing PageArchive::undelete() and undeleteRevisions() to return false rather than an error code
* Refactoring ApiUndelete to use ApiBase::dieUsageMsg()
* Adding new messages to ApiBase::$messageMap
2008-01-18 19:38:28 +00:00
Roan Kattouw
152463e335 * Refactored IPUnblockForm::doUnblock() to return an array of message keys and parameters
* Refactored IPUnblockForm::doSubmit() and ApiUnblock accordingly
* Added even more messages to ApiBase::$messageMap
2008-01-18 18:53:57 +00:00
Roan Kattouw
61a205a3c9 * Refactoring IPBlockForm::doBlock() to return message keys
* Refactoring ApiBlock accordingly
* Adding check for blockemail right to ApiBlock
* Adding more messages to ApiBase::$messageMap
* Fixing E_NOTICE in SpecialIpblocklist.php
2008-01-18 17:48:03 +00:00
Roan Kattouw
d371af72a8 API:
* Refactored ApiProtect. No need for core modifications this time :)
* Added permissions check to ApiMove to protect against messages with arguments getting none. moveTo()'s return value should really be modified, see also comment
2008-01-18 16:34:40 +00:00
Roan Kattouw
1b2b5ecde0 API: Unifying "the ... parameter must be set" messages into one ('missingparam'), expanding $1 in error codes as well. 2008-01-18 16:01:31 +00:00
Roan Kattouw
1f4ddb930d Core:
* Using getUserPermissionsErrors() rather than userCan() in Title::isValidMoveOperation()
* Removing blocked check from Article::doRollback(): Title::getUserPermissionsErrors() checks for that already

API:
* Refactoring ApiMove to use new messages system
* Adding more messages to ApiBase::$messageMap
* Removing unused parameter to 'notanarticle' in ApiDelete::execute()
2008-01-18 15:52:40 +00:00
Roan Kattouw
70b5fdd2c9 API:
* Refactored ApiDelete to use the new dieUsageMsg() system
* Adding some more messages to ApiBase::$messageMap
* Also using dieUsageMsg() for API-related errors in ApiRollback
* Removing 'lo' prefix for ApiLogout as it doesn't have any parameters anyway
2008-01-18 14:34:14 +00:00
Roan Kattouw
01a2386468 API:
* Introducing ApiBase::dieUsageMsg() function which outputs the error associated with a certain message key
* Updating rollback module to use dieUsageMsg(). Other modules will follow.
2008-01-15 20:21:16 +00:00
Daniel Cannon
5b6dd97612 API: Various docu and clean-up. 2008-01-12 07:08:17 +00:00
Rotem Liss
9d02a8c560 Quick solution for problems with limit=max when using slow queries: allowing modules to delay the parsing of limit=max until they get the actual maximum values, and making them parse it by themselves. 2008-01-05 10:05:34 +00:00
Victor Vasiliev
3a24c169ea API:
* Hide edit modules from help if $wgEnableWriteAPI is disabled
* Fix help formatting on UsageException
2007-12-02 15:04:53 +00:00
Victor Vasiliev
197ebe413c * Add limit=max to API. It also adds limit info to output 2007-11-29 15:19:56 +00:00
Roan Kattouw
073bc45c2b Adding apihighlimits permission. Users with this permission can request 10 times as many rows in API requests. Enabled by default for sysops and bots. 2007-11-29 14:51:58 +00:00
Roan Kattouw
4895ce631f Revert part of Brion's 27627: please don't throw away the child (maxlag) with the bathwater (format=raw) 2007-11-19 15:57:58 +00:00
Brion Vibber
b61adceeb9 Revert r27581, 27598, 27626
format=raw is an HTML injection machine like action=raw but without any safeguards; it's trivial to create JavaScript exploits which hit at least Internet Explorer.
There's no reason to add a whole new danger point here when you've got machine-readable structure already... please do not add this raw formatter back.
2007-11-19 15:32:06 +00:00
Victor Vasiliev
d7908b82e0 * Use ApiBase::dieDebug() to render maxlag error properly
* Allow modules to ignore maxlag attribute
2007-11-19 15:08:18 +00:00
Victor Vasiliev
60fc9cb245 API:
* Add format=raw
* Added raw output support to ApiExpandTemplates and ApiRender
2007-11-17 16:45:59 +00:00
Nick Jenkins
8d8b106dc2 Variable $user seemed to be used before it was defined - removing. 2007-08-20 08:04:12 +00:00
Yuri Astrakhan
380f66878f API: Removed maximum limit checking when running api in an internal mode. 2007-07-15 00:52:35 +00:00
Yuri Astrakhan
f5aa2e8018 API: implemented prop=imageinfo, minor cleanup 2007-07-07 03:05:09 +00:00
Yuri Astrakhan
fb4a5e0a4f API: Backlink-style queries (backlinks, imageusage, embeddedin) now use ??title parameter instead of titles (support for titles will be discontinued later). 2007-07-06 07:16:38 +00:00
Aryeh Gregor
a15c419b3d Remove ?>'s from files. They're pointless, and just asking for people to mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) 2007-06-29 01:19:14 +00:00
Yuri Astrakhan
583ac87532 API: Fixed error codes encoding per bug 10308. 2007-06-25 05:44:33 +00:00
Yuri Astrakhan
d656615e9f API: applied the patch by amidaniel to allow the same limits for sysops as for bots. 2007-05-22 04:39:49 +00:00
Yuri Astrakhan
b4de075600 API:
revisions - removed oldid (not used except in content retrieval), added extra prop options to optimize bandwidth, continue value is now an integer in JSON
 minor help screen improvement.
2007-05-21 06:32:32 +00:00
Yuri Astrakhan
cb38c11c84 API: documentation and cleanup. 2007-05-20 23:31:44 +00:00
Yuri Astrakhan
ef219bae7b API:
breaking change: Query watchlist shows flags only when explicitly requested with wlparam=flags, and rc_this_oldid (textid) is no longer accessible
query watchlist cleanup
bug in the integer parameter min/max validation
bug in feed formatting in error handling
some documentation
2007-05-20 10:08:40 +00:00
Yuri Astrakhan
ff52013a33 API: fixed Bug 9969: SQL error when an improper title is given to API
a bit better debugging facilities
2007-05-19 22:56:42 +00:00
Yuri Astrakhan
db6b9f7206 updated with the last api changes 2007-05-19 20:37:06 +00:00
Yuri Astrakhan
fea6038271 * API: Watchlist feed allows 'hours' parameter of how many hours to go back 2007-05-19 18:08:36 +00:00
Yuri Astrakhan
0f69063f40 API: minor code cleanup. Bug that exposed secure wiki pages should be fixed. 2007-05-19 06:42:08 +00:00
Yuri Astrakhan
15419ad729 API: resolved bug 8772: Parameter to limit results to revisions made by a particular user, when querying revisions for a page
(patch by Carl Fürstenberg)
2007-05-19 04:13:48 +00:00
Yuri Astrakhan
0e68016b72 * New properties: links, templates, images, langlinks
* Breaking Change: imagelinks renamed into imageusage (il->iu)
* Bug fix: incorrect generator behavior in some cases
2007-05-14 05:28:06 +00:00
Nick Jenkins
f9619da3f0 Yet more doc tweaks:
* Add @addtogroup tags to various classes, to try and group conceptually-related classes together.
* Add brief descriptions to various Special pages, thanks to Phil Boswell.
* Moving some docs to be right above the classes they represent, so that they are picked up.
2007-04-20 08:55:14 +00:00
Nick Jenkins
113bb1c772 Documentation tweaks to help documentation systems (Doxygen + PHPDocumentor)
pick up the appropriate tags, and documentation blobs for classes. This is 
the same as per r20769, but with the grouping changes (e.g. removing "@{{") omitted.
Please be advised that more related documentation tweaks may follow later - e.g. 
Doxygen generates a log file of warnings that is 574 Kb in size, when run over 
the just the trunk/phase3 code ... eek! Thankfully, much of that is just 
whining about functions without documentation   ;-)
2007-04-04 05:22:37 +00:00
Brion Vibber
3a6ac5a3c3 Revert r20769: we don't use PHPDocumentor anymore, we use doxygen.
If making mass changes to tweak to its preferences, probably better to do it for the tool we actually generate docs with. :)
2007-03-28 14:16:43 +00:00
Nick Jenkins
5fef2333d4 PHPDocumentor [http://en.wikipedia.org/wiki/PhpDocumentor] documentation tweaking stuff.
Minor doc tweaks to prevent some PHPDocumentor warnings or errors when run on the includes/ directory. PHPDocumentor uses a syntax very similar to javadoc - mostly we already use this, but there were a few scattered places that were adjusted to make them consistent with the rest of the code. In practical terms, these changes were made:
* @url becomes @link
* @fixme becomes @todo
* HTML tags in descriptions must be closed / balanced.
* @bug was removed (where the bug was long fixed), or changed into a @todo (in the few situations where the bug was still pending)
* @obsolete becomes @deprecated
* Things like "/**@{{" and "/**@}}*/" which cause "unknown tag" warnings were removed
* @access must be a valid access level.
* @desc tag not needed, removed.
* Doesn't seem to like @licence, will accept @license however.
* Use full comment block notation in a few places (i.e. open block with "/**", start each line with " *", and end block with " */")

Then additional to this, to get some class docs associated with their respective classes:
* Moved some docs to right above those classes (deleting blank lines, or moving descriptions from the file headers)
* Marked some classes without docs as "@todo document"
* (done up to "class MIMEsearchPage" on the "classtrees_MediaWiki.html" page for the includes/ directory)
2007-03-28 08:53:02 +00:00
Nick Jenkins
14c53b728f Code housekeeping stuff (and barring any stuff-ups on my behalf, there should be no changes in behaviour whatsoever after this) -
* removing some unused global declarations.
* removing or commenting out or adding comments for unused local vars.
* Adding one or two local var declarations.
* Declaring $matches array passed to preg_match() / preg_match_all() as array() before using [not required, just have a slight preference for the explicitness].
* remove one or two pass-by-reference function declarations where the value is not modified.
* Adding some braces to if-else blocks.
* In Parser.php, stripstrate is now an object rather than an array as per r17820, so we no longer need ask for a reference to it (as in "$x =& $this->mStripState;"), and in fact it's probably just simpler to get rid of $x altogether.
* Moving some preg regexes from "" quoting to '' quoting to stop static analyzer whinging about bad escape sequences.

... up to "LinksUpdate.php" in the includes/ directory.
2006-11-23 08:25:56 +00:00
Yuri Astrakhan
b900efa97f API * version param now links to the SVN
* debug case fixes 
* renamed ApiQueryContributions to ApiQueryUserContributions (a bit clearer)
2006-11-04 05:24:59 +00:00
Yuri Astrakhan
ed43f714f4 API * better self-description for various modules
* namespace type for parameters
* fixed bug with incorrect ordering in paging
* fixed bug with revisions and watchlist paging
2006-11-03 06:53:47 +00:00
Yuri Astrakhan
751f69aa94 API * Implemented backlinks / imagelinks / embeddedin modules
* Revised help screen
2006-10-30 00:18:05 +00:00
Yuri Astrakhan
815e545e4b API * Extra profiling for allpages * better help output 2006-10-22 19:52:22 +00:00
Yuri Astrakhan
88e42b579b API * Common field output function to simplify result generation
* Recent changes parameters
2006-10-21 08:26:32 +00:00
Nick Jenkins
33b7c11ded * Don't give attackers an opening by echoing back known bad parameter inputs.
* Create magic links only using a whitelist of protocols.

Have no proof of vuln, but allowing the user to make JavaScript links and have a lot of control over what goes into them probably isn't desirable.
Example attack input:
  http://en.wikipedia.org/w/api.php?action=query&meta=javascript://**/alert(1);

Example pre-patch HTML output contains this string:
  <a href="javascript://**/alert">javascript://**/alert</a>(1);
Which doesn't work, due to:
 1) the double slash - one slash someone can work around by faking a C-style comment (by appending "**/" as shown above), but two is a problem
 2) the parentheses being excluded, so we can't pass parameters
... but best to put a stop to it anyway.
2006-10-19 08:18:19 +00:00
Yuri Astrakhan
550c083a18 API
* Removed slow result SanitizeData
* Fixed watchlist feed bug (reported by nickj)
* Fixed HTML formatting bug (reported & fixed by nickj)
* clarified HTML intro message
2006-10-18 05:27:43 +00:00
Nick Jenkins
88879743df * Probably want "$this->mIsGenerator = false;", not "$mIsGenerator = false;"
* rm unused global declaration.
* rm references usage in a foreach iteration ($info does not seem to be assigned to anything, so no benefit to using refs).
* Define local var in error printout.
* rm a few local vars that look unused.
* Make paranoia check do something.
2006-10-17 09:27:39 +00:00
Yuri Astrakhan
f928f9a6cd API * Better log events info * Added RAW debugging format 2006-10-17 02:01:20 +00:00
Yuri Astrakhan
39fda46535 API * better profiler modules naming 2006-10-16 23:25:51 +00:00
Yuri Astrakhan
519252da6e API * Enabled global profiling 2006-10-16 23:16:12 +00:00
Yuri Astrakhan
262435b9f8 * API: help screen now shows default and allowed parameter values
* API: added experimental watchlist rss/atom feed
* API: if available, json_encode() will be used
* API: opensearch parameter changed to "search=" (more descriptive)
* API: minor parameter cleanup, a wrapper for Feed class
2006-10-16 00:08:03 +00:00
Yuri Astrakhan
7a710254db * API query optimizations
* API allow modules to have custom printers
2006-10-15 07:43:52 +00:00
Yuri Astrakhan
b56d23ed46 * API: Restructured to allow internal usage. Error handling cleanup.
* API: Added opensearch module, added apprefix param for list=allpages
2006-10-14 07:18:08 +00:00
Yuri Astrakhan
f229bdc8be * API: added watchlist module (incomplete)
* API: minor param cleanup
2006-10-13 06:13:13 +00:00
Yuri Astrakhan
31775400d8 *API: rewired generator (more work needed)
*API: structure cleanup: module names & parameters
2006-10-03 05:41:55 +00:00
Yuri Astrakhan
4ade08ef76 * API: implemented generator function
* API: enabled allpages to function as a generator
2006-10-02 23:56:19 +00:00
Yuri Astrakhan
c01eb06e5e *API: better version gen, added check for read-only api, added allpages params description 2006-10-02 18:27:06 +00:00
Yuri Astrakhan
04399b2063 * API: added version information to each module (available via api.php?version command) 2006-10-01 21:20:55 +00:00
Yuri Astrakhan
e859600cea * API: pageSet now supports pageids, revised revisions listings, lots of examples. 2006-10-01 20:17:16 +00:00
Yuri Astrakhan
85de1cb74b * Code cleanup per TimStarling's suggestions 2006-10-01 04:38:31 +00:00
Yuri Astrakhan
f97b323e00 * API: result data generation cleanup, minor cleaning 2006-10-01 02:02:13 +00:00
Yuri Astrakhan
8deda5c25a * API: revisions & pageset cleanup 2006-09-30 08:06:27 +00:00
Yuri Astrakhan
5c1ca0fc83 * API: Refactored per brion's suggestions
* API: began query revisions implementation (incomplete)
2006-09-27 05:13:48 +00:00
Yuri Astrakhan
8a7397e8ad * API: Overall query-related cleanup. 2006-09-26 06:37:26 +00:00
Yuri Astrakhan
972b72f879 * API: All pages list
* API: Reworked parameter processing
2006-09-26 05:43:02 +00:00
Yuri Astrakhan
e57335a633 * API: Query Meta SiteInfo module
* API: Improved query help screen
2006-09-26 01:44:13 +00:00
Yuri Astrakhan
fcfcf6fdf9 * API-query: normalization
* API: help screen improvements
2006-09-23 23:30:25 +00:00
Yuri Astrakhan
1fc6e9cc86 * API: major refactoring
* API: added login functionality
* API: added several output formats (needs optimization)
2006-09-23 15:57:16 +00:00
Yuri Astrakhan
e7ad7f3d41 * Non-working API to facilitate dev collaboration. Do not enable this yet in localsettings.php. 2006-09-08 14:27:58 +00:00