MediaWiki
REL1_31
generateRandomImages.php
Go to the documentation of this file.
1
<?php
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
$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'
;
45
require
RUN_MAINTENANCE_IF_MAIN
;
GenerateRandomImages
Definition
generateRandomImages.php:12
GenerateRandomImages\execute
execute()
Do the actual work.
Definition
generateRandomImages.php:18
GenerateRandomImages\getDbType
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
Definition
generateRandomImages.php:14
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition
maintenance.txt:39
Maintenance\DB_NONE
const DB_NONE
Constants for DB access type.
Definition
Maintenance.php:66
RandomImageGenerator
RandomImageGenerator: does what it says on the tin.
Definition
RandomImageGenerator.php:30
$options
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
$maintClass
$maintClass
Definition
generateRandomImages.php:44
RUN_MAINTENANCE_IF_MAIN
require_once RUN_MAINTENANCE_IF_MAIN
Definition
maintenance.txt:50
tests
phpunit
includes
api
generateRandomImages.php
Generated on Mon Nov 25 2024 15:36:15 for MediaWiki by
1.10.0