Skip to content

Commit

Permalink
[FIX] Fix #393
Browse files Browse the repository at this point in the history
  • Loading branch information
Teyir committed Dec 13, 2024
1 parent 968f7e7 commit 6a1187b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion App/Manager/Updater/CMSUpdaterManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function doUpdate(array $updateData): void
{
if (!isset($updateData['file_update'])) {
Flash::send(Alert::ERROR, LangManager::translate('core.toaster.error'),
LangManager::translate('core.updates.errors.fileUpdate'));
LangManager::translate('core.updates.errors.nullFileUpdate'));
return;
}

Expand Down
11 changes: 11 additions & 0 deletions App/Package/Core/Controllers/UpdatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use CMW\Controller\Users\UsersController;
use CMW\Manager\Api\PublicAPI;
use CMW\Manager\Cache\SimpleCacheManager;
use CMW\Manager\Flash\Alert;
use CMW\Manager\Flash\Flash;
use CMW\Manager\Lang\LangManager;
use CMW\Manager\Package\AbstractController;
use CMW\Manager\Router\Link;
use CMW\Manager\Updater\CMSUpdaterManager;
Expand Down Expand Up @@ -78,6 +81,14 @@ private function adminUpdatesInstall(): void
{
UsersController::redirectIfNotHavePermissions('core.dashboard', 'core.update');

$currentVersion = UpdatesManager::getVersion();

if ($currentVersion === 'DEV') {
Flash::send(Alert::ERROR, LangManager::translate('core.toaster.error'),
LangManager::translate('core.updates.errors.devVersion'));
Redirect::redirectPreviousRoute();
}

// We get all the new version id.
$versions = PublicAPI::postData('cms/update', ['current_version' => UpdatesManager::getVersion()]);

Expand Down
1 change: 1 addition & 0 deletions App/Package/Core/Lang/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
'deletedFiles' => 'Unable to delete old files.',
'deleteFile' => 'Unable to delete file %file%',
'sqlUpdate' => 'Unable to update your database.',
'devVersion' => 'You are using a development version of CraftMyWebsite, updates are not available.',
],
'success' => 'Website update with success',
],
Expand Down
1 change: 1 addition & 0 deletions App/Package/Core/Lang/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
"deletedFiles" => "Impossible de supprimer les anciens fichiers.",
"deleteFile" => "Impossible de supprimer le fichier %file%",
"sqlUpdate" => "Impossible de mettre à jour la base de données.",
'devVersion' => 'Vous utilisez une version de développement de CraftMyWebsite, impossible de mettre à jour.',
],
'success' => 'Mise à jour de votre site réussie',
],
Expand Down

0 comments on commit 6a1187b

Please sign in to comment.