r103833 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103832‎ | r103833 | r103834 >
Date:20:55, 21 November 2011
Author:danwe
Status:deferred
Tags:
Comment:
Compatbility-mode for '#arrayprint' restored, no compatbility-mode behaving for '#arraymerge' necessary since it always behaved differently according to documentation. Also removed @todo comment which is pretty much outdated and should be re-thought.
Modified paths:
  • /trunk/extensions/ArrayExtension/ArrayExtension.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArrayExtension/ArrayExtension.php
@@ -12,9 +12,9 @@
1313 *
1414 * @licence MIT License
1515 *
16 - * @author Li Ding (lidingpku@gmail.com)
 16+ * @author Li Ding < lidingpku@gmail.com >
1717 * @author Jie Bao
18 - * @author Daniel Werner (since version 1.3)
 18+ * @author Daniel Werner < danweetz@web.de > (since version 1.3)
1919 *
2020 * @ToDo:
2121 * use $egArrayExtensionCompatbilityMode to finally get rid of unlogic behavior of certain functions
@@ -23,27 +23,6 @@
2424 * things more consistent and clear.
2525 */
2626
27 -/**
28 - * This documenation group collects source code files belonging to ArrayExtension.
29 - *
30 - * @defgroup ArrayExtension ArrayExtension
31 - */
32 -
33 -/* TODO:
34 - - add experimental table (2 dimension array) data structure
35 - * table = header, row+ (1,1....)
36 - * sort_table_by_header (header)
37 - * sort_table_by_col (col)
38 - * print_table (format) e.g. csv, ul, ol,
39 - * add_table_row (array)
40 - * get_table_row (row) to an array
41 - * add_table_col(array)
42 - * get_table_col (col) to an array
43 - * get_table_header () to an array
44 - * get_total_row
45 - * get_total_col
46 -*/
47 -
4827 if ( ! defined( 'MEDIAWIKI' ) ) { die(); }
4928
5029 $wgExtensionCredits['parserhook'][] = array(
@@ -297,7 +276,14 @@
298277 $array = self::get( $parser )->getArray( $arrayId );
299278
300279 if( $array === null ) {
301 - return '';
 280+ // array we want to print doesn't exist!
 281+ global $egArrayExtensionCompatbilityMode;
 282+ if( ! $egArrayExtensionCompatbilityMode ) {
 283+ return '';
 284+ } else {
 285+ // COMPATIBILITY-MODE
 286+ return "undefined array: $arrayId";
 287+ }
302288 }
303289
304290 $rendered_values = array();
@@ -821,9 +807,14 @@
822808
823809 global $egArrayExtensionCompatbilityMode;
824810
825 - if( ! $operationRan && $egArrayExtensionCompatbilityMode ) {
826 - // COMPATIBILITY-MODE:
827 - // Before version 2.0 we didn't create a new array in case only one array was given
 811+ if( ! $operationRan && $egArrayExtensionCompatbilityMode
 812+ && $operationFunc !== 'multi_arraymerge' // only exception was 'arraymerge'
 813+ ) {
 814+ /*
 815+ * COMPATIBILITY-MODE:
 816+ * Before version 2.0 we didn't create a new array in case only one array was given.
 817+ * The only exception was 'arraymerge' which did duplicate the array.
 818+ */
828819 return '';
829820 }
830821

Status & tagging log