2010-12-14 16:26:35 +00:00
|
|
|
<?php
|
2011-06-21 03:40:53 +00:00
|
|
|
/**
|
|
|
|
|
* Bootstrapping for test image file generation
|
|
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
*/
|
2010-12-14 16:26:35 +00:00
|
|
|
|
2011-06-21 03:40:53 +00:00
|
|
|
// Start up MediaWiki in command-line mode
|
2013-02-25 20:09:38 +00:00
|
|
|
require_once( __DIR__ . "/../../../../maintenance/Maintenance.php" );
|
2013-02-14 13:10:38 +00:00
|
|
|
require( __DIR__ . "/RandomImageGenerator.php" );
|
2010-12-14 16:26:35 +00:00
|
|
|
|
2011-06-21 03:40:53 +00:00
|
|
|
class GenerateRandomImages extends Maintenance {
|
|
|
|
|
|
2012-06-26 17:02:55 +00:00
|
|
|
public function getDbType() {
|
|
|
|
|
return Maintenance::DB_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-21 03:40:53 +00:00
|
|
|
public function execute() {
|
|
|
|
|
|
|
|
|
|
$getOptSpec = array(
|
|
|
|
|
'dictionaryFile::',
|
|
|
|
|
'minWidth::',
|
|
|
|
|
'maxWidth::',
|
|
|
|
|
'minHeight::',
|
|
|
|
|
'maxHeight::',
|
|
|
|
|
'shapesToDraw::',
|
|
|
|
|
'shape::',
|
|
|
|
|
|
|
|
|
|
'number::',
|
|
|
|
|
'format::'
|
|
|
|
|
);
|
|
|
|
|
$options = getopt( null, $getOptSpec );
|
|
|
|
|
|
|
|
|
|
$format = isset( $options['format'] ) ? $options['format'] : 'jpg';
|
|
|
|
|
unset( $options['format'] );
|
|
|
|
|
|
|
|
|
|
$number = isset( $options['number'] ) ? intval( $options['number'] ) : 10;
|
|
|
|
|
unset( $options['number'] );
|
2010-12-14 16:26:35 +00:00
|
|
|
|
2011-06-21 03:40:53 +00:00
|
|
|
$randomImageGenerator = new RandomImageGenerator( $options );
|
|
|
|
|
$randomImageGenerator->writeImages( $number, $format );
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-12-14 16:26:35 +00:00
|
|
|
|
2011-06-21 03:40:53 +00:00
|
|
|
$maintClass = 'GenerateRandomImages';
|
|
|
|
|
require( RUN_MAINTENANCE_IF_MAIN );
|