60 'create_since' =>
'now',
61 'create_until' =>
'now',
62 'interactive' =>
true,
63 'cli_command' => null,
75 $cli_command =
$options[
'cli_command'];
83 foreach ($seeds as $seed) {
87 if (!empty($seed_options[
'type']) && $seed_options[
'type'] !== $seed::getType()) {
92 $seed_options[
'limit'] = $seed_options[
'limit'] ?? $seed::getDefaultLimit();
93 if ($interactive && $cli_command instanceof
Command) {
94 $seed_options[
'limit'] = (int) $cli_command->ask($this->translator->translate(
'cli:database:seed:ask:limit', [$seed::getType()]), $seed_options[
'limit'],
false,
false);
97 if ($seed_options[
'limit'] < 1) {
103 $seeder =
new $seed($seed_options);
105 $progress_bar = $this->progress->start($seed, $seed_options[
'limit']);
107 $seeder->setProgressBar($progress_bar);
111 $this->progress->finish($progress_bar);
134 $trash_enabled = $this->config->trash_enabled;
135 $this->config->trash_enabled =
false;
136 foreach ($seeds as $seed) {
143 $seeder =
new $seed();
145 $progress_bar = $this->progress->start($seed, $seeder->getCount());
147 $seeder->setProgressBar($progress_bar);
151 $this->progress->finish($progress_bar);
155 $this->config->trash_enabled = $trash_enabled;
167 $seeds = $this->events->triggerResults(
'seeds',
'database', [], []);
168 foreach ($seeds as $seed) {
169 if (!class_exists($seed)) {
170 elgg_log(
"Seeding class {$seed} not found", \Psr\Log\LogLevel::ERROR);
174 if (!is_subclass_of($seed, Seed::class)) {
175 elgg_log(
"Seeding class {$seed} does not extend " . Seed::class, \Psr\Log\LogLevel::ERROR);
const ELGG_DISABLE_SYSTEM_LOG
getSeederClasses()
Get the class names of all registered seeders (verified to work for seeding)
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
seed(array $options=[])
Load seed scripts.
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
$config
Advanced site settings, debugging section.
if($who_can_change_language=== 'nobody') elseif($who_can_change_language=== 'admin_only'&&!elgg_is_admin_logged_in()) $options
elgg_set_config(string $name, $value)
Set an Elgg configuration value.
const ELGG_IGNORE_ACCESS
elgg_call() flags
const ELGG_SHOW_DISABLED_ENTITIES
elgg_log($message, $level=\Psr\Log\LogLevel::NOTICE)
Log a message.
unseed(array $options=[])
Remove all seeded entities.
const ELGG_SHOW_DELETED_ENTITIES
Abstract command with some utility methods.
__construct(protected EventsService $events, protected Progress $progress, protected Invoker $invoker, protected Translator $translator, protected Config $config)
Seeder constructor.