Introduce FR_EXEC_PROBE config constant (WorkerLauncher + controllers)#113
Open
Giermann wants to merge 3 commits intoerror311:masterfrom
Open
Introduce FR_EXEC_PROBE config constant (WorkerLauncher + controllers)#113Giermann wants to merge 3 commits intoerror311:masterfrom
Giermann wants to merge 3 commits intoerror311:masterfrom
Conversation
Added checks to suppress warnings for shell execution and refined conditions for determining executable PHP CLI.
Add runJobInRequest method to handle file and folder transfers synchronously when no workers can be spawned. Enhance error handling and job status updates.
Add runJobInRequest method for synchronous folder transfer.
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.
Add a new config constant
FR_EXEC_PROBE(default:true). When set tofalse, FileRise treats exec/shell_exec as completely unavailable, regardless of whatisFunctionEnabled()reports.Changes to
WorkerLauncher:resolvePhpCli(): returnnullimmediately whenFR_EXEC_PROBE === false, before any filesystem checkscanSpawnBackground(): addFR_EXEC_PROBE === falseguard; also callresolvePhpCli()to verify a working binary actually existscanRunForeground(): addprefersSync()short-circuit (no exec needed in sync mode); addFR_EXEC_PROBE === falseguard; callresolvePhpCli()to verifyhasShell(): add@operator tois_file('/bin/sh')andis_executable('/bin/sh')to suppress open_basedir warnings before they reach the custom error handlerChanges to
FileControllerandFolderController:runJobInRequest()private method that executes file/folder move and copy operations synchronously in-request viaFileModeldirectly (for files) and viaFolderController::moveFolder()with output buffering (for folders). Sets the job file to "done" or "error" on completion.enqueueTransferJob(): add an early guard beforespawnWorker()- if!canSpawnBackground() && !canRunForeground(), callrunJobInRequest()directly instead of spawning a worker.runJobInRequest()as a second fallback after a failed spawn attempt, so that unexpected spawn failures on other restricted hosts are handled gracefully too.FileController::transferJobStart(): respectFR_WORKER_MODE=syncby setting$payload['async'] = !WorkerLauncher::prefersSync(). When sync mode is active, capture the response viaob_start()/ob_get_clean()and wrap it in a job-compatible envelope (ok,jobId,status: done) so the frontend poll loop receives the expected structure.FileController::downloadZip(): add an early guard - if no exec is available and format iszip, fall back to synchronousFileModel::createZipArchive()(pure PHP, no exec needed). For7zformat, return a clear 501 error immediately instead of timing out.FileController::thumbnail(): replace!function_exists('exec')with!WorkerLauncher::canRunForeground()and return HTTP 204 (no content) instead of 501, so the browser silently skips the thumbnail without showing an error to the user.To use on a restricted shared host, add to
config.php: