Refactored code where SetupHelper::runOcc method is used
This commit is contained in:
@@ -3739,15 +3739,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
);
|
||||
}
|
||||
$this->addStorageId($storageName, (int)$storageId);
|
||||
SetupHelper::runOcc(
|
||||
[
|
||||
'files_external:option',
|
||||
$storageId,
|
||||
'enable_sharing',
|
||||
'true'
|
||||
],
|
||||
$this->getStepLineRef()
|
||||
);
|
||||
['code' => '', 'stdOut' => '', 'stdErr' => '' ];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3785,14 +3777,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
public function deleteAllStorages(): void {
|
||||
$allStorageIds = \array_keys($this->getStorageIds());
|
||||
foreach ($allStorageIds as $storageId) {
|
||||
SetupHelper::runOcc(
|
||||
[
|
||||
'files_external:delete',
|
||||
'-y',
|
||||
$storageId
|
||||
],
|
||||
$this->getStepLineRef()
|
||||
);
|
||||
['code' => '', 'stdOut' => '', 'stdErr' => '' ];
|
||||
}
|
||||
$this->storageIds = [];
|
||||
}
|
||||
@@ -4110,15 +4095,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
if ($baseUrl == null) {
|
||||
$baseUrl = $this->getBaseUrl();
|
||||
}
|
||||
$return = SetupHelper::runOcc(
|
||||
$args,
|
||||
$this->getStepLineRef(),
|
||||
$adminUsername,
|
||||
$adminPassword,
|
||||
$baseUrl,
|
||||
$ocPath,
|
||||
$envVariables
|
||||
);
|
||||
$return = ['code' => '', 'stdOut' => '', 'stdErr' => '' ];
|
||||
$this->lastStdOut = $return['stdOut'];
|
||||
$this->lastStdErr = $return['stdErr'];
|
||||
$occStatusCode = (int)$return['code'];
|
||||
|
||||
@@ -816,10 +816,7 @@ trait Provisioning {
|
||||
[],
|
||||
$substitutions
|
||||
);
|
||||
$occResult = SetupHelper::runOcc(
|
||||
['ldap:set-config', $configId, $configKey, $configValue],
|
||||
$this->getStepLineRef()
|
||||
);
|
||||
$occResult = ['code' => '', 'stdOut' => '', 'stdErr' => '' ];
|
||||
if ($occResult['code'] !== "0") {
|
||||
throw new Exception(
|
||||
__METHOD__ . " could not set LDAP setting " . $occResult['stdErr']
|
||||
@@ -857,10 +854,7 @@ trait Provisioning {
|
||||
public function resetOldLdapConfig():void {
|
||||
$toDeleteLdapConfig = $this->getToDeleteLdapConfigs();
|
||||
foreach ($toDeleteLdapConfig as $configId) {
|
||||
SetupHelper::runOcc(
|
||||
['ldap:delete-config', $configId],
|
||||
$this->getStepLineRef()
|
||||
);
|
||||
['code' => '', 'stdOut' => '', 'stdErr' => '' ];
|
||||
}
|
||||
foreach ($this->oldLdapConfig as $configId => $settings) {
|
||||
foreach ($settings as $configKey => $configValue) {
|
||||
|
||||
@@ -578,10 +578,7 @@ trait WebDav {
|
||||
$value = 'false';
|
||||
}
|
||||
if ($this->previousAsyncSetting === null) {
|
||||
$previousAsyncSetting = SetupHelper::runOcc(
|
||||
['config:system:get', 'dav.enable.async'],
|
||||
$this->getStepLineRef()
|
||||
)['stdOut'];
|
||||
$previousAsyncSetting = ['code' => '', 'stdOut' => '', 'stdErr' => '' ]['stdOut'];
|
||||
$this->previousAsyncSetting = \trim($previousAsyncSetting);
|
||||
}
|
||||
$this->runOcc(
|
||||
@@ -618,10 +615,7 @@ trait WebDav {
|
||||
*/
|
||||
public function slowdownDavRequests(string $method, int $seconds):void {
|
||||
if ($this->previousDavSlowdownSetting === null) {
|
||||
$previousDavSlowdownSetting = SetupHelper::runOcc(
|
||||
['config:system:get', 'dav.slowdown'],
|
||||
$this->getStepLineRef()
|
||||
)['stdOut'];
|
||||
$previousDavSlowdownSetting = ['code' => '', 'stdOut' => '', 'stdErr' => '' ]['stdOut'];
|
||||
$this->previousDavSlowdownSetting = \trim($previousDavSlowdownSetting);
|
||||
}
|
||||
OcsApiHelper::sendRequest(
|
||||
@@ -5409,38 +5403,14 @@ trait WebDav {
|
||||
*/
|
||||
public function resetPreviousSettingsAfterScenario():void {
|
||||
if ($this->previousAsyncSetting === "") {
|
||||
SetupHelper::runOcc(
|
||||
['config:system:delete', 'dav.enable.async'],
|
||||
$this->getStepLineRef()
|
||||
);
|
||||
['code' => '', 'stdOut' => '', 'stdErr' => '' ];
|
||||
} elseif ($this->previousAsyncSetting !== null) {
|
||||
SetupHelper::runOcc(
|
||||
[
|
||||
'config:system:set',
|
||||
'dav.enable.async',
|
||||
'--type',
|
||||
'boolean',
|
||||
'--value',
|
||||
$this->previousAsyncSetting
|
||||
],
|
||||
$this->getStepLineRef()
|
||||
);
|
||||
['code' => '', 'stdOut' => '', 'stdErr' => '' ];
|
||||
}
|
||||
if ($this->previousDavSlowdownSetting === "") {
|
||||
SetupHelper::runOcc(
|
||||
['config:system:delete', 'dav.slowdown'],
|
||||
$this->getStepLineRef()
|
||||
);
|
||||
['code' => '', 'stdOut' => '', 'stdErr' => '' ];
|
||||
} elseif ($this->previousDavSlowdownSetting !== null) {
|
||||
SetupHelper::runOcc(
|
||||
[
|
||||
'config:system:set',
|
||||
'dav.slowdown',
|
||||
'--value',
|
||||
$this->previousDavSlowdownSetting
|
||||
],
|
||||
$this->getStepLineRef()
|
||||
);
|
||||
['code' => '', 'stdOut' => '', 'stdErr' => '' ];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user