Extension:Cargo/Common problems


 * An error message that looks like "A database query error has occurred. This may indicate a bug in the software" shows up on pages with Cargo templates if one has not run ' ' after installing the Cargo extension. If that's not the cause, you may want to add the following to LocalSettings.php, so that the page displays a more helpful error message:


 * Similarly, if you see an error message like "Fatal exception of type MWException", add the following to LocalSettings.php for a more helpful error message:


 * Cargo makes use of the MediaWiki API, so make sure that you do not have the API disabled; if you have $wgEnableAPI set to false in LocalSettings.php, you should remove that line.


 * If the "where" clause contains something like, the query will break for pages that contain a single quote/apostrophe (') in their name. There are a few potential fixes for this: the easiest is to change the query to  , which should always work. Another option is to change it to  . (You could also consider replacing the single quotes around &#123;&#123;PAGENAME&#125;&#125; with double quotes, but single quotes are generally preferred for SQL literals, plus this formulation will itself break if the page name contains double quotes.)


 * By default, '=' comparisons in MySQL are case-insensitive. If you want an '=' comparison within the "where" clause to be case-sensitive, you can do it by adding "BINARY" to the comparison, like "BINARY Nickname = 'Joe'". You can do the same thing for "HOLDS" statements, like "BINARY Genre HOLDS 'Drama'". Unicode characters are not respected either and will also require "BINARY" lookups, though this behavior is inconsistent across languages.


 * Unlike Semantic MediaWiki, Cargo does not provide a "class" parameter for any of its formats. However, you can still define custom formatting for a display, by wrapping a #cargo_query call inside a "div" or "span" tag that has its own class declaration, like . Then the CSS you use can contain calls like "div.black table ...", or whatever it is.


 * If you have the Joomla! CMS running on the same server as MediaWiki, it may lead to the Cargo "recreate data" action failing. That is because one of Joomla's recommended htaccess settings blocks the string "template" in the URL, and Cargo uses this word as a parameter in its API call. To get Cargo working, you will probably have to modify or remove this line.


 * If you want to show a row number for each row in the query results, do the following:
 * Create a template called  with contents
 * Create templates called  and   with contents   and   respectively
 * Add the field  to your query


 * If you have Cargo tables with many columns, and trying to save a page's data leads to an error message like "1118 Row size too large", it may make sense to change the database row format of your Cargo tables. You can do this using the $wgCargoDBRowFormat global variable. Just add a line like the following to LocalSettings.php, under the inclusion of Cargo:


 * You will then have to recreate the relevant Cargo table(s).


 * If you want to prevent VisualEditor from mangling your #cargo_query statements, place the first clause ("tables=") on the same line as "#cargo_query:". Or, better yet, wrap the queries in a template.