MediaWiki
REL1_19
|
00001 <?php 00023 require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); 00024 00025 class DateFormats extends Maintenance { 00026 00027 private $ts = '20010115123456'; 00028 00029 public function __construct() { 00030 parent::__construct(); 00031 $this->mDescription = "Test various language time and date functions"; 00032 } 00033 00034 public function execute() { 00035 global $IP; 00036 foreach ( glob( "$IP/languages/messages/Messages*.php" ) as $filename ) { 00037 $base = basename( $filename ); 00038 $m = array(); 00039 if ( !preg_match( '/Messages(.*)\.php$/', $base, $m ) ) { 00040 continue; 00041 } 00042 $code = str_replace( '_', '-', strtolower( $m[1] ) ); 00043 $this->output( "$code " ); 00044 $lang = Language::factory( $code ); 00045 $prefs = $lang->getDatePreferences(); 00046 if ( !$prefs ) { 00047 $prefs = array( 'default' ); 00048 } 00049 $this->output( "date: " ); 00050 foreach ( $prefs as $index => $pref ) { 00051 if ( $index > 0 ) { 00052 $this->output( ' | ' ); 00053 } 00054 $this->output( $lang->date( $this->ts, false, $pref ) ); 00055 } 00056 $this->output( "\n$code time: " ); 00057 foreach ( $prefs as $index => $pref ) { 00058 if ( $index > 0 ) { 00059 $this->output( ' | ' ); 00060 } 00061 $this->output( $lang->time( $this->ts, false, $pref ) ); 00062 } 00063 $this->output( "\n$code both: " ); 00064 foreach ( $prefs as $index => $pref ) { 00065 if ( $index > 0 ) { 00066 $this->output( ' | ' ); 00067 } 00068 $this->output( $lang->timeanddate( $this->ts, false, $pref ) ); 00069 } 00070 $this->output( "\n\n" ); 00071 } 00072 } 00073 } 00074 00075 $maintClass = "DateFormats"; 00076 require_once( RUN_MAINTENANCE_IF_MAIN );