Skip to content

Commit 200c02c

Browse files
committed
fix: corrected some issues in the update process
1 parent 386417f commit 200c02c

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

phpmyfaq/src/Bootstrap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
if (!file_exists(PMF_CONFIG_DIR . '/database.php') && !file_exists(PMF_LEGACY_CONFIG_DIR . '/database.php')) {
9696
$response = new RedirectResponse('./setup/');
9797
$response->send();
98+
exit();
9899
} else {
99100
if (file_exists(PMF_CONFIG_DIR . '/database.php')) {
100101
$databaseFile = PMF_CONFIG_DIR . '/database.php';

phpmyfaq/src/phpMyFAQ/Controller/Api/SetupController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function backup(Request $request): JsonResponse
8585
$installedVersion = Filter::filterVar($request->getContent(), FILTER_SANITIZE_SPECIAL_CHARS);
8686

8787
$configPath = PMF_ROOT_DIR . '/content/core/config';
88-
if (!version_compare(version1: $installedVersion, version2: '4.0.0-alpha') < 0) {
88+
if (version_compare(version1: $installedVersion, version2: '4.0.0-alpha', operator: '<')) {
8989
$configPath = PMF_ROOT_DIR . '/config';
9090
}
9191

phpmyfaq/src/phpMyFAQ/Setup/Installer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,9 @@ public function checkNoncriticalSettings(): array
714714
public function checkInitialRewriteBasePath(Request $request): bool
715715
{
716716
$basePath = $request->getBasePath();
717-
$basePath = rtrim($basePath, 'setup');
717+
if (str_ends_with($basePath, 'setup')) {
718+
$basePath = substr($basePath, 0, -strlen('setup'));
719+
}
718720

719721
$htaccessPath = PMF_ROOT_DIR . '/.htaccess';
720722

phpmyfaq/src/phpMyFAQ/Setup/Update.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ public function createConfigBackup(string $configDir): string
144144
public function checkInitialRewriteBasePath(Request $request): bool
145145
{
146146
$basePath = $request->getBasePath();
147-
$basePath = rtrim($basePath, 'update');
147+
if (str_ends_with($basePath, 'update')) {
148+
$basePath = substr($basePath, 0, -strlen('update'));
149+
}
148150

149151
$htaccessPath = PMF_ROOT_DIR . '/.htaccess';
150152

0 commit comments

Comments
 (0)