class add extends command

Properties

protected user $user from  command
protected array $data
protected driver_interface $db
protected config $config
protected language $language
protected manager $password_manager
protected string $phpbb_root_path

phpBB root path

protected string $php_ext

PHP extension.

Methods

__construct(user $user, driver_interface $db, config $config, language $language, manager $password_manager, string $phpbb_root_path, string $php_ext)

Construct method

ProgressBar
create_progress_bar(int $max, SymfonyStyle $io, OutputInterface $output, bool $message = false)

Create a styled progress bar

from  command
null
configure()

Sets the command name and description

int
execute(InputInterface $input, OutputInterface $output)

Executes the command user:add

interact(InputInterface $input, OutputInterface $output)

Interacts with the user.

null
validate_user_data()

Validate the submitted user data

null
get_group_id()

Get the group id

null
send_activation_email(int $user_id)

Send account activation email

string
ask_user(string $key)

Helper to translate questions to the user

Details

at line 72
__construct(user $user, driver_interface $db, config $config, language $language, manager $password_manager, string $phpbb_root_path, string $php_ext)

Construct method

Parameters

user $user

User instance (mostly for translation)

driver_interface $db
config $config
language $language
manager $password_manager
string $phpbb_root_path
string $php_ext

in command at line 45
ProgressBar create_progress_bar(int $max, SymfonyStyle $io, OutputInterface $output, bool $message = false)

Create a styled progress bar

Parameters

int $max

Max value for the progress bar

SymfonyStyle $io

Symfony style output decorator

OutputInterface $output

The output stream, used to print messages

bool $message

Should we display message output under the progress bar?

Return Value

ProgressBar

at line 90
protected null configure()

Sets the command name and description

Return Value

null

at line 134
protected int execute(InputInterface $input, OutputInterface $output)

Executes the command user:add

Adds a new user to the database. If options are not provided, it will ask for the username, password and email. User is added to the registered user group. Language and timezone default to $config settings.

Parameters

InputInterface $input

The input stream used to get the options

OutputInterface $output

The output stream, used to print messages

Return Value

int

0 if all is well, 1 if any errors occurred

at line 184
protected interact(InputInterface $input, OutputInterface $output)

Interacts with the user.

Parameters

InputInterface $input

An InputInterface instance

OutputInterface $output

An OutputInterface instance

at line 231
protected null validate_user_data()

Validate the submitted user data

Return Value

null

Exceptions

runtime_exception

if any data fails validation

at line 264
protected null get_group_id()

Get the group id

Go and find in the database the group_id corresponding to 'REGISTERED'

Return Value

null

Exceptions

runtime_exception

if the group id does not exist in database.

at line 288
protected null send_activation_email(int $user_id)

Send account activation email

Parameters

int $user_id

The new user's id

Return Value

null

at line 331
protected string ask_user(string $key)

Helper to translate questions to the user

Parameters

string $key

The language key

Return Value

string

The language key translated with a colon and space appended