Index: trunk/extensions/LocalisationUpdate/tests/tokenTest.php |
— | — | @@ -9,18 +9,28 @@ |
10 | 10 | |
11 | 11 | |
12 | 12 | function evalExtractArray( $php, $varname ) { |
| 13 | + // a bunch of files use require()s which makes them un-eval'able |
| 14 | + if( preg_match( '/^require(_once)?\(.*__FILE__/m', $php ) ) { |
| 15 | + echo "File contains a path-relative 'require' call which cannot be fulfilled.\n"; |
| 16 | + return false; |
| 17 | + } |
13 | 18 | eval( $php ); |
14 | 19 | return @$$varname; |
15 | 20 | } |
16 | 21 | |
17 | 22 | function confExtractArray( $php, $varname ) { |
18 | | - $ce = new ConfEditor("<?php $php"); |
19 | | - $vars = $ce->getVars(); |
20 | | - $retval = @$vars[$varname]; |
| 23 | + try { |
| 24 | + $ce = new ConfEditor("<?php $php"); |
| 25 | + $vars = $ce->getVars(); |
| 26 | + $retval = @$vars[$varname]; |
| 27 | + } catch( Exception $e ) { |
| 28 | + print $e . "\n"; |
| 29 | + $retval = null; |
| 30 | + } |
21 | 31 | return $retval; |
22 | 32 | } |
23 | 33 | |
24 | | -$sources = glob("$IP/languages/messages/Messages*.php"); |
| 34 | +$sources = glob("$IP/extensions/*/*.i18n.php") + glob("$IP/languages/messages/Messages*.php"); |
25 | 35 | |
26 | 36 | foreach( $sources as $sourceFile ) { |
27 | 37 | $sourceData = file_get_contents( $sourceFile ); |
— | — | @@ -43,9 +53,11 @@ |
44 | 54 | printf( "%s %s %0.1f - token\n", $rel, $hashToken, $deltaToken * 1000 ); |
45 | 55 | |
46 | 56 | if( $hashEval !== $hashToken ) { |
47 | | - file_put_contents( 'eval.txt', var_export( $eval, true ) ); |
48 | | - file_put_contents( 'token.txt', var_export( $token, true ) ); |
49 | | - die("check eval.txt and token.txt\n"); |
| 57 | + echo "FAILED on $rel\n"; |
| 58 | + $out = str_replace( '/', '-', $rel ); |
| 59 | + file_put_contents( "$out-eval.txt", var_export( $eval, true ) ); |
| 60 | + file_put_contents( "$out-token.txt", var_export( $token, true ) ); |
| 61 | + #die("check eval.txt and token.txt\n"); |
50 | 62 | } |
51 | 63 | } |
52 | 64 | |