5 use Symfony\Component\Console\Input\InputOption;
18 foreach ($seeders as $seed) {
19 $types[] = $seed::getType();
22 $this->setName(
'database:unseed')
23 ->setDescription(
elgg_echo(
'cli:database:unseed:description'))
24 ->addOption(
'type',
't', InputOption::VALUE_OPTIONAL,
25 elgg_echo(
'cli:database:seed:option:type', [implode(
'|', $types)])
34 if (!class_exists(
'\Faker\Generator')) {
35 elgg_log(
elgg_echo(
'cli:database:seed:log:error:faker'), \Psr\Log\LogLevel::ERROR);
41 _elgg_services()->set(
'mailer',
new \Laminas\Mail\Transport\InMemory());
44 'type' => $this->
option(
'type'),
49 }
catch (\Exception $e) {
50 elgg_log($e->getMessage(), \Psr\Log\LogLevel::ERROR);
51 return $e->getCode() ?: 3;
option($name)
Returns option value.
Abstract command with some utility methods.
command()
{Command to be executed.This method method should return an integer code of the error (or 0 for succe...
if($who_can_change_language==='nobody') elseif($who_can_change_language==='admin_only' &&!elgg_is_admin_logged_in()) $options
elgg_log($message, $level=\Psr\Log\LogLevel::NOTICE)
Log a message.
_elgg_services()
Get the global service provider.
elgg_echo(string $message_key, array $args=[], string $language='')
Elgg language module Functions to manage language and translations.