MediaWiki  REL1_22
generateRandomImages.php
Go to the documentation of this file.
00001 <?php
00008 // Start up MediaWiki in command-line mode
00009 require_once __DIR__ . "/../../../../maintenance/Maintenance.php";
00010 require __DIR__ . "/RandomImageGenerator.php";
00011 
00012 class GenerateRandomImages extends Maintenance {
00013 
00014     public function getDbType() {
00015         return Maintenance::DB_NONE;
00016     }
00017 
00018     public function execute() {
00019 
00020         $getOptSpec = array(
00021             'dictionaryFile::',
00022             'minWidth::',
00023             'maxWidth::',
00024             'minHeight::',
00025             'maxHeight::',
00026             'shapesToDraw::',
00027             'shape::',
00028 
00029             'number::',
00030             'format::'
00031         );
00032         $options = getopt( null, $getOptSpec );
00033 
00034         $format = isset( $options['format'] ) ? $options['format'] : 'jpg';
00035         unset( $options['format'] );
00036 
00037         $number = isset( $options['number'] ) ? intval( $options['number'] ) : 10;
00038         unset( $options['number'] );
00039 
00040         $randomImageGenerator = new RandomImageGenerator( $options );
00041         $randomImageGenerator->writeImages( $number, $format );
00042     }
00043 }
00044 
00045 $maintClass = 'GenerateRandomImages';
00046 require RUN_MAINTENANCE_IF_MAIN;