Extension talk:Data

From mediawiki.org
The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).


What indexing should be used on the data_extension table. John Stanton 19:47, 4 November 2006 (UTC)Reply[reply]

I think at least item and key columns should be indexed. Nikola 02:28, 16 November 2006 (UTC)Reply[reply]


It seems that the following is needed to avoid PHP warnings:

$wgHooks['LanguageGetMagic'][] = 'wfDataLanguageGetMagic';

function wfDataLanguageGetMagic( &$magicWords, $langCode ) {
    switch ( $langCode ) {
            $magicWords['data']          = array( 0, 'data' );
            $magicWords['sort']          = array( 0, 'sort' );
    return true;

Patrick 11:36, 5 February 2007 (UTC)Reply[reply]

Added default handling[edit]


I just want to inform you that I have added the handling of defaults to the get function, so that one can use constructs like


which will output "default" if key is not set. I have made it such, that it looks like parameter references in templates


I noticed that I needed this functionality pretty often, and that it can replace the somewhat lengthy


If you want to include this functionality into the extension, just go ahead. Here is the modified "get" function:

function get(&$parser,$desc="",$default="") {
     return $item;
#echo "$lang|$item|$key";
  $res=mysql_query("SELECT `value` FROM data_extension WHERE `item`='".
                   "' AND `key`='".
  if ($r=="") $r=$default;
  return array($r,"noparse"=>TRUE);

Cheers -- 16:27, 6 November 2007 (UTC) (de:Benutzer:olenz)Reply[reply]

PHP failing[edit]

Just downloaded the code from the 3 Feb update. I get the following error (twice) when I load any wiki page

Warning: array_slice() [function.array-slice]: The first argument should be an array in /var/www/wikijfh/languages/Language.php on line 1153

Noted that an extra piece of code (function wfDataLanguageGetMagic) is recommended and included in the latest version, except for the line

$wgHooks['LanguageGetMagic'][] = 'wfDataLanguageGetMagic';

I get the error with and without this extra line. I have created the required table in wikidb. My LocalSettings includes the following lines


Ideas ???

The line is there, fourth line of code in wfDataExtension() function. But something weird is going on. Try moving data extension to the top of your list of extensions (including it before any other extension), see if that works. Alternarively, you could add a @ at the beginning of the line 1153 in languages/Language.php . Nikola Smolenski 09:32, 9 February 2008 (UTC)Reply[reply]

Comparison of Dynamic Pagelist x Semantic Mediawiki[edit]

Do you think, Extension:Data should also be listed in this comparison: Comparison of Dynamic Pagelist x Semantic Mediawiki?

If "yes" just add it there. --Jannis 13:49, 29 December 2009 (UTC)Reply[reply]

Discussion of Potential Applications of Data Extension[edit]

I was recently researching the potential of a WikiData project, but it seems lost and forgotton and that this might be the best avenue for its completion. Is this the case?

Current Understandings[edit]

My current understanding is that this extension allows you to search for data left as parser functions within Wikipedia pages. It could be extended into a wikipedia project should there be enough support. It currently uses only text values.

Current Confusions[edit]

How can it be used now? (I don't know how to put the php into use...)

Questions on the Potential applications[edit]

Permaculture Database application[edit]

Could this be used for an implimentation of a Permaculture Design database in which aspects of permaculture design could be parsed onto wikipedia page (actually better yet wikiSpecies pages) and then searched for and retrieved to find data such as which plants are suitable nitrogen fixers for which climates or forest layers, or the amount of biomass produced by such an animal. The questions associated with this application are:

  1. Could this be used in conjuction with the existing wikispecies database as invisible parsers which do not interfere with the viewing of wikispecies but piggyback their database offering varous information?
  2. What might a wikiDB project look like? For instance, might a Permaculture wikiDB page be a list of potential data fields, and standardized inputs with interpertation of fields as a launchpad for wikipedia/wikispecies based editing of data function parsers along with information on export of data, how data can be used etc and related wiki projects etc?
  3. Could this extension be used to extract data from the wikipedia database into a file (such as an excel file or other database files?)
  4. And could the data concivably be converted to other formats (like number) easily IF it conforms to certain standards?

Supaiku 15:58, 10 November 2010 (UTC)Reply[reply]

Update ExtData::set signature[edit]

Hi. I updated ExtData::set 's function signature in the source code to match the current definition. See Manual:Hooks/ArticleSaveComplete for reference.

Previous version made Extension:Data crash when adding new data to article. --Kevin

MySQL requirement[edit]

As far as I see, this extensions requires MySQL and thus must not be installed if MediaWiki installation is based on SQLite, postgreSQL or any other DB engine. — 22:03, 15 September 2011 (UTC)Reply[reply]

Working in 1.18[edit]

To get this working with 1.18 I changed line 34 and removed line 40 because $wgMessageCache is no longer supported.

New line 34: global $IP,$wgParser,$wgHooks,$wgExtData;

Removed line 40:$wgMessageCache->addMessage( 'joindata', 'Joindata' );