r102917 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102916‎ | r102917 | r102918 >
Date:22:21, 13 November 2011
Author:danwe
Status:deferred (Comments)
Tags:
Comment:
Tag for the 1.4 'Variables' extension release
Modified paths:
  • /tags/extensions/Variables (added) (history)

Diff [purge]

Index: tags/extensions/Variables/RELEASE-NOTES
@@ -0,0 +1,37 @@
 2+ Post svn Changelog:
 3+ ===================
 4+
 5+ * November 13, 2011 -- Version 1.4 by Daniel Werner
 6+ - Cleanup for use with more current MW versions:
 7+ + 'ParserFirstCallInit' hook in use and no more global extension functions.
 8+ + State of the Art internationalization files added.
 9+ - 'ExtVariables::VARIABLES' constant with version info added.
 10+ - Put into mediawiki.org svn, 'RELEASE-NOTES' and 'README' files added.
 11+
 12+
 13+ Pre svn Changelog:
 14+ ==================
 15+
 16+ The following pre-svn changelog was composed by Daniel Werner in the hope it might
 17+ give an almost complete overview of all major releases of 'Variables' extension.
 18+ All changes can still be retrace at
 19+
 20+ http://www.mediawiki.org/w/index.php?title=Extension:VariablesExtension&action=history
 21+
 22+ * July 20, 2010 -- Version 1.3 by Daniel Werner
 23+ - Removed critical bug. Some kind of "Superglobal" variables. In some cases values
 24+ were passed from one page to another page during page imports and job queue jobs.
 25+
 26+ * March 28, 2009 -- Version 1.2 by Daniel Werner
 27+ - '#varexists' function introduced
 28+
 29+ * December 5, 2008 -- Version 1.1 by user 'Xiloynaha'
 30+ - '#vardefineecho' function introduced
 31+
 32+ * June 24, 2007 -- r3, Language file added by unknown contributor
 33+
 34+ * October 11, 2006 -- r2, Fixes for MediaWiki 1.8 compatbility by Tom Hempel
 35+ - '$wgExtensionCredits' and '$wgHooks' being used.
 36+
 37+ * October 11, 2006 -- r1, initial release by Rob Adams
 38+ - First version of 'Variables', introducing '#vardefine' and '#var'
Property changes on: tags/extensions/Variables/RELEASE-NOTES
___________________________________________________________________
Added: svn:eol-style
139 + native
Index: tags/extensions/Variables/Variables.i18n.magic.php
@@ -0,0 +1,21 @@
 2+<?php
 3+#coding: utf-8
 4+
 5+/**
 6+ * Internationalization file for magic words of the 'Variables' extension.
 7+ *
 8+ * @since 1.4
 9+ *
 10+ * @file Variables.i18n.magic.php
 11+ * @ingroup Variables
 12+ * @author Daniel Werner < danweetz@web.de >
 13+ */
 14+
 15+$magicWords = array();
 16+
 17+$magicWords['en'] = array(
 18+ 'var' => array( 0, 'var' ),
 19+ 'vardefine' => array( 0, 'vardefine' ),
 20+ 'vardefineecho' => array( 0, 'vardefineecho' ),
 21+ 'varexists' => array( 0, 'varexists' ),
 22+);
Property changes on: tags/extensions/Variables/Variables.i18n.magic.php
___________________________________________________________________
Added: svn:eol-style
123 + native
Index: tags/extensions/Variables/Variables.i18n.php
@@ -0,0 +1,28 @@
 2+<?php
 3+#coding: utf-8
 4+
 5+/**
 6+ * Internationalization file of the 'Variables' extension.
 7+ *
 8+ * @since 1.4
 9+ *
 10+ * @file Variables.i18n.php
 11+ * @ingroup Variables
 12+ * @author Daniel Werner < danweetz@web.de >
 13+ */
 14+
 15+$messages = array();
 16+
 17+/** English
 18+ * @author Daniel Werner
 19+ */
 20+$messages['en'] = array(
 21+ 'variables-desc' => 'Parser functions allowing to work with dynamic variables in an article scoped context',
 22+);
 23+
 24+/** German
 25+ * @author Daniel Werner
 26+ */
 27+$messages['de'] = array(
 28+ 'variables-desc' => 'Bietet Parser-Funktionen zur Verwendung dynamischer Variablen in Wiki-Artikeln',
 29+);
Property changes on: tags/extensions/Variables/Variables.i18n.php
___________________________________________________________________
Added: svn:eol-style
130 + native
Index: tags/extensions/Variables/README
@@ -0,0 +1,26 @@
 2+== About ==
 3+
 4+The 'Variables' extension for MediaWiki introduces parser functions for defining page-scoped
 5+variables within wiki pages.
 6+
 7+* Website: http://www.mediawiki.org/wiki/Extension:Variables
 8+* Authors: Rob Adams, Tom Hempel, Xiloynaha and Daniel Werner
 9+* License: Public domain
 10+
 11+
 12+== Installation ==
 13+
 14+Once you have downloaded the code, place the 'Variables' directory within your
 15+MediaWiki 'extensions' directory. Then add the following code to your
 16+[[Manual:LocalSettings.php|LocalSettings.php]] file:
 17+
 18+ # Variables
 19+ require_once( "$IP/extensions/Variables/Variables.php" );
 20+
 21+
 22+== Contributing ==
 23+
 24+If you have bug reports or feature requests, please add them to the ''Variables''
 25+Talk page [0]. You can also send them to Daniel Werner < danweetz@web.de >
 26+
 27+[0] http://www.mediawiki.org/w/index.php?title=Extension_talk:Variables
Property changes on: tags/extensions/Variables/README
___________________________________________________________________
Added: svn:eol-style
128 + native
Index: tags/extensions/Variables/Variables.php
@@ -0,0 +1,108 @@
 2+<?php
 3+
 4+/**
 5+ * 'Variables' introduces parser functions for defining page-scoped variables within
 6+ * wiki pages.
 7+ *
 8+ * Documentation: http://www.mediawiki.org/wiki/Extension:Variables
 9+ * Support: http://www.mediawiki.org/wiki/Extension_talk:Variables
 10+ * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Variables
 11+ *
 12+ * @version: 1.4
 13+ * @license: Public domain
 14+ * @author: Rob Adams
 15+ * @author: Tom Hempel
 16+ * @author: Xiloynaha
 17+ * @author: Daniel Werner < danweetz@web.de >
 18+ *
 19+ * @file Variables.php
 20+ * @ingroup Variables
 21+ *
 22+ * @ToDo:
 23+ * FIXME: Fixing bugs related to the fact that there are several Parser instances within the wiki
 24+ * which all could trigger 'ParserFirstCallInit'. E.g. special page transclusion will clear
 25+ * all variables defined before! Variables should have one store per Parser instance.
 26+ */
 27+
 28+if ( ! defined( 'MEDIAWIKI' ) ) { die( ); }
 29+
 30+$wgExtensionCredits['parserhook'][] = array(
 31+ 'path' => __FILE__,
 32+ 'name' => 'Variables',
 33+ 'descriptionmsg' => 'variables-desc',
 34+ 'version' => ExtVariables::VERSION,
 35+ 'author' => array( 'Rob Adams', 'Tom Hempel', 'Xiloynaha', '[http://www.mediawiki.org/wiki/User:Danwe Daniel Werner]' ),
 36+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Variables',
 37+);
 38+
 39+$dir = dirname( __FILE__ );
 40+
 41+// language files:
 42+$wgExtensionMessagesFiles['Variables' ] = $dir . '/Variables.i18n.php';
 43+$wgExtensionMessagesFiles['VariablesMagic'] = $dir . '/Variables.i18n.magic.php';
 44+
 45+unset ( $dir );
 46+
 47+// hooks registration:
 48+$wgHooks['ParserFirstCallInit'][] = 'ExtVariables::init';
 49+
 50+
 51+class ExtVariables {
 52+
 53+ /**
 54+ * Version of the 'Variables' extension.
 55+ *
 56+ * @since 1.4
 57+ *
 58+ * @var string
 59+ */
 60+ const VERSION = '1.4';
 61+
 62+ var $mVariables = array();
 63+
 64+ /**
 65+ * Sets up parser functions
 66+ *
 67+ * @since 1.4
 68+ */
 69+ static function init( Parser $parser ) {
 70+ global $wgExtVariables, $wgHooks;
 71+
 72+ $wgExtVariables = new self();
 73+ $wgHooks['ParserClearState'][] = $wgExtVariables; // hooks registration
 74+
 75+ $parser->setFunctionHook( 'vardefine', array( &$wgExtVariables, 'vardefine' ) );
 76+ $parser->setFunctionHook( 'vardefineecho', array( &$wgExtVariables, 'vardefineecho' ) );
 77+ $parser->setFunctionHook( 'var', array( &$wgExtVariables, 'varf' ) );
 78+ $parser->setFunctionHook( 'varexists', array( &$wgExtVariables, 'varexists' ) );
 79+
 80+ return true;
 81+ }
 82+
 83+ function onParserClearState( &$parser ) {
 84+ $this->mVariables = array(); //remove all variables to avoid conflicts with job queue or Special:Import
 85+ return true;
 86+ }
 87+
 88+ function vardefine( &$parser, $expr = '', $value = '' ) {
 89+ $this->mVariables[ $expr ] = $value;
 90+ return '';
 91+ }
 92+
 93+ function vardefineecho( &$parser, $expr = '', $value = '' ) {
 94+ $this->mVariables[ $expr ] = $value;
 95+ return $value;
 96+ }
 97+
 98+ function varf( &$parser, $expr = '', $defaultVal = '' ) {
 99+ if ( isset( $this->mVariables[ $expr ] ) && $this->mVariables[ $expr ] !== '' ) {
 100+ return $this->mVariables[ $expr ];
 101+ } else {
 102+ return $defaultVal;
 103+ }
 104+ }
 105+
 106+ function varexists( &$parser, $expr = '' ) {
 107+ return array_key_exists( $expr, $this->mVariables );
 108+ }
 109+}
Property changes on: tags/extensions/Variables/Variables.php
___________________________________________________________________
Added: svn:eol-style
1110 + native

Comments

#Comment by Danwe (talk | contribs)   22:40, 13 November 2011

This tag release was not really intended like this, should have been gone into Sub-directory 'REL_1_4' but I couldn't send it there with tortoisesvn. Is it legitimate to move these files into a 'REL_1_4' sub-directory or is there some revert command which should be used instead?

Status & tagging log