-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring of the admin/autoupgrade directory structure #1156
base: dev
Are you sure you want to change the base?
Conversation
084c4d6
to
8804419
Compare
@M0rgan01 Would it be possible to move these files into the folder of the module, or a var directory? Why I ask - we run integrity checks on our shops every night and we have to whitelist these files as they could change depending on if autoupgrade is installed, I think that the admin directory shouldn't really change. |
@Hlavtox We actually asked ourselves this question. We use this folder because we are forced to do so for several technical reasons, but also to remain compatible with old versions (not to force users to move their backup / local archives) but also to be able to consult the logs by a URL hidden behind the admin folder. For v7 it will stay like this but it is not excluded that it will change in the future |
classes/UpgradeContainer.php
Outdated
const FILES_PATH = 'files'; | ||
const FILES_DIR = 'files/'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't these constants be called
const FILES_PATH = 'files'; | |
const FILES_DIR = 'files/'; | |
const TMP_FILES_PATH = 'files'; | |
const TMP_FILES_DIR = 'files/'; |
like the 3 next ones? As they are all subdirectories of the tmp/
folder.
classes/UpgradeContainer.php
Outdated
case self::TMP_MODULES_DIR: | ||
return $this->getProperty(self::TMP_MODULES_PATH) . DIRECTORY_SEPARATOR; | ||
case self::TMP_RELEASES_DIR: | ||
return $this->getProperty(self::TMP_PATH) . DIRECTORY_SEPARATOR . 'releases' . DIRECTORY_SEPARATOR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we keep the consistency of having two properties for each folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, it's a matter of need; it's not necessary for every folder to always have a constant path and another directory.
$tmpModulePath = $this->container->getProperty(UpgradeContainer::TMP_MODULES_PATH); | ||
if ($this->container->getFileSystem()->exists($tmpModulePath)) { | ||
foreach (scandir($tmpModulePath) as $item) { | ||
if ($item !== '.' && $item !== '..' && $item !== 'index.php') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen these checks on another place, I wonder is a helper method for this is a good addition to the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the download folder is only used for local archives why not rename it local archives?
For a matter of practicality and history. This folder is already present when unzipping a store, even if the module is not installed. Moreover, this prevents users from having to move or lose their archives. |
4924af2
to
1c7eb0f
Compare
1c7eb0f
to
64d96e5
Compare
|
This PR reorganizes the admin/autoupgrade directory structure to improve temporary file management and prevent accidental overwriting of local releases.
Changes introduced:
download
folder no longer stores the downloaded release in online mode and is no longer erased in certain scenarios, preventing the loss of locally stored releases.latest
folder, which contained the extracted destination release, has been renamed tofiles
and moved totmp/
.tmp/releases
folder has been created to store the downloaded release in online mode.tmp/modules
folder has been created to store module ZIP files and migration scripts (previously located at the root oftmp/
).These changes enhance the reliability of the update process and optimize the organization of temporary files.
Directory structure before/after:
Before:
After: