Page MenuHomePhabricator

New result format Array and Hash
Closed, ResolvedPublic

Description

I realised both of the result formats already.

New result format similar to the 'list' format but with more options how to list values. It should be possible to define separators between...

  1. ...values per page
  2. ...properties of a page
  3. ...multi value properties.
  4. ...record values.

It should be possible to define whether requested properties not defined on a page should create an empty list entry or not. And the format should be working together with Extension:ArrayExtension and Extension:HashTables to create an array or hash directly.


Version: unspecified
Severity: enhancement

attachment SRF_Hash_Array_by_DanielWerner.patch ignored as obsolete

Details

Reference
bz26930

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:23 PM
bzimport set Reference to bz26930.

improved version of the first patch.

This one only introduces four config variables which allow to define default separators within the LocalSettings.php
It is possible to define one of the wikis pages as source for a seperator. This is very useful when using templates for consistent array separators within template code.

Attached:

I just applied the patch: https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Special:Code/MediaWiki/84252

I have not included these 2 formats in the list of default enables ones though, since I have some concerns:

  • My IDE complains about the $var::CONST used (it's indicated as a fatal error), but it runs on my server. This makes me think you can only do this with PHP 5.3 (which my server has), and not 5.2 (to which my IDE is configured). Can you confirm it works with 5.2, or rewrite the accessing of these constants?

Also, it looks like you need ArrayExtension for the array format, and some other one (that I don't know of) for the hash format. This in itself is a reason to not enable the formats by default :)