r45209 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45208‎ | r45209 | r45210 >
Date:22:55, 30 December 2008
Author:danny_b
Status:ok
Tags:
Comment:
* handle the "o" format character for PHP 5.1.0+, older versions need emulation
Modified paths:
  • /trunk/extensions/ParserFunctions/SprintfDateCompat.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ParserFunctions/SprintfDateCompat.php
@@ -87,6 +87,16 @@
8888 if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );
8989 $num = date( 'L', $unix );
9090 break;
 91+ # 'o' is supported since PHP 5.1.0
 92+ # return literal if not supported
 93+ # TODO: emulation for pre 5.1.0 versions
 94+ case 'o':
 95+ if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );
 96+ if ( version_compare(PHP_VERSION, '5.1.0') === 1 )
 97+ $num = date( 'o', $unix );
 98+ else
 99+ $s .= 'o';
 100+ break;
91101 case 'Y':
92102 $num = substr( $ts, 0, 4 );
93103 break;

Status & tagging log