Skip to content

Commit

Permalink
feat: improved update handling of .htaccess file
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Dec 8, 2024
1 parent ed3089d commit 72d3a70
Show file tree
Hide file tree
Showing 14 changed files with 302 additions and 54 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This is a log of major user-visible changes in each phpMyFAQ release.

### phpMyFAQ v4.0.1 - unreleased

- improved update handling of .htaccess file (Thorsten)
- updated 3rd party dependencies (Thorsten)

### phpMyFAQ v4.0.0 - 2024-12-06
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"symfony/mailer": "^7.0",
"symfony/routing": "^7.0",
"tecnickcom/tcpdf": "~6.0",
"tivie/htaccess-parser": "0.3.0",
"twig/intl-extra": "^3.10",
"twig/twig": "^3.10"
},
Expand Down
137 changes: 92 additions & 45 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@thorsten/phpmyfaq",
"version": "4.0.0",
"version": "4.0.1",
"description": "phpMyFAQ",
"repository": "git://github.com/thorsten/phpMyFAQ.git",
"author": "Thorsten Rinne",
Expand Down
5 changes: 5 additions & 0 deletions phpmyfaq/src/phpMyFAQ/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ public function getDefaultUrl(): string
return $defaultUrl;
}

public function getRootPath(): string
{
return PMF_ROOT_DIR;
}

/**
* Returns a configuration item.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,21 +234,22 @@ public function createTemporaryBackup(): StreamedResponse
}

/**
* @throws Exception
* @throws \Exception
*/
#[Route('admin/api/install-package')]
public function installPackage(): StreamedResponse
{
$this->userHasPermission(PermissionType::CONFIGURATION_EDIT);

$upgrade = new Upgrade(new System(), $this->configuration);
return new StreamedResponse(static function () use ($upgrade) {
$configurator = $this->container->get('phpmyfaq.setup.environment_configurator');
return new StreamedResponse(static function () use ($upgrade, $configurator) {
$progressCallback = static function ($progress) {
echo json_encode(['progress' => $progress]) . "\n";
ob_flush();
flush();
};
if ($upgrade->installPackage($progressCallback)) {
if ($upgrade->installPackage($progressCallback) && $configurator->adjustRewriteBaseHtaccess()) {
echo json_encode(['message' => '✅ Package successfully installed.']);
} else {
echo json_encode(['message' => 'Install package failed']);
Expand Down
Loading

0 comments on commit 72d3a70

Please sign in to comment.