Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit bdf5bdc

Browse files
committed
Fix applyInstallerForm for packages
1 parent efc2556 commit bdf5bdc

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

core/src/plugins/boot.conf/BootConfLoader.php

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
use dibi;
2525
use DOMXPath;
2626
use Exception;
27+
use Psr\Http\Message\ResponseInterface;
28+
use Psr\Http\Message\ServerRequestInterface;
29+
use Zend\Diactoros\Response\JsonResponse;
2730
use Pydio\Access\Core\Model\Repository;
2831
use Pydio\Core\Exception\PydioException;
2932
use Pydio\Core\Model\Context;
@@ -180,7 +183,7 @@ public function printFormFromServerSettings($fullManifest)
180183
* @param \Psr\Http\Message\ServerRequestInterface $requestInterface
181184
* @param \Psr\Http\Message\ResponseInterface $responseInterface
182185
*/
183-
public function loadInstallerForm(\Psr\Http\Message\ServerRequestInterface $requestInterface, \Psr\Http\Message\ResponseInterface &$responseInterface)
186+
public function loadInstallerForm(ServerRequestInterface $requestInterface, ResponseInterface &$responseInterface)
184187
{
185188
$httpVars = $requestInterface->getParsedBody();
186189
if (isSet($httpVars["lang"])) {
@@ -195,14 +198,16 @@ public function loadInstallerForm(\Psr\Http\Message\ServerRequestInterface $requ
195198

196199
/**
197200
* Transmit to the ajxp_conf load_plugin_manifest action
198-
* @param $action
199-
* @param $httpVars
200-
* @param $fileVars
201+
* @param ServerRequestInterface $requestInterface
202+
* @param ResponseInterface $responseInterface
201203
*/
202-
public function applyInstallerForm($action, $httpVars, $fileVars, ContextInterface $ctx)
204+
public function applyInstallerForm(ServerRequestInterface $requestInterface, ResponseInterface &$responseInterface)
203205
{
204206
$data = array();
205-
OptionsHelper::parseStandardFormParameters($ctx, $httpVars, $data, "");
207+
OptionsHelper::parseStandardFormParameters(
208+
$requestInterface->getAttribute("ctx"),
209+
$requestInterface->getParsedBody(),
210+
$data, "");
206211

207212
list($newConfigPlugin, $newAuthPlugin, $newCachePlugin) = $this->createBootstrapConf($data);
208213

@@ -214,27 +219,26 @@ public function applyInstallerForm($action, $httpVars, $fileVars, ContextInterfa
214219
$this->setAdditionalData($data);
215220
$htContent = null;
216221
$htAccessToUpdate = $this->updateHtAccess($data, $htContent);
217-
$this->sendInstallResult($htAccessToUpdate, $htContent);
222+
$this->sendInstallResult($htAccessToUpdate, $htContent, $responseInterface);
218223

219224
}
220225

221226
/**
222227
* Send output to the user.
223228
* @param String $htAccessToUpdate file path
224229
* @param String $htContent file content
230+
* @param ResponseInterface $responseInterface
225231
*/
226-
public function sendInstallResult($htAccessToUpdate, $htContent)
232+
public function sendInstallResult($htAccessToUpdate, $htContent, ResponseInterface &$responseInterface)
227233
{
228234
ConfService::clearAllCaches();
229235
ApplicationState::setApplicationFirstRunPassed();
230236

231237
if ($htAccessToUpdate != null) {
232-
HTMLWriter::charsetHeader("application/json");
233-
echo json_encode(array('file' => $htAccessToUpdate, 'content' => $htContent));
238+
$responseInterface = new JsonResponse(['file' => $htAccessToUpdate, 'content' => $htContent]);
234239
} else {
235240
session_destroy();
236-
HTMLWriter::charsetHeader("text/plain");
237-
echo 'OK';
241+
$responseInterface->getBody()->write("OK");
238242
}
239243

240244
}

0 commit comments

Comments
 (0)