/**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Remove the key value store entry.
     $account = $this->currentUser()->id();
     $this->keyValueExpirable->delete($account);
     if (!empty($this->modules['install'])) {
         // Don't catch the exception that this can throw for missing dependencies:
         // the form doesn't allow modules with unmet dependencies, so the only way
         // this can happen is if the filesystem changed between form display and
         // submit, in which case the user has bigger problems.
         try {
             // Install the given modules.
             $this->moduleInstaller->install(array_keys($this->modules['install']));
         } catch (PreExistingConfigException $e) {
             $config_objects = $e->flattenConfigObjects($e->getConfigObjects());
             drupal_set_message($this->formatPlural(count($config_objects), 'Unable to install @extension, %config_names already exists in active configuration.', 'Unable to install @extension, %config_names already exist in active configuration.', array('%config_names' => implode(', ', $config_objects), '@extension' => $this->modules['install'][$e->getExtension()])), 'error');
             return;
         } catch (UnmetDependenciesException $e) {
             drupal_set_message($e->getTranslatedMessage($this->getStringTranslation(), $this->modules['install'][$e->getExtension()]), 'error');
             return;
         }
         $module_names = array_values($this->modules['install']);
         drupal_set_message($this->formatPlural(count($module_names), 'Module %name has been enabled.', '@count modules have been enabled: %names.', array('%name' => $module_names[0], '%names' => implode(', ', $module_names))));
     }
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, array &$form_state)
 {
     // Clear the key value store entry.
     $account = $this->currentUser()->id();
     $this->keyValueExpirable->delete($account);
     // Uninstall the modules.
     $this->moduleHandler->uninstall($this->modules);
     drupal_set_message($this->t('The selected modules have been uninstalled.'));
     $form_state['redirect_route'] = $this->getCancelRoute();
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Clear the key value store entry.
     $account = $this->currentUser()->id();
     $this->keyValueExpirable->delete($account);
     // Uninstall the modules.
     $this->moduleInstaller->uninstall($this->modules);
     drupal_set_message($this->t('The selected modules have been uninstalled.'));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
Ejemplo n.º 4
0
 /**
  * Deletes data from the store for a given key and releases the lock on it.
  *
  * @param string $key
  *   The key of the data to delete.
  */
 public function delete($key)
 {
     if (!$this->lockBackend->acquire($key)) {
         $this->lockBackend->wait($key);
         if (!$this->lockBackend->acquire($key)) {
             throw new TempStoreException("Couldn't acquire lock to delete item '{$key}' from {$this->storage->getCollectionName()} temporary storage.");
         }
     }
     $this->storage->delete($key);
     $this->lockBackend->release($key);
 }
Ejemplo n.º 5
0
 /**
  * Deletes data from the store for a given key and releases the lock on it.
  *
  * @param string $key
  *   The key of the data to delete.
  */
 public function delete($key)
 {
     if (!$this->lockBackend->acquire($key)) {
         $this->lockBackend->wait($key);
         if (!$this->lockBackend->acquire($key)) {
             throw new TempStoreException(String::format("Couldn't acquire lock to delete item %key from %collection temporary storage.", array('%key' => $key, '%collection' => $this->storage->getCollectionName())));
         }
     }
     $this->storage->delete($key);
     $this->lockBackend->release($key);
 }
Ejemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 public function projectStorage($key)
 {
     $projects = array();
     // On certain paths, we should clear the data and recompute the projects for
     // update status of the site to avoid presenting stale information.
     $route_names = array('update.theme_update', 'system.modules_list', 'system.theme_install', 'update.module_update', 'update.module_install', 'update.status', 'update.report_update', 'update.report_install', 'update.settings', 'system.status', 'update.manual_status', 'update.confirmation_page', 'system.themes_page');
     if (in_array(\Drupal::routeMatch()->getRouteName(), $route_names)) {
         $this->keyValueStore->delete($key);
     } else {
         $projects = $this->keyValueStore->get($key, array());
     }
     return $projects;
 }
Ejemplo n.º 7
0
 /**
  * {@inheritdoc}
  */
 public function projectStorage($key)
 {
     $projects = array();
     // On certain paths, we should clear the data and recompute the projects for
     // update status of the site to avoid presenting stale information.
     $paths = array('admin/modules', 'admin/modules/update', 'admin/appearance', 'admin/appearance/update', 'admin/reports', 'admin/reports/updates', 'admin/reports/updates/update', 'admin/reports/status', 'admin/reports/updates/check');
     if (in_array(current_path(), $paths)) {
         $this->keyValueStore->delete($key);
     } else {
         $projects = $this->keyValueStore->get($key, array());
     }
     return $projects;
 }
Ejemplo n.º 8
0
 /**
  * Deletes data from the store for a given key and releases the lock on it.
  *
  * @param string $key
  *   The key of the data to delete.
  *
  * @return bool
  *   TRUE if the object was deleted or does not exist, FALSE if it exists but
  *   is not owned by $this->owner.
  */
 public function delete($key)
 {
     $key = $this->createkey($key);
     if (!($object = $this->storage->get($key))) {
         return TRUE;
     } elseif ($object->owner != $this->getOwner()) {
         return FALSE;
     }
     if (!$this->lockBackend->acquire($key)) {
         $this->lockBackend->wait($key);
         if (!$this->lockBackend->acquire($key)) {
             throw new TempStoreException("Couldn't acquire lock to delete item '{$key}' from '{$this->storage->getCollectionName()}' temporary storage.");
         }
     }
     $this->storage->delete($key);
     $this->lockBackend->release($key);
     return TRUE;
 }
 /**
  * Deletes data from the store for a given key and releases the lock on it.
  *
  * @param string $key
  *   The key of the data to delete.
  *
  * @return bool
  *   TRUE if the object was deleted or does not exist, FALSE if it exists but
  *   is not owned by $this->owner.
  */
 public function delete($key)
 {
     $key = $this->createkey($key);
     if (!($object = $this->storage->get($key))) {
         return TRUE;
     } elseif ($object->owner != $this->getOwner()) {
         return FALSE;
     }
     if (!$this->lockBackend->acquire($key)) {
         $this->lockBackend->wait($key);
         if (!$this->lockBackend->acquire($key)) {
             throw new TempStoreException(SafeMarkup::format("Couldn't acquire lock to delete item %key from %collection temporary storage.", array('%key' => $key, '%collection' => $this->storage->getCollectionName())));
         }
     }
     $this->storage->delete($key);
     $this->lockBackend->release($key);
     return TRUE;
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Remove the key value store entry.
     $account = $this->currentUser()->id();
     $this->keyValueExpirable->delete($account);
     // Gets list of modules prior to install process.
     $before = $this->moduleHandler->getModuleList();
     // Install the given modules.
     if (!empty($this->modules['install'])) {
         $this->moduleHandler->install(array_keys($this->modules['install']));
     }
     // Gets module list after install process, flushes caches and displays a
     // message if there are changes.
     if ($before != $this->moduleHandler->getModuleList()) {
         drupal_set_message($this->t('The configuration options have been saved.'));
     }
     $form_state->setRedirectUrl($this->getCancelUrl());
 }