Commit graph

60 commits

Author SHA1 Message Date
Brad Jorsch
f62bc7536e API: Fix access on getExamplesMessages
ApiBase declares it protected, but for some reason I had made it public
in all subclasses.

Change-Id: I8a50d4f47e66c7f09137968d3941dc5cdc1d28e4
2014-10-29 11:15:27 -04:00
Brad Jorsch
ad225f501c API: Internationalize all remaining core API modules
This also adds some new ApiBase::PARAM_* constants to generate more
helpful help, and a method to override the default description message
for the use of ApiDisabled and ApiQueryDisabled.

Bug: 71638
Change-Id: Ic0c3d232e0498d58a043037e2e0c6f0b1c3edad3
2014-10-20 16:56:35 -04:00
Reedy
e48ecbc524 Switch API to use Config classes
Only done where globals are config (so not $wgParser, $wgContLang etc)

Change-Id: Ic39cdd858cfb9096a2bc09618f97e64270d76f13
2014-06-15 23:56:38 +01:00
Max Semenik
af6d9aba6d New API module, list=prefixsearch
It's pretty much like action=opensearch but can be used as a generator
which can be handy when you need to retrieve both the list of pages and
some information about them.

Change-Id: Iaffe30a0f7402e1316c4885a805692a34bbe1a6a
2014-04-02 19:14:07 +04:00
addshore
719d7a2f03 Add final period to API module descriptions
Change-Id: Icae68c1ab1fd0006e00a3a9a56ae8f831d3d0d45
2014-03-10 09:04:08 +00:00
Alex Ivanov
3615dbda36 API: Add default setting for OpenSearch limit parameter
This is done as part of a GCI 2013 task.

Bug: 30089
Change-Id: I4c1a850520976a5b8b433feee4807c5f6960e3ac
2013-11-19 19:55:04 +01:00
Siebrand Mazeland
c6630e8bbe Update formatting on API classes, Part 3
Change-Id: I526be68e21836201c992b391a81f4d41e1fa801e
2013-11-14 18:12:29 +00:00
Timo Tijhof
0509c1ed0e OpenSearch: Error for unsupported formats and adding format=jsonfm
Previously it would just completely ignore the format parameter.
Making it always serve JSON no matter the value of the format
parameter.

Now it properly errors when doing (for example) format=txt or format=xml.

Also adding support for jsonfm.

Change-Id: Ia98f54f41f39006312fb49ecd718f0f161f27c37
2013-03-28 21:05:10 +01:00
Antoine Musso
b2fba3f27f api: remove duplicate __contruct calls
For historical reasons, all our API class had a dummy __construct which
simply calls their parent constructor.  This patch removes all such
occurences to save out some bytes.

Change-Id: I667955d7821f780fc5ce23823d74dedb1729b9fa
2013-01-29 09:38:17 +01:00
Yuri Astrakhan
503cd2f4ae (bug 35885) remove api version string and parameter
API was using SVN's version keyword which GIT does not support.
All related methods were either removed, or for those that
could have been used from extensions, emptied out.
api.php?version now shows unrecognized param warning.

Change-Id: I910ca1448ed2ed697ac19b17c486d130aa1d7e03
2013-01-18 12:41:18 -05:00
Timo Tijhof
1f987fb5ee (bug 40448) Replace legacy mwsuggest with mediawiki.searchSuggest
The module has been broken for a while now, but nobody noticed
because in plain core it is disabled by default, and in the
bundle we ship with Extension:Vector (and its SimpleSearch).

This commit removed the mediawiki.legacy.mwsuggest module (and
related components that become obsolete with its deletion) and
replaces it with the new mediawiki.searchSuggest module, which is
based on SimpleSearch from Extension:Vector (where it will be
removed soon).

The following and all references to it in core have been removed,
I also made sure that they weren't used in any of extensions/*.
Only matches in extensions/Settings and some file that dumped the startup module, and in extensions/Vector which are addressed in
I1d5bf81a8a0266c51c99d41eefacc0f4b3ae4b76.

Had to make a few updates to jquery.suggestions to make it work
in other skins. So far it was only used in Vector, but now that
it is used in mediawiki.searchSuggest, I noticed several issues
in other skins. Most importantly the fact that it assumed the
default offset was from the right corner, which isn't the case in
Monobook where the search bar is on the left (in the sidebar).

It now detects the appropiate origin corner automatically, and
also takes directionality of the page into account.

It also uses the correct font-size automatically. Previously it
used font-size: 0.8; but that only works in Vector. Every skin
seems to have its own way of making a sane font-size. In Monobook
the <body> has an extra small font-size which is then fixed in
div#globalWrapper, and in Vector it is extra large, which is then
fixed as well deeper in the document. Either way, the size on
<body> can't be used, and since this suggestions box is appended
to the <body> (it is a generic jQuery plugin without knowledge of
the document, and even if we could give it knowledge inside
the configuration, it'd have to be per-skin). So I removed the
Vector specific font-size and let it handle it automatically.
This was needed because it is now used in all skins.

Removed modules:
* mediawiki.legacy.mwsuggest:
  > Replaced with mediawiki.searchSuggest.

Removed messages:
* search-mwsuggest-enabled
* search-mwsuggest-disabled
  > No longer used.

Removed mw.config.values:
* wgMWSuggestTemplate
  > Obsolete.

* wgSearchNamespaces
  > Obsolete.

Removed server-side settings:
* $wgEnableMWSuggest
  > Suggestions are now enabled by default and can be disabled
    through the user preference `disablesuggest` still.
    They can be disabled by default site-wide or hidden from
    prefs through the standard mechanisms for that.

* $wgMWSuggestTemplate
  > Obsolete.

Removed methods
* SearchEngine::getMWSuggestTemplate()
  > Obsolete.

Filters:
 $ ack mwsuggest -i -Q --ignore-dir=languages/messages
 $ ack wgSearchNamespaces -Q

Message changes:
* vector-simplesearch-preference
  > It was wrong, it didn't activate search suggestions, that
    was handled by the Vector extension. This preference in
    MediaWiki core controls whether the SimpleSearch bar HTML
    and CSS will be used (e.g. the rectangle search box with
    the magnifying class instead of the browser-default input
    field with the plain submit buttons).

* searchsuggest-search
* searchsuggest-containing
  These come from Extension:Vector message and should be imported
  by translatewiki:
  - vector-simplesearch-search
  - vector-simplesearch-containing

Change-Id: Icd721011b40bb8d2c20aefa8b359a3e45413a07f
2012-10-02 04:51:51 +02:00
Antoine Musso
4f5d2386f3 escape HTML elements in docblock with double quotes
Doxygen choke on text enclosed by '<' and '>' since it tries to
interpret them as HTML or XML elements. This patch adds double quotes
in includes/api/*.php files around the two following strings:

 <Firstname>.<Lastname>@gmail.com
 <Firstname><Lastname>@gmail.com

Which becomes:

 "<Firstname>.<Lastname>@gmail.com"
 "<Firstname><Lastname>@gmail.com"

Tested locally, it prevents doxygen 1.8.0 related warnings.

Change-Id: I36d82eb3fd4989ee3ffc65b0b527b83711d1ba69
2012-07-15 22:15:45 +02:00
Sam Reed
53000baecf Oh noes, moar http:// -> https:// 2011-11-28 15:43:11 +00:00
John Du Hart
2e7d867478 Removed the 'eclipse helper' bit on top of every API module
It's a parctice that dates back to 2006 when the API was first written, and frankly isn't covered by the coding conventions. Same thing with the docblocks, they're all copypasted with some bits changed and don't even make sense if you look at them in the genereated code docs.
I don't feel that any of us depend on this anymore (get a better IDE), so in the inerest of consistancy it's time we said goodbye to it.
2011-11-16 00:17:26 +00:00
Sam Reed
a5628f5734 Based on diff to wikia, set more functions consistently public rather than protected 2011-08-17 22:24:21 +00:00
Max Semenik
896c93f337 ApiOpenSearch: make description a verb, just like the other modules 2011-08-14 09:19:54 +00:00
Sam Reed
d5e46f9614 Followup r92396
More modules documented, pretty much only action=query&list= to be done (ie links added where documentation pages exist already)
2011-07-17 16:51:11 +00:00
Sam Reed
6e84e9ccd9 Followup r92396, add help urls for most of the core (non query) modules 2011-07-17 16:38:24 +00:00
Max Semenik
220279a352 Rm all mentions of "this module" in API action descriptions. They are supposed to be read by API users, not MW coders, thus internal terminology shouldn't be used here. 2011-04-25 14:05:57 +00:00
Sam Reed
7ea350c3eb Minor followup to r79649. Rename variables 2011-01-06 00:31:23 +00:00
Philip Tzou
52bb88d41e Follow r79649 and r79650. Errrr, remove the redundant minus 2011-01-05 16:37:36 +00:00
Philip Tzou
6fe99a3e4c follow r79649, move the in-block assignment outside. 2011-01-05 16:30:10 +00:00
Philip Tzou
233fb62e22 Add fallback languages support for ApiOpenSearch. 2011-01-05 16:21:01 +00:00
Sam Reed
6309c920dd Delete all the "API for MediaWiki 1.8+" comments
Add since to ApiQueryQueryPage
2010-12-22 20:52:06 +00:00
Alexandre Emsenhuber
457eb73b61 Standardised file description headers, added @file 2010-08-07 19:59:42 +00:00
Tim Starling
b2dc451c82 Rewrote r69339 etc. to clean up API cache header handling.
* Introduced a "cache mode" concept to simplify the header generation code, and to avoid odd results when conflicting cache header requests are received from submodules, or at least to formalise the handling of such cases.
* Made the cache mode private by default, so that code written in ignorance of caching tends to be safe. If different query modules are used in a single request, private caching is preferred over public caching.
* Removed the "must-revalidate" option from all CC headers, this is really specific to page views with a hacked squid in front, I don't think it's applicable here.
* Made the watchlist module private. This is really the definition of private data. There's nothing in the HTTP spec that says the URL for a CC:public request is private and can't be leaked. CC:private provides protection against unknown proxy behaviour.
* In ApiQueryAllmessages: avoid calling $wgLang->getCode() to check if it's necessary to make a new $wgLang when lang= is specified, since this is the only thing that unstubs $wgUser.
* Removed "FIXME: should this check $user instead of $wgUser?" Answer is no.
2010-07-23 07:17:56 +00:00
Derk-Jan Hartman
921619b119 Correct the address of the FSF in some of the GPL headers
59 Temple Place -> 51 Franklin Street
2010-06-21 13:13:32 +00:00
Jack Phoenix
c286869e38 API: fix copyright symbol, coding style cleanup, more braces 2010-02-23 18:05:46 +00:00
Roan Kattouw
f02557a424 API: Redo r62540 for all modules, easier than I first imagined 2010-02-15 20:42:43 +00:00
Roan Kattouw
e99771b884 API: Optimize read rights check in opensearch so $wgUser doesn't get unstubbed if $wgGroupPermissions['*']['read'] is true 2010-02-15 20:20:00 +00:00
Tim Starling
278a489ffe Search suggestion API requests make up a substantial portion of our total apache load and thus deserve some optimisation:
* Made the cache expiry time configurable via $wgSearchSuggestCacheExpiry
* Removed must-revalidate from the Cache-Control of such requests. Introduced a generic interface to ApiMain for doing that.
2010-02-14 23:52:45 +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
Alexandre Emsenhuber
e8f9ef9409 Fix for r57986: Notice: Undefined variable: wgEnableOpenSearchSuggest in includes/api/ApiOpenSearch.php on line 53 2009-10-21 21:22:00 +00:00
Roan Kattouw
99748cf05c Split allowing &suggest requests in API opensearch from $wgEnableMWSuggest to a separate variable. This makes it possible to enable SimpleSearch (which uses API opensearch) but disable mwsuggest; enabling both seems to cause issues with the login form in Safari or Opera (don't remember which) 2009-10-21 18:44:58 +00:00
Roan Kattouw
990714436e API: When returning an emtpy opensearch result because mwsuggest is disabled, return a valid opensearch response. 2009-09-10 13:07:36 +00:00
Roan Kattouw
f0c3eaf444 API: Fix up r47142: use a boolean parameter for suggest 2009-02-12 17:27:05 +00:00
Aaron Schulz
0b28c717b2 Add suggest=1 to search suggestion AJAX request. ApiOpenSearch won't execute such request if $wgEnableMWSuggest is disabled 2009-02-11 15:56:53 +00:00
Brion Vibber
79d0c8e34b Pulling back r46341 and r46342 for now "API: (bug 17142) Add redirects parameter to action=opensearch to control redirect resolution. Changes to OpenSearchXML extension in next commit"
Mysteriously there's no way to get a boolean parameter to default to true, which leads to an incompatibility in the sensible behavior of the more detailed responses in the XML output -- eg you get a whole buttload of "#REDIRECT Blabla" in your results, which is absolutely hideous. This is very much not desireable. :)
If we could change the default, and allow it to be set on or off for specific requests if some person for some reason is doing highly customized suggestion searches and wants it configured differently (no idea why), that might be doable. But as written this doesn't make any sense.
2009-01-27 20:39:24 +00:00
Roan Kattouw
41cc3f6271 API: (bug 17142) Add redirects parameter to action=opensearch to control redirect resolution. Changes to OpenSearchXML extension in next commit 2009-01-27 14:43:06 +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
Robert Stojnić
d6fd8e7c13 Ajax suggestions:
* check in a new ajax suggestion engine (mwsuggest.js) which uses 
  OpenSearch to fetch results (by default via API), this should
  deprecated the old ajaxsearch thingy
* extend PrefixSearchBackend hook to accept multiple namespaces for
  future lucene use (default implementation however can still 
  process only one)
* Added to preferences, also a feature to turn it on/off for every 
  input (disabled atm until I work out browser issues completely)
* WMF wikis probably won't be using API to fetch results, but a 
  custom php wrapper that just forwards the request to appropriate
  lucene daemon, added support for that

SpecialSearch:
* moved stuff out of SpecialSearch to SearchEngine, like snippet
  highlighting and such
* support for additional interwiki results, e.g. title matches
  from other projects shown in a separate box on the right
* todo: interwiki box doesn't have standard prev/next links to 
  avoid clutter and unintuitive interface
* support for related articles
2008-04-15 23:06:28 +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
Brion Vibber
7a3227596e * Merged backends for OpenSearch suggestions and AJAX search.
Both now accept namespace prefixes, handle 'Media:' and 'Special:' pages,
  and reject interwiki prefixes. PrefixSearch class centralizes this code,
  and the backend part can be overridden by the PrefixSearchBackend hook.
2008-01-30 01:07:49 +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
e1f0ca77b3 Using ApiBase's parameter framework handle ApiOpenSearch's limit parameter. 2007-12-29 21:43:30 +00:00
Brion Vibber
21e46f5f3a Add an optional limit parameter (range 1 to 100) to the OpenSearch suggestion interface.
Will be using this in adaptor to the Apple Dictionary widget's search, since we're having performance problems with the special-purpose search backend.
2007-12-29 00:14:22 +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
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
cb38c11c84 API: documentation and cleanup. 2007-05-20 23:31:44 +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