Esempio n. 1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configNames = $input->getArgument('name');
     $configName = $configNames[0];
     if (sizeof($configNames) > 1) {
         if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->systemConfig->getKeys())) {
             $output->writeln('<error>System config ' . implode(' => ', $configNames) . ' could not be deleted because it did not exist</error>');
             return 1;
         }
         $value = $this->systemConfig->getValue($configName);
         try {
             $value = $this->removeSubValue(array_slice($configNames, 1), $value, $input->hasParameterOption('--error-if-not-exists'));
         } catch (\UnexpectedValueException $e) {
             $output->writeln('<error>System config ' . implode(' => ', $configNames) . ' could not be deleted because it did not exist</error>');
             return 1;
         }
         $this->systemConfig->setValue($configName, $value);
         $output->writeln('<info>System config value ' . implode(' => ', $configNames) . ' deleted</info>');
         return 0;
     } else {
         if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->systemConfig->getKeys())) {
             $output->writeln('<error>System config ' . $configName . ' could not be deleted because it did not exist</error>');
             return 1;
         }
         $this->systemConfig->deleteValue($configName);
         $output->writeln('<info>System config value ' . $configName . ' deleted</info>');
         return 0;
     }
 }
Esempio n. 2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configName = $input->getArgument('name');
     if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->systemConfig->getKeys())) {
         $output->writeln('<error>System config ' . $configName . ' could not be deleted because it did not exist</error>');
         return 1;
     }
     $this->systemConfig->deleteValue($configName);
     $output->writeln('<info>System config value ' . $configName . ' deleted</info>');
     return 0;
 }
Esempio n. 3
0
 /**
  * Delete a system wide defined value
  *
  * @param string $key the key of the value, under which it was saved
  */
 public function deleteSystemValue($key)
 {
     $this->systemConfig->deleteValue($key);
 }