/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $modules = $input->getArgument('module'); if (!$this->lock->acquire('cron', 900.0)) { $io->warning($this->trans('commands.cron.execute.messages.lock')); return 1; } if (in_array('all', $modules)) { $modules = $this->moduleHandler->getImplementations('cron'); } foreach ($modules as $module) { if (!$this->moduleHandler->implementsHook($module, 'cron')) { $io->warning(sprintf($this->trans('commands.cron.execute.messages.module-invalid'), $module)); continue; } try { $io->info(sprintf($this->trans('commands.cron.execute.messages.executing-cron'), $module)); $this->moduleHandler->invoke($module, 'cron'); } catch (\Exception $e) { watchdog_exception('cron', $e); $io->error($e->getMessage()); } } $this->state->set('system.cron_last', REQUEST_TIME); $this->lock->release('cron'); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); $io->success($this->trans('commands.cron.execute.messages.success')); return 0; }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); //$state = $this->getDrupalService('state'); $io->info($this->trans('commands.site.maintenance.messages.maintenance-on')); $io->info($this->trans('commands.update.entities.messages.start')); $this->state->set('system.maintenance_mode', true); try { $this->entityDefinitionUpdateManager->applyUpdates(); /* @var EntityStorageException $e */ } catch (EntityStorageException $e) { /* @var Error $variables */ $variables = Error::decodeException($e); $io->info($this->trans('commands.update.entities.messages.error')); $io->info($variables); } $this->state->set('system.maintenance_mode', false); $io->info($this->trans('commands.update.entities.messages.end')); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); $io->info($this->trans('commands.site.maintenance.messages.maintenance-off')); }
/** * {@inheritdoc} */ public function batchVariableSet(array $variables) { $state_variables = xmlsitemap_state_variables(); $config_variables = xmlsitemap_config_variables(); foreach ($variables as $variable => $value) { if (isset($state_variables[$variable])) { $this->state->set($variable, $value); } else { $this->config->set($variable, $value); } } $this->config->save(); }
/** * @inheritdoc */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $this->module = $input->getArgument('module'); $this->update_n = $input->getArgument('update-n'); $this->site->loadLegacyFile('/core/includes/install.inc'); $this->site->loadLegacyFile('/core/includes/update.inc'); drupal_load_updates(); update_fix_compatibility(); $updates = update_get_update_list(); $this->checkUpdates($io); $io->info($this->trans('commands.site.maintenance.description')); $this->state->set('system.maintenance_mode', true); $this->runUpdates($io, $updates); $this->runPostUpdates($io); $this->state->set('system.maintenance_mode', false); $io->info($this->trans('commands.site.maintenance.messages.maintenance-off')); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); }
/** * Submit callback for the fields error form. */ public function submitFieldAttach(array &$form, FormStateInterface $form_state) { $this->state->set('ds.disabled', $this->state->get('ds.disabled', FALSE) ? FALSE : TRUE); drupal_set_message(t('The configuration options have been saved.')); }
/** * Reacts to post-row-save event. * * @param \Drupal\Migrate\Event\MigratePostRowSaveEvent $event * The migration event. * @param string $name * The event name. */ public function postRowSaveEventRecorder(MigratePostRowSaveEvent $event, $name) { $this->state->set('migrate_events_test.post_row_save_event', array('event_name' => $name, 'migration' => $event->getMigration(), 'row' => $event->getRow(), 'destination_id_values' => $event->getDestinationIdValues())); }