Merge "(bug 43270) Add wgPostEdit to show if user just saved this page"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / generateRandomImages.php
1 <?php
2 /**
3 * Bootstrapping for test image file generation
4 *
5 * @file
6 */
7
8 // Start up MediaWiki in command-line mode
9 require_once( __DIR__ . "/../../../../maintenance/Maintenance.php" );
10 require( __DIR__ . "/RandomImageGenerator.php" );
11
12 class GenerateRandomImages extends Maintenance {
13
14 public function getDbType() {
15 return Maintenance::DB_NONE;
16 }
17
18 public function execute() {
19
20 $getOptSpec = array(
21 'dictionaryFile::',
22 'minWidth::',
23 'maxWidth::',
24 'minHeight::',
25 'maxHeight::',
26 'shapesToDraw::',
27 'shape::',
28
29 'number::',
30 'format::'
31 );
32 $options = getopt( null, $getOptSpec );
33
34 $format = isset( $options['format'] ) ? $options['format'] : 'jpg';
35 unset( $options['format'] );
36
37 $number = isset( $options['number'] ) ? intval( $options['number'] ) : 10;
38 unset( $options['number'] );
39
40 $randomImageGenerator = new RandomImageGenerator( $options );
41 $randomImageGenerator->writeImages( $number, $format );
42 }
43 }
44
45 $maintClass = 'GenerateRandomImages';
46 require( RUN_MAINTENANCE_IF_MAIN );