MediaWiki REL1_31
generateRandomImages.php
Go to the documentation of this file.
1<?php
8// Start up MediaWiki in command-line mode
9require_once __DIR__ . "/../../../../maintenance/Maintenance.php";
10require __DIR__ . "/RandomImageGenerator.php";
11
13
14 public function getDbType() {
16 }
17
18 public function execute() {
19 $getOptSpec = [
20 'dictionaryFile::',
21 'minWidth::',
22 'maxWidth::',
23 'minHeight::',
24 'maxHeight::',
25 'shapesToDraw::',
26 'shape::',
27
28 'number::',
29 'format::'
30 ];
31 $options = getopt( null, $getOptSpec );
32
33 $format = isset( $options['format'] ) ? $options['format'] : 'jpg';
34 unset( $options['format'] );
35
36 $number = isset( $options['number'] ) ? intval( $options['number'] ) : 10;
37 unset( $options['number'] );
38
39 $randomImageGenerator = new RandomImageGenerator( $options );
40 $randomImageGenerator->writeImages( $number, $format );
41 }
42}
43
44$maintClass = 'GenerateRandomImages';
execute()
Do the actual work.
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
const DB_NONE
Constants for DB access type.
RandomImageGenerator: does what it says on the tin.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition hooks.txt:2001
require_once RUN_MAINTENANCE_IF_MAIN