Commit graph

273 commits

Author SHA1 Message Date
Sam Reed
40dd0530f9 Stylize API files 2010-02-13 01:41:37 +00:00
Sam Reed
6911358977 Complete dieUsage errors in 6 more Api files 2010-02-13 01:05:14 +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
Sam Reed
fe722d85a5 Move mustBePosted error into messageMap
Switch call to dieUsage to dieUsageMsg
2010-02-11 21:51:15 +00:00
Sam Reed
cf8d7ff1eb Add myself to Api Credits 2010-01-31 23:28:33 +00:00
Sam Reed
b15f2c8c46 Normalise comment usage (# --> //) 2010-01-23 22:52:40 +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
12b8a2a75e Restored the function of ApiMain::requestWriteMode(), as per the suggestion on CR r50833. 2009-12-11 06:49:48 +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
Roan Kattouw
ef4886778f API: Per CR comments on r56091, make the timeout for the API help cache configurable 2009-09-17 19:39:34 +00:00
Roan Kattouw
87d401f2e6 Fix r56091: cache URLs with and without ?version separately 2009-09-17 15:47:44 +00:00
Roan Kattouw
29c594f9a4 Follow-up to r55639: per CR comment, make API help caching disableable, and let the cache key depend on the version string 2009-09-09 12:54:56 +00:00
Roan Kattouw
d7f593a312 API: Add user-agent and method (GET/POST) to request logging, and only log the action= parameter for mustBePosted modules 2009-08-27 22:09:28 +00:00
Roan Kattouw
adf309bdc8 API: Cache API help in memcached, inital use of the API log added earlier seems to indicate that the help is expensive. Cache doesn't seem to help for me locally, so we probably need to test this on a real server and see if it really works. 2009-08-27 18:25:51 +00:00
Roan Kattouw
0070e5c6e2 Revert r52190 ("Return HTTP 503 on API maxlag error"): announcement prompted many complaints, and the change never went live. 2009-07-16 08:04:15 +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
a7f355adbb API: Return HTTP 503 status code on maxlag error, like index.php does 2009-06-20 08:10:30 +00:00
Roan Kattouw
1ce9347d01 Re-adding ApiMain::requestWriteMode() (removed in r48901) for backwards compatibility: this way extensions can call requestWriteMode() AND define function isWriteMode() { return true; } without causing fatal errors 2009-05-20 20:07:33 +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
Roan Kattouw
5811f0e274 API: (bug 16422) Don't show help in format=jsonfm unless specifically requested with action=help 2009-04-28 11:42:14 +00:00
Roan Kattouw
549b1688cc Redo r48746 (API userrights, reverted in r48909 and r48910) in a way that doesn't break CentralAuth. Basically, this works around PHP's inability (at least in < 5.3) to override static methods by adding a hook. Changes to CentralAuth in next commit. 2009-03-28 19:08:47 +00:00
Andrew Garrett
d4d0329547 Revert r48746 (API userrights). Breaks Special:GlobalGroupMembership by changing overridden methods to static methods, which cannot be overridden. Also reverts r48747, r48814, r48778, r48775 2009-03-27 05:59:42 +00:00
Roan Kattouw
3c52c2c64b * API: (bug 15935) Add action=userrights to the API
* Add ustoken=userrights to list=users
* Move the non-UI part of UserrightsPage::saveUserGroups() to the static and more generic doSaveUserGroups()
* Add a $reason parameter to UserrightsPage::addLogEntry() and make it and its helpers static
* Move UserrightsPage::changeableGroups() and changeableByGroup() to the User class and make the latter static
* In doSaveUserGroups(), drop groups that the user doesn't have from $remove (and those that they do have from $add), and return array($add, $remove)
* Fix up a comment in ApiQueryRecentChanges
2009-03-24 16:04:50 +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
f6307768aa API: Make UTF-8 cleanup actually work; it was broken from the beginning. Apparently I expected array_walk to behave like array_map, which is not the case. 2009-02-10 15:56:34 +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
4b20f8cc75 API: ApiBase::dieUsage() is not a static function, fix static calls 2009-01-23 20:08:00 +00:00
Roan Kattouw
5559e3f2b9 API: Clean up invalid UTF-8 in the result before feeding it to the formatter. This should fix bug 15261 (trimmed multibyte chars) and bug 16262 (chars like \x0f) 2009-01-14 21:22:00 +00:00
Tim Starling
4daa2dbb6a Don't use getParameter() inside substituteResultWithError(), since it will try to call dieUsage() again if the format parameter is invalid. This fixes the error message for invalid formats, which was broken. 2008-11-14 00:30:34 +00:00
Alexandre Emsenhuber
925846c7d5 Do a last check before creating the object to not throw a fatal error when calling api.php?format= 2008-10-25 16:23:09 +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
Ilmari Karonen
d01d0edd98 Use getParameter() for the "maxage" and "smaxage" parameters rather than pulling them straight out of the request
so that they'll be properly validated (and in particular coerced to integers).
2008-10-10 17:09:53 +00:00
Ilmari Karonen
69c1dd9e7e Make the API maxlag check send the same "Retry-After" and "X-Database-Lag" headers as wfMaxlagError() does.
The HTTP status code is still different, I can see arguments for having it either way.
2008-10-01 21:38:13 +00:00
Roan Kattouw
c2383bff2b Forgot to commit a file in my TODO/FIXME crusade. 2008-09-25 22:41:03 +00:00
Tim Starling
9f84a2fe83 Log exceptions encountered in api.php. Check for null $wgRequest. 2008-09-21 09:38:55 +00:00
Roan Kattouw
353345d6ab API: Adding APIAfterExecute, APIQueryAfterExecute and APIQueryGeneratorAfterExecute hooks to make extending core modules possible in a cleaner way 2008-09-17 18:49:22 +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
Tim Starling
fde6099061 header() replaces by default, there's no need to pass a second parameter 2008-09-01 04:32:36 +00:00
Bryan Tong Minh
6578dd7890 wfReadOnly now checked in ApiMain::requestWriteMode 2008-08-28 20:25:53 +00:00
Roan Kattouw
44475e0314 Adding action=watch to the API 2008-08-21 15:44:13 +00:00
Bryan Tong Minh
2776bbd98e Fix up my name. 2008-08-19 15:08:14 +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
Roan Kattouw
606d921911 * (bug 15044) Added requestid parameter to api.php to facilitate distinguishing between requests
* Clean up indentation from r38566
* Use $this->mRequest rather than $wgRequest in ApiMain
2008-08-05 16:12:52 +00:00
Roan Kattouw
25b6fa8d24 * Mention multivalue parameters in the message about apihighlimits
* Add Bryan Tongh Minh to the API credits. Half of all image-related code is his
* Add myself to CREDITS. Why do we sort that by first name, though? Kind of weird
2008-08-04 14:37:26 +00:00
Chad Horohoe
6959321d61 Display permissions specific to the API (such as writeapi and apihighlimits) on action=help. For apihighlimits, give the limits they're held to (bug 14713) 2008-08-04 14:26:20 +00:00
Chad Horohoe
4426ed9527 Tweak the version info for MW just a bit, bring it more in line with the module listings in terms of formatting. 2008-08-02 14:51:40 +00:00
Victor Vasiliev
d4ceec6775 * (bug 14968) Specifying blank action parameter triggers API error now 2008-07-30 07:23:22 +00:00
Roan Kattouw
f299cc1fc7 (bug 14758) unknown_action message was output twice, once formatted and once unformatted 2008-07-08 20:53:41 +00:00
Chad Horohoe
e539d06170 (bug 14678) Make API respect $wgShowSQLErrors and $wgShowExceptionDetails. Patch by Max Semenik. 2008-06-29 00:07:13 +00:00
Roan Kattouw
21e108b5ff Oops, gotta use $exp here 2008-06-21 15:06:40 +00:00
Roan Kattouw
10c679488c Revert live hack from r36493, because it has no effect whatsoever.
$params['action'] cannot be an invalid action, because the $params array is filled by ApiBase::extractRequestParams() which checks whether the parameters are valid and throws an error message (ironically implemented with a UsageException) if they're not.
2008-06-20 10:51:17 +00:00
Brion Vibber
cc722a0b4c Apply live hack -- exception for invalid actions (as opposed to....?) 2008-06-19 23:48:09 +00:00
Roan Kattouw
a1d340cb43 Add maxage too 2008-06-16 20:06:23 +00:00
Roan Kattouw
044ad0c0ce (bug 14402) Added smaxage parameter to api.php 2008-06-16 19:49:43 +00:00
Bryan Tong Minh
1a3664ee7e API: Add action=emailuser 2008-06-01 17:58:27 +00:00
Roan Kattouw
379eb2210b * Added 'writeapi' right that controls access to the write API. Users who don't have this right won't be able to use the write API modules even if $wgEnableWriteAPI = true; and they have the other rights required
* Checking for 'writeapi' in ApiMain::requestWriteMode() and tweaking the noapiwrite error message a bit
* Granting this right to *, user and bot by default.

For extra clarity: to e.g. move pages through the API, a user needs to have the 'move' right AND the 'writeapi' right AND $wgEnableWriteAPI = true;
2008-05-27 15:43:07 +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
Roan Kattouw
72b793a695 Remove deprecated ApiMain::scheduleCommit() 2008-05-18 20:15:56 +00:00
Tim Starling
a4eaa89625 * Fix unlogged automatic user creation: run wfLBFactory()->shutdown() unconditionally in api.php. If you want to optimise it, do it in the database backend, since there's no way for the MW core to indicate to the web API that a write query has been performed. The previous code was also wrong in that it didn't commit transactions on foreign connections.
* Fixed debugging code left in (mustBePosted disabled).
2008-05-17 04:26:26 +00:00
Roan Kattouw
af9727e637 Re-applying r34440 (documenting ApiQueryBase) 2008-05-10 09:29:34 +00:00
Brion Vibber
4bc02c88ca Revert to r34430 in order to revert r34431 which is breaking the site (unindexed filesorts) 2008-05-09 18:00:15 +00:00
Roan Kattouw
2fe7734396 Documenting some API stuff 2008-05-08 15:46:06 +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
Roan Kattouw
68bbfc12c0 Committing patch for bug 10931, which also fixes bug 13651. For a detailed explanation of what this commit does, see bug 10931 comment #24 2008-04-11 15:20:45 +00:00
Bryan Tong Minh
06d1b8087d (bug 11673) Return error 'unknown_action' in specified format 2008-04-05 19:32:21 +00:00
Tim Starling
fbfb509df5 * Introduced LBFactory -- an abstract class for configuring database load balancers and connecting to foreign DBs.
* Wrote two concrete implementations. LBFactory_Simple is for general installations. LBFactory_Multi will replace the runtime configuration used on Wikimedia and allow load-balanced connections to any DB. 
* Ported Special:Userrights, CentralAuth and OAI audit to the LBFactory system. 
* Added ForeignDBViaLBRepo, a file repository which uses LBFactory.
* Removed $wgLoadBalancer and $wgAlternateMaster
* Improved the query group concept to allow failover and lag control
* Improved getReaderIndex(), it will now try all servers before waiting, instead of waiting after each.
* Removed the $fail parameter to getConnection(), obsolete. 
* Removed the useless force() function. 
* Abstracted the replication position interface to allow for future non-MySQL support.
* Rearranged Database.php. Added a few debugging features. 
* Removed ancient benet-specific hack from waitForSlave.php
2008-03-30 09:48:15 +00:00
Roan Kattouw
a1e4f7a51c Removing ApiChangeRights module 2008-03-27 21:13:03 +00:00
Yuri Astrakhan
ae188d8682 Updated credits per discussion with Brion 2008-03-20 06:54:24 +00:00
Roan Kattouw
550aa15685 API: Adding more detail in credits 2008-03-17 20:13:22 +00:00
Roan Kattouw
b558d012f2 API: Updating action=help credits to give Yuri and Vasiliev due credit 2008-03-17 18:16:51 +00:00
Roan Kattouw
e0aae6a658 API: Adding action=edit module 2008-03-03 18:08:40 +00:00
Brion Vibber
46619295eb Safety fixes for API:
* drop user credentials for JSON callback output
* anticipating future changes, don't report anon edit tokens in JSON callback output
2008-03-03 05:45:37 +00:00
Roan Kattouw
7de8bc26be API: Updating credits to reflect my having replaced Yuri as de facto API lead developer, and referring to mediawiki-api and Bugzilla for questions/suggestions 2008-02-07 15:58:53 +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
Roan Kattouw
9c55586e57 Tweaking r30119: changing txt and dbg's MIME type to text and adding txtfm and dbgfm with HTML-escaped stuff. 2008-01-24 13:16:34 +00:00
Roan Kattouw
d2cb8c025e No need to revert r30078: HTML-formatting the data is enough. Attacks like api.php?action=paraminfo&modules=%3Cscript%3Ealert('Owned');%3C/script%3E&format=txt don't work anymore now. 2008-01-24 13:12:03 +00:00
Brion Vibber
c0801b22f0 Revert r30078 -- formats "txt" and "dbg" dump raw unfiltered text contents into HTML output. XSS vector. 2008-01-23 23:06:10 +00:00
Roan Kattouw
262afb4b62 API: Adding txt and dbg formats, imported from query.php 2008-01-23 19:51:21 +00:00
Roan Kattouw
8a0e46d97c API:
* Fixing buggy class instantiation in ApiParamInfo
* Adding getModules() method to ApiMain and ApiQuery
2008-01-23 18:40:40 +00:00
Roan Kattouw
abaf9995ba (bug 12718) Added action=paraminfo module that provides information about API modules and their parameters 2008-01-22 21:22:04 +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
bb7f8624d1 API:
* Removing action=render module (which was deprecated) in favor of action=parse
* Added prop parameter to action=parse so certain parts of the output can be left out
* action=parse&prop=text behaves pretty much exactly like action=render used to
2008-01-15 21:33:08 +00:00
Victor Vasiliev
4cc099d5d1 API: add action=logout 2008-01-08 18:10:58 +00:00
Roan Kattouw
ed0a58e527 Re-adding ApiChangeRights, but commenting out its entries in ApiMain and AutoLoader. This way the module will be inaccessible for clients, but still present in SVN to be viewed and modified. 2008-01-04 22:33:22 +00:00
Brion Vibber
c04db5771d Revert r29261, r29271 for now -- some weird mixing up of functions and seemingly random array structures, and it puts back a restricted API module I'd rather not see there for now. 2008-01-04 17:35:09 +00:00
Roan Kattouw
5395945052 * Unbroke Special:Userrights for wikis without pretty URLs
** This probably shouldn't be hard-coded the way I did it
* UserrightsPage::saveUserGroups() now takes $removegroup and $addgroup parameters by reference. Parameters are changed to reflect what was actually added and removed.
* Re-adding ApiChangeRights module, which now handles permission denied errors more gracefully
2008-01-04 11:50:22 +00:00
Brion Vibber
49e10ba5eb Remove ApiChangeRights. Duplicates code, doesn't handle current permissions model properly. 2008-01-03 23:39:21 +00:00
Roan Kattouw
fd5a884b77 API: A cleaner implementation of r28057: this one also hides disabled modules from the list of possible actions on top of the help screen. 2007-12-03 15:52:27 +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
Roan Kattouw
6e61566e3e Changing error code to prevent confusion with wfReadOnly() == true 2007-12-02 14:44:35 +00:00
Roan Kattouw
730bad3fb1 APIEDIT BRANCH MERGE: Adding apiedit modules: action={block,changerights,delete,move,protect,rollback,unblock,undelete} and list={blocks,deletedrevs}. $wgEnableWriteAPI must be explicitly set to enable these modules. 2007-12-02 14:24:07 +00:00
Victor Vasiliev
32ccdc3d5a * Use *bold* and $italics$ highlighting only in API help. It completely breaks formatting on meta=allmessages and no one needs it 2007-12-01 17:37:08 +00:00
Victor Vasiliev
17cf492e6b * Introduce action=parse to API. It deprecates action=render which will be removed once (perhaps before 1.12 release). New action returns full parser output instead of returning just rendering text 2007-12-01 13:37:02 +00:00
Tim Starling
65b4736e66 Trivial bug in new apihighlimit feature 2007-11-30 14:41:30 +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
96940993bd * (bug 11206) api.php should honor maxlag
* Add wfMaxlagError function
* Add MIME type override option for format=raw
2007-11-18 09:37:52 +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
Brion Vibber
3ca6cf7890 Revert r27151 -- allows session fixation attacks.
Just get a user to visit a URL with the user ID and token you like in the query string (say, in an <img> referenced in a page you convince them to go to or post for their review) and their login session will be replaced with the one you provided.
2007-11-15 04:24:49 +00:00
Roan Kattouw
7d757dff14 API:
* Allow staying logged in through lg* parameters instead of cookies (modified patch by Eddie Roger)
* Removed ApiLogin's sessionID return value, as it doesn't always work and is redundant anyway
2007-11-03 09:57:42 +00:00
Roan Kattouw
54c4fc42d9 API: Also prevent double escaping when outputting an error message in xmlfm 2007-10-30 21:55:34 +00:00
Daniel Cannon
bfcd95c8e5 (bug 11721) API: Use a different title for results than for the help page. 2007-10-24 19:34:29 +00:00
Roan Kattouw
a6e563da20 * (bug 11173) Allow limited wikicode rendering via api.php
* (bug 11572) API should provide interface for expanding templates

Patches by VasilevVV
2007-10-08 14:24:54 +00:00
Daniel Cannon
391b000b8a (bug 11404) API: Provide name of exception caught in error code field of internal api error messages. 2007-09-26 04:28:48 +00:00
Brion Vibber
fef3b7b3c3 Tweaks to r25923 for my own peace of mind:
* De-escape &amp;amp; to &amp; rather than &amp; to & -- guarantees that we won't leave stray &s around producing invalid or freaky output
* Use == instead of = when comparing... :)
2007-09-19 14:44:50 +00:00
Daniel Cannon
697afaae0f (bug 11296) Introduced special case pretty-printer rendering of the help document, whereby ampersands will not be escaped, which seems to be the only cause ATM of broken links in the help. This is a *temporary* fix while we work on getting a fully-html version of the help complete, but one that should not reintroduce any security vulnerabilities (as the only text that is unescaped is hardcoded into the API). 2007-09-18 22:10:09 +00:00
Tim Starling
efe384a900 Allow API modules to be defined in extensions 2007-08-31 15:23:48 +00:00
Brion Vibber
3a7e2083e8 Revert r25297, r25298 for now.
Adds what seems to be a very purpose-specific extension into the core API:
a) shortly before release
b) while apparently not implementing much of its interface
c) with an interface that looks kind of strange to me
2007-08-30 13:47:06 +00:00
Paa Kwesi Imbeah
ecca233f20 Adding InstantCommons includes into ApiMain and AutoLoader's API section 2007-08-29 22:57:41 +00:00
Yuri Astrakhan
c4aad95b10 API: Added meta=userinfo module to get data about the currently logged-in user. 2007-07-31 17:53:37 +00:00
Daniel Cannon
d567a44eae (bug 10602) API: Add two protected accessors to ApiMain allowing extending class to add to or override existing modules and formats. 2007-07-18 05:25:53 +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
8ca133afff API: Big change: Removed all userCanRead() checks per IRC discussion. Only rvprop=content will now check that the page can be read. 2007-07-14 19:04:31 +00:00
Yuri Astrakhan
92ee13b628 API: Per IRC discussion with brion and co, now API only works if the user has the right to read 2007-07-12 06:54:08 +00:00
Yuri Astrakhan
5c89b71be3 API: updated help screen 2007-07-08 08:32:00 +00:00
Yuri Astrakhan
f5aa2e8018 API: implemented prop=imageinfo, minor cleanup 2007-07-07 03:05:09 +00:00
Yuri Astrakhan
4247af6c2d API: Documentation cleanup 2007-07-06 02:19:56 +00:00
Yuri Astrakhan
a31d9c9067 API: Minor cleanup 2007-06-29 22:05:30 +00:00
Roan Kattouw
a0783fbd74 Making non-fm formats return help text when action=help is explicitly
set (bug 10391).
2007-06-29 20:22:33 +00:00
Roan Kattouw
d4ad5a8dbe Reverting r23562: accidentally modified phase3 rather than
branch/apiedit
2007-06-29 20:02:26 +00:00
Roan Kattouw
1a2e663a40 * Separating UI code and DB code in Article::rollback()
* Adding API rollback functionality
2007-06-29 19:55:46 +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
Rob Church
b9af5fcff5 (bug 10392) Include MediaWiki version details in version output [Roan Kattouw] 2007-06-28 12:55:12 +00:00
Yuri Astrakhan
be1bfe4d5a API bug 10046: incorrect action produces invalid response format 2007-05-28 06:59:19 +00:00
Yuri Astrakhan
1152253310 API: Enabled API login throttling (with amidaniel's help)
fixed memcached-client comments
minor queryRevisions fix
2007-05-27 23:50:24 +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
aab4c9d205 API:
* breaking change: Converted a map of revisions into a list of revisions to allow easier json processing (no need to know map keys)
* html formatting now properly links urls ending with a '\n' string (jsonfm)
* regression: fixed allpages to return int instead of string for pageid and ns
* Added: info now returns page length, counter, and a new flag
2007-05-19 20:26:08 +00:00
Yuri Astrakhan
8918d13456 API: disabled login module until it is more secure. added performance comment in HTML output. 2007-05-18 19:46:45 +00:00
Yuri Astrakhan
c8547137fa * API: updated documentation link 2007-05-14 19:09:42 +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
9648f3b4d0 Some small doc tweaks to reduce Doxygen warnings, namely:
* @link. You might think @link would surely mean "here comes a web URL" ... but @link is a valid command 
  in Doxygen, which means an entirely different kind of link (an internal link to somewhere, so that you can separate 
  documentation and implementation). The result is a mess, and the best solution I can see is to use "@see" instead of "@link".
* Warning: argument `nourl' of command @param is not found in the argument list of Linker::makeMediaLinkObj($title,$text='')
* Moving few class descriptions to right above classes, and/or formatting into Javadoc style.
* "@addtogroup Special Pages" --> "@addtogroup SpecialPage" so that all special pages have the same @addtogroup tag.
* @fixme --> @todo (must have missed these before)
* "@param $specialPage @see" remove the "@" in the "@see" to stop warning.
* @throws wants type, then a brief description, to stop warning.

This last one is for PHPdocumentor only, but it fixes something for PHPDocumentor, and should be neutral for Doxygen:
* WARNING in includes/api/ApiFormatYaml_spyc.php on line 860: docblock template never terminated with /**#@-*/
2007-04-18 09:50:10 +00:00
Nick Jenkins
74ea267553 Prevent the following strict-standards warnings - i.e. when running with error_logging(E_ALL | E_STRICT); - which seems to disable the yucky "@" operator, as well as maxing out the pedantry of warnings. Nothing major found, just nice to be as explicit and as forward-compatible as possible.
* Strict Standards: Undefined index: switch in includes/Parser.php on line 3849
* Strict Standards: Undefined index: ref in includes/Parser.php on line 3818
* Strict Standards: Non-static method OutputPage::setEncodings() should not be called statically in index.php on line 11
* Strict Standards: Only variables should be assigned by reference in includes/Skin.php on line 888
* Strict Standards: Non-static method Title::newFromURL() should not be called statically in includes/SpecialContributions.php on line 178
* Strict Standards: Only variables should be assigned by reference in includes/GlobalFunctions.php on line 2054
* Strict Standards: Undefined index:  contributions-summary in languages/Language.php on line 764
* Strict Standards: Undefined index:  trackbackhtml in skins/MonoBook.php on line 86
* Strict Standards: Undefined index:  blockip in skins/MonoBook.php on line 204
* Strict Standards: Undefined index:  tagline in skins/MonoBook.php on line 261
* Strict Standards: Undefined index: uselang in includes/SkinTemplate.php on line 1159
* Strict Standards: Non-static method CoreParserFunctions::plural() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Undefined offset:  0 in includes/SkinTemplate.php on line 196
* Strict Standards: Undefined index:  USE INDEX in includes/Database.php on line 1015
* Strict Standards: Undefined index:  image_tests in includes/Parser.php on line 3488
* Strict Standards: Undefined offset:  0 in includes/Parser.php on line 3507
* Strict Standards: Non-static method ChangesList::newFromUser() should not be called statically in includes/SpecialWatchlist.php on line 361
* Strict Standards: Non-static method RecentChange::newFromCurRow() should not be called statically in includes/SpecialWatchlist.php on line 367
* Strict Standards: is_a(): Deprecated. Please use the instanceof operator in includes/Exception.php on line 168
* Strict Standards: Non-static method LogPage::logName() should not be called statically in includes/SpecialContributions.php on line 325
* Strict Standards: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush. in maintenance/commandLine.inc on line 191
* Strict Standards: Undefined index:  meatball in languages/Language.php on line 234
* Strict Standards: rmdir(/tmp/mwParser-2108164586-images/thumb): Directory not empty in maintenance/parserTests.inc on line 605
* Cleaning out some new temp files left over by parserTests (there were one or two straggler dirs/files that would persist after the test run ended, due to new tests being added over time)
* Strict Standards: Non-static method CoreParserFunctions::special() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Declaration of ListUsersPage::preprocessResults() should be compatible with that of QueryPage::preprocessResults() in includes/SpecialListusers.php on line 38
* Strict Standards: Only variables should be passed by reference in includes/SpecialBlockip.php on line 175
* Strict Standards: Skin::include_once(skins/Standard.deps.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in includes/Skin.php on line 121
* Strict Standards: Declaration of ApiMain::getResult() should be compatible with that of ApiBase::getResult() in includes/api/ApiMain.php on line 35
* Strict Standards: is_a(): Deprecated. Please use the instanceof operator in includes/WikiError.php on line 63
* Strict Standards: Non-static method WikiError::isError() should not be called statically in includes/SpecialImport.php on line 64
* Strict Standards: Non-static method ImportStreamSource::newFromInterwiki() should not be called statically in includes/SpecialImport.php on line 58<b
* Strict Standards: Only variables should be assigned by reference in includes/SpecialUndelete.php on line 501
* Strict Standards: Non-static method Image::newFromName() should not be called statically in thumb.php on line 56
* Strict Standards: Non-static method CoreParserFunctions::numberoffiles() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Non-static method CoreParserFunctions::statisticsFunction() should not be called statically in includes/CoreParserFunctions.php on line 139
* Strict Standards: Non-static method CoreParserFunctions::isRaw() should not be called statically in includes/CoreParserFunctions.php on line 128
* Strict Standards: Non-static method CoreParserFunctions::grammar() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Undefined offset:  1 in includes/SpecialMIMEsearch.php on line 130
* Strict Standards: Undefined index:  recentchangeslinked in skins/MonoBook.php on line 184
* Strict Standards: Declaration of DumpNotalkFilter::pass() should be compatible with that of DumpFilter::pass() in includes/Export.php on line 612
* Strict Standards: Declaration of DumpNamespaceFilter::pass() should be compatible with that of DumpFilter::pass() in includes/Export.php on line 665
* Strict Standards: Non-static method ImportStreamSource::newFromUpload() should not be called statically in includes/SpecialImport.php on line 46
* Strict Standards: Undefined offset:  5 in includes/Sanitizer.php on line 396
* Strict Standards: Undefined index:  wikidbUserName in includes/SpecialUserlogin.php on line 562
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryBase.php on line 95
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryBase.php on line 116
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryWatchlist.php on line 128
* Strict Standards: Undefined property:  stdClass::$rc_id in includes/api/ApiQueryBase.php on line 131
* Strict Standards: Undefined property:  stdClass::$rc_last_oldid in includes/api/ApiQueryBase.php on line 164
* Strict Standards: Undefined property:  stdClass::$rc_moved_to_ns in includes/api/ApiQueryBase.php on line 285
* Strict Standards: Undefined property:  stdClass::$rc_patrolled in includes/api/ApiQueryBase.php on line 176
* Strict Standards: Undefined index:  comment in includes/api/ApiFeedWatchlist.php on line 85
* Strict Standards: Undefined offset:  0 in includes/Skin.php on line 302
* Strict Standards: Non-static method User::SetupSession() should not be called statically in includes/SpecialUserlogin.php on line 15

... There are certain to be other things too, so this is not intended to be comprehensive, rather the above just stops most of the notifications I observed.
2006-11-29 05:45:03 +00:00
Tim Starling
b1cd1b035c Fixed inefficient use of array_keys() introduced by Nick in r17880. If this is setting off alarms, then fix the alarms. 2006-11-25 17:11:58 +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
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
3ec1b5b646 API * simple backlinks module (no redirect resolution yet)
* Cleaned up references
2006-10-25 03:54:56 +00:00
Yuri Astrakhan
eb02c1a87b API * cache expiration control
* Added PHP-serialized & WDDX formats
2006-10-22 23:45:20 +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