|
@@ 88-98 (lines=11) @@
|
| 85 |
|
* @param string $key |
| 86 |
|
* @param OutputInterface $output |
| 87 |
|
*/ |
| 88 |
|
protected function getOption(StorageConfig $mount, $key, OutputInterface $output) { |
| 89 |
|
if ($key === 'mountpoint' || $key === 'mount_point') { |
| 90 |
|
$value = $mount->getMountPoint(); |
| 91 |
|
} else { |
| 92 |
|
$value = $mount->getBackendOption($key); |
| 93 |
|
} |
| 94 |
|
if (!is_string($value) && json_decode(json_encode($value)) === $value) { // show bools and objects correctly |
| 95 |
|
$value = json_encode($value); |
| 96 |
|
} |
| 97 |
|
$output->writeln($value); |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
/** |
| 101 |
|
* @param StorageConfig $mount |
|
@@ 106-117 (lines=12) @@
|
| 103 |
|
* @param string $value |
| 104 |
|
* @param OutputInterface $output |
| 105 |
|
*/ |
| 106 |
|
protected function setOption(StorageConfig $mount, $key, $value, OutputInterface $output) { |
| 107 |
|
$decoded = json_decode($value, true); |
| 108 |
|
if (!is_null($decoded) && json_encode($decoded) === $value) { |
| 109 |
|
$value = $decoded; |
| 110 |
|
} |
| 111 |
|
if ($key === 'mountpoint' || $key === 'mount_point') { |
| 112 |
|
$mount->setMountPoint($value); |
| 113 |
|
} else { |
| 114 |
|
$mount->setBackendOption($key, $value); |
| 115 |
|
} |
| 116 |
|
$this->globalService->updateStorage($mount); |
| 117 |
|
} |
| 118 |
|
} |
| 119 |
|
|