Extension:Cargo/Other features

"Purge cache" tab
MediaWiki does extensive caching of its pages, for performance reasons. This can impact pages that display Cargo queries, in that data that has recently been added or changed will often not show up yet in other pages that query it. MediaWiki lets you purge the cache of any page by going to the URL "action=purge" for that page, after which you should see the correct, most recent data in any queries on that page. However, MediaWiki does not offer any convenient way to get to that URL. For that purpose, Cargo defines a tab/dropdown action, "Purge cache". It is viewable only to those users who have the "purge" permission, which normally is all users in the "sysop" group. (In truth, all users can purge a page's cache, though non-admins need to confirm by hitting "OK" before the purge happens; thus the "purge" permission might be better named "one-step purge".)

The "Purge cache" tab is equivalent to the "Refresh" tab from Semantic MediaWiki; in fact, if SMW is already installed, the "Purge cache" tab will not show up at all, since it is redundant.

Displaying maps
Within templates that hold coordinates, it is usually not very helpful to simply display those coordinates; the vast majority of people will have no knowledge of where in the world a certain set of coordinates is. Rather, it is much preferable to display a map. For that, Cargo defines the parser function. It takes in coordinates, as well as a few optional parameters, and displays a map for that one point.

The parameters for  are:
 * - takes in a set of coordinates (mandatory).
 * - the mapping service used; can be  (for Google Maps),   (for Leaflet) or   (for OpenLayers). OpenLayers is the default service.
 * - sets the zoom level. For both Google Maps and OpenLayers, the zoom level is an integer number between 1 and around 20, with higher numbers being more zoomed in. The default value for this parameter is 16 for both mapping services.
 * - sets the height of the map; the default value is 400px.
 * - sets the width of the map; the default value is 700px.
 * (for the  service only) - sets an image to be the background for the map display, instead of a standard geographical map; specified image must be one that has been uploaded to the wiki.

If you are using Google Maps, you may need to get an API key for it to work - once you get an API key, you should set it in LocalSettings.php via the "$wgCargoGoogleMapsKey" variable.

The standard usage of  is within a template, where   takes in a template parameter. However, it can be used to display hardcoded maps as well.

Lua support
You can call Cargo queries from within Lua modules defined by the Scribunto extension. To do that, just place something like the following code in a module:

Unfortunately, there are not yet Cargo-native methods equivalent to,   or  , as there is for. If you want to call any of the others from Lua, your best option is to use the frame:callParserFunction method.

API
Cargo defines a number of API actions, some for internal use (to be called via Ajax), and some for use by outside scripts:
 * - finds matches for a Cargo query plus a substring, for use within Special:Drilldown
 * - returns all the fields in a specified table
 * - returns all the parameters for a specified format
 * - calls the specified Cargo query, generally for use by JavaScript-based display formats
 * - returns a list of table or field names matching a substing, for use within Special:CargoQuery
 * - recreates a specified Cargo table, for use from various pages
 * - recreates a "special" Cargo table such as _pageData
 * - recreates all the tables associated with the specified template
 * - returns all the tables defined in the wiki