config.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * @author Joas Schilling <nickvergessen@owncloud.com>
  4. *
  5. * @copyright Copyright (c) 2015, ownCloud, Inc.
  6. * @license AGPL-3.0
  7. *
  8. * This code is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License, version 3,
  10. * as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License, version 3,
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>
  19. *
  20. */
  21. namespace OCA\Testing;
  22. use OCP\IConfig;
  23. use OCP\IRequest;
  24. class Config {
  25. /** @var IConfig */
  26. private $config;
  27. /** @var IRequest */
  28. private $request;
  29. /**
  30. * @param IConfig $config
  31. * @param IRequest $request
  32. */
  33. public function __construct(IConfig $config, IRequest $request) {
  34. $this->config = $config;
  35. $this->request = $request;
  36. }
  37. /**
  38. * @param array $parameters
  39. * @return \OC_OCS_Result
  40. */
  41. public function setAppValue($parameters) {
  42. $app = $parameters['appid'];
  43. $configKey = $parameters['configkey'];
  44. $value = $this->request->getParam('value');
  45. $this->config->setAppValue($app, $configKey, $value);
  46. return new \OC_OCS_Result();
  47. }
  48. /**
  49. * @param array $parameters
  50. * @return \OC_OCS_Result
  51. */
  52. public function deleteAppValue($parameters) {
  53. $app = $parameters['appid'];
  54. $configKey = $parameters['configkey'];
  55. $this->config->deleteAppValue($app, $configKey);
  56. return new \OC_OCS_Result();
  57. }
  58. }