Index: branches/wmf-deployment/extensions/TrustedXFF/generate.php |
— | — | @@ -12,7 +12,16 @@ |
13 | 13 | echo "Unable to open input file \"trusted-xff.txt\"\n"; |
14 | 14 | exit( 1 ); |
15 | 15 | } |
16 | | -$outFile = dba_open( 'trusted-xff.cdb', 'n', 'cdb' ); |
| 16 | + |
| 17 | +if( isset( $args[0] ) ) { |
| 18 | + $target = realpath( $args[0] ); |
| 19 | +} elseif( isset( $wgTrustedXffFile ) ) { |
| 20 | + $target = $wgTrustedXffFile; |
| 21 | +} else { |
| 22 | + echo "TrustedXffFile extension is not enabled. Specify target output file on command line!\n"; |
| 23 | + exit( 1 ); |
| 24 | +} |
| 25 | +$outFile = dba_open( $target, 'n', 'cdb' ); |
17 | 26 | if ( !$outFile ) { |
18 | 27 | echo "Unable open output file \"trusted-xff.cdb\"\n"; |
19 | 28 | exit( 1 ); |
Index: branches/wmf-deployment/extensions/TrustedXFF/update |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | #!/bin/bash |
3 | 3 | |
4 | 4 | cd `dirname $0` |
5 | | -php generate.php |
6 | | -bzip2 -kf trusted-xff.cdb |
| 5 | +php generate.php aawiki ../../cache/trusted-xff.cdb |
| 6 | +bzip2 -kf ../../cache/trusted-xff.cdb |
7 | 7 | if [ -x /home/wikipedia/bin/sync-common-file ]; then |
8 | | - sync-common-file php-1.5/extensions/TrustedXFF/trusted-xff.cdb |
| 8 | + sync-common-file wmf-deployment/cache/trusted-xff.cdb |
9 | 9 | fi |
Index: branches/wmf-deployment/extensions/TrustedXFF/TrustedXFF.php |
— | — | @@ -1,5 +1,9 @@ |
2 | 2 | <?php |
3 | 3 | |
| 4 | +if (!defined('MEDIAWIKI')) { |
| 5 | + die(1); |
| 6 | +} |
| 7 | + |
4 | 8 | /** |
5 | 9 | * Trusted hosts file in CDB format. |
6 | 10 | * The file can be generated using generate.php |
— | — | @@ -10,7 +14,7 @@ |
11 | 15 | * |
12 | 16 | * For details, see http://meta.wikimedia.org/wiki/XFF_project |
13 | 17 | */ |
14 | | -$wgTrustedXffFile = dirname(__FILE__).'/trusted-xff.cdb'; |
| 18 | +$wgTrustedXffFile = $IP . '/cache/trusted-xff.cdb'; |
15 | 19 | |
16 | 20 | |
17 | 21 | /** Registration */ |