Commit graph

74 commits

Author SHA1 Message Date
Siebrand Mazeland
8e23949bee Proper casing for getDBkey() 2009-05-24 08:29:10 +00:00
Roan Kattouw
3f3bfb576d API: Fix E_NOTICE which broke displaying of legacy restrictions (page.page_restrictions) in prop=info 2009-03-17 15:18:26 +00:00
Roan Kattouw
88f35cdf6e API: Some cleanup
* Aggressively intval() numeric things; addresses the concerns raised on bug 11633
* Use ApiQueryBase::addTitleInfo() everywhere
* Remove a drug-induced-looking line from ApiQueryWatchlist.php
2009-02-27 16:03:01 +00:00
Roan Kattouw
c9c570e4a7 * API: Page prop=info by (ns, title) rather than offset
* Also fix a regression from r47214 which caused database errors when $this->titles or $this->missing was empty
2009-02-13 15:36:32 +00:00
Roan Kattouw
1ff24603a9 API: Fix up r47214, which strangely had no commit message
* Use + instead of array_merge(), the latter messes up keys
* Fix a fatal error ($result not an object)
* Fix an interesting mistake when calling addTables(): addTables('foo', 'bar') doesn't add both tables, but adds foo AS bar
* Fix warning about $row->pt_namespace not being set

Commit message for r47214:
API: Refactor ApiQueryInfo
* Move result generating code from execute() to extractPageInfo()
** Merge code for existing and missing titles
* Don't loop over existing and missing titles separately, but on both in one go
* Move protection query code from execute() to getProtectionInfo()
** Merge code for existing and missing titles here as well
* Move subjectid/talkid query code from execute() to getTSIDs()
* Document some functions
2009-02-13 15:14:21 +00:00
Roan Kattouw
c426593d8a 2009-02-13 14:44:19 +00:00
Roan Kattouw
6f1f506675 API: Prevent ApiQueryInfo from trying to set a continue value twice (which will fail with a fatal error) 2009-02-12 17:29:17 +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
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
2b6314c9c4 (bug 17327) Normalize API help texts: remove quotes 2009-02-02 23:17:07 +00:00
Roan Kattouw
c0cd843e63 API: (bug 16629) "edit=:move=" in page.page_restrictions was interpreted incorrectly. Also moved up the code checking for legacy protections to right after the code checking for 'new' protections. 2009-01-12 14:27:28 +00:00
Ilmari Karonen
34fb6297cd Step 2 in NS_IMAGE -> NS_FILE transition (bug 44) (WARNING: huge commit).
This is a global search and replace of NS_IMAGE and NS_IMAGE_TALK with NS_FILE and NS_FILE_TALK respectively in all core files, excluding those already updated in step 1 (r44004).
2008-12-01 17:14:30 +00:00
Siebrand Mazeland
c426e6b9d7 Consistent casing for wfGetDB(), getDB(), and getDBKey() 2008-11-06 22:38:42 +00:00
Roan Kattouw
969761e440 API: Also throw a warning when tokens for missing pages are denied 2008-10-27 12:16:47 +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
5896f16a44 (bug 15647) API edit with basetimestamp fails if the page has been deleted and undeleted since the last edit 2008-10-04 13:43:17 +00:00
Roan Kattouw
eea6c59c96 Kill undefined variable warnings. 2008-09-27 11:26:34 +00:00
Roan Kattouw
7dc62e75ed (bug 15609) Add inprop=url (full URL to page and edit form) and inprop=readable (whether the current user can read the page) to prop=info 2008-09-25 15:55:09 +00:00
Roan Kattouw
3256fbb3bf (bug 15535) prop=info&inprop=protection doesn't list pre-1.10 protections if the page is also protected otherwise (1.10+ style or cascading) 2008-09-09 20:42:19 +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
Brion Vibber
38831a4ba0 Fix for PHP < 5.2.3
'Foo::bar' is not a valid callback on earlier versions of PHP;
must specify as array( 'Foo', 'bar' )
2008-07-06 18:43:06 +00:00
Roan Kattouw
07db2080a5 Fix regression from r37046: tokens should not be supplied when in JSON callback mode. Also remove ApiQueryBase::getTokenFlag() which is now obsolete. 2008-07-05 11:18:50 +00:00
Roan Kattouw
0104fa1f0c Rewritten the way the API handles tokens:
* Instead of hardcoding stuff all over the place, use callbacks
* Extensions can now add their own tokens to prop=info or prop=revisions using hooks
2008-07-04 12:07:02 +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
Bryan Tong Minh
ff5b276836 API: Expose cascading protection via inprop=protection for non-existent pages. 2008-05-05 09:37:14 +00:00
Bryan Tong Minh
91b5617042 Avoid code duplication 2008-05-04 16:24:05 +00:00
Bryan Tong Minh
909203b366 (bug 13945) API: Retrieve cascading protection sources via inprop=protection 2008-05-04 15:10:58 +00:00
Brion Vibber
2368dd5bf1 * (bug 13768) pt_title field encoding fixed
pt_title field in page_protections was added without a binary marker when used on non-binary schema.
This means you get false matches for ASCII case-insensitive bits, and probably for horribly wrong UTF-8 mish-mashes as well.

Adds an updated to fix the field's encoding to binary, matching all our other title keys,
so you can join and get correct matches.

Revert r33473, which seems to assume that pt_title is supposed to be case-insensitive.
(Even if it was, it woudln't work correctly as written.)
2008-04-17 19:11:36 +00:00
Roan Kattouw
3c8ac10988 (bug 13768) Handling case-insensitivity of pt_title in prop=info 2008-04-17 12:58:20 +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
6e0e8097c8 Oops 2008-03-27 13:55:16 +00:00
Roan Kattouw
b25035bed8 Fixing E_NOTICE 2008-03-27 13:54:43 +00:00
Roan Kattouw
0aeb9c5c7b Correcting slight mistake in r32413 2008-03-25 15:36:05 +00:00
Roan Kattouw
c60c6a37d0 API: Adding inprop=talkid,subjectid to prop=info 2008-03-25 15:31:24 +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
03e6a69433 API: Adding cascade flag to prop=info&inprop=protection 2008-01-15 15:23:27 +00:00
Huji
db7d75fba7 (bug 12608) (in continuation of r29719) Unifying the spelling of getDBkey() in the code. 2008-01-14 09:26:36 +00:00
Roan Kattouw
f023999c32 Improving r29456:
* The XML formatting bug is obscure and not trivial to fix, working around it is easier
* Added missing braces
2008-01-08 22:05:39 +00:00
Roan Kattouw
1aaec79b58 API: Temporary fix for broken XML rendering; XML formatter apparently doesn't like array(null). Will attempt to fix the real issue later 2008-01-08 21:42:00 +00:00
Roan Kattouw
0ffd093ea9 Returning protections more consistently 2008-01-08 16:42:18 +00:00
Roan Kattouw
7523ddffb4 * (bug 12543) API should support new protected titles system
* Changing ApiProtect to return ISO 8601 timestamps
* This doesn't really need a RELEASE-NOTES entry, as the protected titles system is already mentioned in RELEASE-NOTES
2008-01-08 16:31:50 +00:00
Roan Kattouw
5d8f2177c5 API:
* Add list=allcategories module
* Fix token-related E_NOTICEs
2007-12-10 15:55:12 +00:00
Victor Vasiliev
0495f90ebb Revert r28215: incorrectly moved files 2007-12-06 18:33:18 +00:00
Victor Vasiliev
4e4cdf079e Create includes/api/query for Query API and includes/api/edit for Edit API 2007-12-06 18:22:15 +00:00
Rotem Liss
27f805f86c Make API check for page restrictions in the old format too. 2007-11-27 10:22:14 +00:00
Roan Kattouw
0dc5e7b169 API: Really fixing bug 10898 this time 2007-09-06 11:28:04 +00:00
Roan Kattouw
90a3fb90e9 (bug 10898) API does not return an edit token for non-existent pages 2007-09-03 20:17:53 +00:00
Yuri Astrakhan
9bf28ce7c9 API: Added various edit tokens to prop=info (except rollback - will be added to revisions) 2007-08-01 22:46:22 +00:00
Roan Kattouw
7dc483c1ed API: Fixing a bug that caused inprop=protection to scream when no
existent titles were specified
2007-07-02 11:52:14 +00:00