24
24
use dibi ;
25
25
use DOMXPath ;
26
26
use Exception ;
27
+ use Psr \Http \Message \ResponseInterface ;
28
+ use Psr \Http \Message \ServerRequestInterface ;
29
+ use Zend \Diactoros \Response \JsonResponse ;
27
30
use Pydio \Access \Core \Model \Repository ;
28
31
use Pydio \Core \Exception \PydioException ;
29
32
use Pydio \Core \Model \Context ;
@@ -180,7 +183,7 @@ public function printFormFromServerSettings($fullManifest)
180
183
* @param \Psr\Http\Message\ServerRequestInterface $requestInterface
181
184
* @param \Psr\Http\Message\ResponseInterface $responseInterface
182
185
*/
183
- public function loadInstallerForm (\ Psr \ Http \ Message \ ServerRequestInterface $ requestInterface , \ Psr \ Http \ Message \ ResponseInterface &$ responseInterface )
186
+ public function loadInstallerForm (ServerRequestInterface $ requestInterface , ResponseInterface &$ responseInterface )
184
187
{
185
188
$ httpVars = $ requestInterface ->getParsedBody ();
186
189
if (isSet ($ httpVars ["lang " ])) {
@@ -195,14 +198,16 @@ public function loadInstallerForm(\Psr\Http\Message\ServerRequestInterface $requ
195
198
196
199
/**
197
200
* 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
201
203
*/
202
- public function applyInstallerForm ($ action , $ httpVars , $ fileVars , ContextInterface $ ctx )
204
+ public function applyInstallerForm (ServerRequestInterface $ requestInterface , ResponseInterface & $ responseInterface )
203
205
{
204
206
$ data = array ();
205
- OptionsHelper::parseStandardFormParameters ($ ctx , $ httpVars , $ data , "" );
207
+ OptionsHelper::parseStandardFormParameters (
208
+ $ requestInterface ->getAttribute ("ctx " ),
209
+ $ requestInterface ->getParsedBody (),
210
+ $ data , "" );
206
211
207
212
list ($ newConfigPlugin , $ newAuthPlugin , $ newCachePlugin ) = $ this ->createBootstrapConf ($ data );
208
213
@@ -214,27 +219,26 @@ public function applyInstallerForm($action, $httpVars, $fileVars, ContextInterfa
214
219
$ this ->setAdditionalData ($ data );
215
220
$ htContent = null ;
216
221
$ htAccessToUpdate = $ this ->updateHtAccess ($ data , $ htContent );
217
- $ this ->sendInstallResult ($ htAccessToUpdate , $ htContent );
222
+ $ this ->sendInstallResult ($ htAccessToUpdate , $ htContent, $ responseInterface );
218
223
219
224
}
220
225
221
226
/**
222
227
* Send output to the user.
223
228
* @param String $htAccessToUpdate file path
224
229
* @param String $htContent file content
230
+ * @param ResponseInterface $responseInterface
225
231
*/
226
- public function sendInstallResult ($ htAccessToUpdate , $ htContent )
232
+ public function sendInstallResult ($ htAccessToUpdate , $ htContent, ResponseInterface & $ responseInterface )
227
233
{
228
234
ConfService::clearAllCaches ();
229
235
ApplicationState::setApplicationFirstRunPassed ();
230
236
231
237
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 ]);
234
239
} else {
235
240
session_destroy ();
236
- HTMLWriter::charsetHeader ("text/plain " );
237
- echo 'OK ' ;
241
+ $ responseInterface ->getBody ()->write ("OK " );
238
242
}
239
243
240
244
}
0 commit comments