Пример #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $importFile = $input->getArgument('file');
     if ($importFile !== null) {
         $content = $this->getArrayFromFile($importFile);
     } else {
         $content = $this->getArrayFromStdin();
     }
     try {
         $configs = $this->validateFileContent($content);
     } catch (\UnexpectedValueException $e) {
         $output->writeln('<error>' . $e->getMessage() . '</error>');
         return;
     }
     if (!empty($configs['system'])) {
         $this->config->setSystemValues($configs['system']);
     }
     if (!empty($configs['apps'])) {
         foreach ($configs['apps'] as $app => $appConfigs) {
             foreach ($appConfigs as $key => $value) {
                 if ($value === null) {
                     $this->config->deleteAppValue($app, $key);
                 } else {
                     $this->config->setAppValue($app, $key, $value);
                 }
             }
         }
     }
     $output->writeln('<info>Config successfully imported from: ' . $importFile . '</info>');
 }
Пример #2
0
 /**
  * @param array $parameters
  * @return \OC_OCS_Result
  */
 public function deleteAppValue($parameters)
 {
     $app = $parameters['appid'];
     $configKey = $parameters['configkey'];
     $this->config->deleteAppValue($app, $configKey);
     return new \OC_OCS_Result();
 }
Пример #3
0
 public function run(IOutput $out)
 {
     $keys = $this->config->getAppKeys('files_sharing');
     foreach ($keys as $key) {
         if (is_numeric($key)) {
             $this->config->deleteAppValue('files_sharing', $key);
         }
     }
 }
Пример #4
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $appName = $input->getArgument('app');
     $configName = $input->getArgument('name');
     if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->config->getAppKeys($appName))) {
         $output->writeln('<error>Config ' . $configName . ' of app ' . $appName . ' could not be deleted because it did not exist</error>');
         return 1;
     }
     $this->config->deleteAppValue($appName, $configName);
     $output->writeln('<info>Config value ' . $configName . ' of app ' . $appName . ' deleted</info>');
     return 0;
 }
Пример #5
0
 /**
  * update database
  */
 public function updateDB()
 {
     // make sure that we don't update the file cache multiple times
     // only update during the first run
     if ($this->installedVersion === '-1') {
         return;
     }
     // delete left-over from old encryption which is no longer needed
     $this->config->deleteAppValue('files_encryption', 'ocsid');
     $this->config->deleteAppValue('files_encryption', 'types');
     $this->config->deleteAppValue('files_encryption', 'enabled');
     $oldAppValues = $this->connection->createQueryBuilder();
     $oldAppValues->select('*')->from('`*PREFIX*appconfig`')->where($oldAppValues->expr()->eq('`appid`', ':appid'))->setParameter('appid', 'files_encryption');
     $appSettings = $oldAppValues->execute();
     while ($row = $appSettings->fetch()) {
         // 'installed_version' gets deleted at the end of the migration process
         if ($row['configkey'] !== 'installed_version') {
             $this->config->setAppValue('encryption', $row['configkey'], $row['configvalue']);
             $this->config->deleteAppValue('files_encryption', $row['configkey']);
         }
     }
     $oldPreferences = $this->connection->createQueryBuilder();
     $oldPreferences->select('*')->from('`*PREFIX*preferences`')->where($oldPreferences->expr()->eq('`appid`', ':appid'))->setParameter('appid', 'files_encryption');
     $preferenceSettings = $oldPreferences->execute();
     while ($row = $preferenceSettings->fetch()) {
         $this->config->setUserValue($row['userid'], 'encryption', $row['configkey'], $row['configvalue']);
         $this->config->deleteUserValue($row['userid'], 'files_encryption', $row['configkey']);
     }
 }
Пример #6
0
 /**
  * update database
  */
 public function updateDB()
 {
     // delete left-over from old encryption which is no longer needed
     $this->config->deleteAppValue('files_encryption', 'ocsid');
     $this->config->deleteAppValue('files_encryption', 'types');
     $this->config->deleteAppValue('files_encryption', 'enabled');
     $query = $this->connection->createQueryBuilder();
     $query->update('`*PREFIX*appconfig`')->set('`appid`', ':newappid')->where($query->expr()->eq('`appid`', ':oldappid'))->setParameter('oldappid', 'files_encryption')->setParameter('newappid', 'encryption');
     $query->execute();
     $query = $this->connection->createQueryBuilder();
     $query->update('`*PREFIX*preferences`')->set('`appid`', ':newappid')->where($query->expr()->eq('`appid`', ':oldappid'))->setParameter('oldappid', 'files_encryption')->setParameter('newappid', 'encryption');
     $query->execute();
 }
Пример #7
0
 /**
  * @param array $parameters
  * @return \OC_OCS_Result
  */
 public function releaseLock(array $parameters)
 {
     try {
         $path = $this->getPath($parameters);
     } catch (NoUserException $e) {
         return new \OC_OCS_Result(null, Http::STATUS_NOT_FOUND, 'User not found');
     } catch (NotFoundException $e) {
         return new \OC_OCS_Result(null, Http::STATUS_NOT_FOUND, 'Path not found');
     }
     $type = $this->getType($parameters);
     $lockingProvider = $this->getLockingProvider();
     try {
         $lockingProvider->releaseLock($path, $type);
         $this->config->deleteAppValue('testing', 'locking_' . $path);
         return new \OC_OCS_Result(null, 100);
     } catch (LockedException $e) {
         return new \OC_OCS_Result(null, Http::STATUS_LOCKED);
     }
 }
Пример #8
0
 /**
  * update database
  */
 public function updateDB()
 {
     // delete left-over from old encryption which is no longer needed
     $this->config->deleteAppValue('files_encryption', 'ocsid');
     $this->config->deleteAppValue('files_encryption', 'types');
     $this->config->deleteAppValue('files_encryption', 'enabled');
     $oldAppValues = $this->connection->getQueryBuilder();
     $oldAppValues->select('*')->from('*PREFIX*appconfig')->where($oldAppValues->expr()->eq('appid', $oldAppValues->createParameter('appid')))->setParameter('appid', 'files_encryption');
     $appSettings = $oldAppValues->execute();
     while ($row = $appSettings->fetch()) {
         // 'installed_version' gets deleted at the end of the migration process
         if ($row['configkey'] !== 'installed_version') {
             $this->config->setAppValue('encryption', $row['configkey'], $row['configvalue']);
             $this->config->deleteAppValue('files_encryption', $row['configkey']);
         }
     }
     $oldPreferences = $this->connection->getQueryBuilder();
     $oldPreferences->select('*')->from('*PREFIX*preferences')->where($oldPreferences->expr()->eq('appid', $oldPreferences->createParameter('appid')))->setParameter('appid', 'files_encryption');
     $preferenceSettings = $oldPreferences->execute();
     while ($row = $preferenceSettings->fetch()) {
         $this->config->setUserValue($row['userid'], 'encryption', $row['configkey'], $row['configvalue']);
         $this->config->deleteUserValue($row['userid'], 'files_encryption', $row['configkey']);
     }
 }
Пример #9
0
 /**
  *
  * Clean previous results for a proper rescanning. Otherwise
  */
 private function cleanResults()
 {
     $this->config->deleteAppValue('core', self::CACHE_KEY);
     $this->cache->remove(self::CACHE_KEY);
 }