[3.0] Implement File System handler#8801
Open
jdarwood007 wants to merge 7 commits intoSimpleMachines:release-3.0from
Open
[3.0] Implement File System handler#8801jdarwood007 wants to merge 7 commits intoSimpleMachines:release-3.0from
jdarwood007 wants to merge 7 commits intoSimpleMachines:release-3.0from
Conversation
This introduces a file system handler for package manager, bringing in FTPS and SFTP support to our package manager operations. FTPS is handled with PHP ftp library and SFTP is handled with Phpseclib (MIT License). This simplifies and centralizes the logic for determining how to perform file system operations by using the root as a substitution for the boarddir. The test page has been changed from xml supported to json and most of the logic moved into admin.js. The settings page now operates as config vars. Not sure why it wasn't ever this way. The legacy FtpConnection was moved to basically be a wrapper for the new file system caller. I didn't want to remove it as it needs to remain backwards compatible. The code for Maintenance was updated, but since none of our tools yet use it, the logic is only in theory based on matching changes. Additionally, I had no luck getting FTP stuff to work before hand. I made changes until things started to operate. I also tried to support using ssl:// like we did before, but this never worked for me, so I forced the use of the dedicated FTPS logic. If anyone is able to get it to work, we can better identify the file system handlings. Finally, I know there is leagues's file system (MIT License) handler that does FTP(s), SFTP, Webdav and a few others. I thought about using it, but the only additional library I see useful for SMF to support would be webdav. If we want to redirect to using it, then we can.
live627
reviewed
Jul 25, 2025
|
|
||
| // Hold on, do we have a 'ssl://' or 'ftps://' in the server name? | ||
| if (str_starts_with(Config::$modSettings['package_server'], 'ssl://') || str_starts_with(Config::$modSettings['package_server'], 'ftps://')) { | ||
| $server_addr = preg_replace('~^((ft|htt)ps?|ssl)?://~i', '', Config::$modSettings['package_server']); |
Contributor
There was a problem hiding this comment.
This regex also matches ://. Is this intentional?
Member
Author
There was a problem hiding this comment.
It wasn't intended, but I am also now wondering, would it be harmful? Ideally, we strip out any schema from the provided server address.
live627
reviewed
Jul 25, 2025
| * @param string $ftp_file The file to CHMOD | ||
| * @return bool Whether or not the operation was successful | ||
| */ | ||
| public function changePermissions(string $filename, string $chmod): bool |
Remove debug code.
# Conflicts: # Sources/Maintenance/Tools/ToolsBase.php # Sources/PackageManager/FtpConnection.php # Sources/PackageManager/PackageUtils.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This introduces a file system handler for package manager, bringing in FTPS and SFTP support to our package manager operations.
FTPS is handled with PHP ftp library and SFTP is handled with Phpseclib (MIT License). This simplifies and centralizes the logic for determining how to perform file system operations by using the root as a substitution for the boarddir.
The test page has been changed from xml supported to json and most of the logic moved into admin.js.
The settings page now operates as config vars. Not sure why it wasn't ever this way.
The legacy FtpConnection was moved to basically be a wrapper for the new file system caller. I didn't want to remove it as it needs to remain backwards compatible.
The code for Maintenance was updated, but since none of our tools yet use it, the logic is only in theory based on matching changes.
Additionally, I had no luck getting FTP stuff to work before hand. I made changes until things started to operate. I also tried to support using ssl:// like we did before, but this never worked for me, so I forced the use of the dedicated FTPS logic. If anyone is able to get it to work, we can better identify the file system handlings.
Finally, I know there is leagues's file system (MIT License) handler that does FTP(s), SFTP, Webdav and a few others. I thought about using it, but the only additional library I see useful for SMF to support would be webdav. If we want to redirect to using it, then we can.
Fixes #5316