Skip to content

Commit

Permalink
Respect custom webroot in setup form
Browse files Browse the repository at this point in the history
Signed-off-by: HolonProduction <holonproduction@gmail.com>
  • Loading branch information
HolonProduction committed Oct 29, 2023
1 parent fe471da commit d9a6184
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions core/Controller/SetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
namespace OC\Core\Controller;

use OC\Setup;
use OCP\IURLGenerator;
use Psr\Log\LoggerInterface;

class SetupController {
Expand All @@ -40,6 +41,7 @@ class SetupController {
public function __construct(
protected Setup $setupHelper,
protected LoggerInterface $logger,
private IURLGenerator $urlGenerator,
) {
$this->autoConfigFile = \OC::$configDir.'autoconfig.php';
}
Expand Down Expand Up @@ -93,6 +95,7 @@ public function display($post): void {
'dbtablespace' => '',
'dbhost' => 'localhost',
'dbtype' => '',
'urlGenerator' => $this->urlGenerator,
];
$parameters = array_merge($defaults, $post);

Expand Down
4 changes: 3 additions & 1 deletion core/templates/installation.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php
script('core', 'install');

$urlGenerator = $_['urlGenerator'];
?>
<input type='hidden' id='hasMySQL' value='<?php p($_['hasMySQL']) ?>'>
<input type='hidden' id='hasSQLite' value='<?php p($_['hasSQLite']) ?>'>
<input type='hidden' id='hasPostgreSQL' value='<?php p($_['hasPostgreSQL']) ?>'>
<input type='hidden' id='hasOracle' value='<?php p($_['hasOracle']) ?>'>
<form action="index.php" method="post" class="guest-box install-form">
<form action="<?php $urlGenerator->getAbsoluteURL("index.php") ?>" method="post" class="guest-box install-form">
<input type="hidden" name="install" value="true">
<?php if (count($_['errors']) > 0): ?>
<fieldset class="warning">
Expand Down
2 changes: 1 addition & 1 deletion lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ public static function handleRequest(): void {
Server::get(\OCP\Security\ISecureRandom::class),
Server::get(\OC\Installer::class)
);
$controller = new OC\Core\Controller\SetupController($setupHelper, $logger);
$controller = new OC\Core\Controller\SetupController($setupHelper, $logger, Server::get(\OCP\IURLGenerator::class));
$controller->run($_POST);
exit();
}
Expand Down

0 comments on commit d9a6184

Please sign in to comment.