Repository navigation
Conversation
…public root of the website
mvdhoek1
reviewed
Oct 26, 2026
mvdhoek1
left a comment
Collaborator
There was a problem hiding this comment.
Graag ook nog documentatie van PREFILL_GRAVITY_FORMS_LOG_DIR en de pg::logger/log_directory filter.
| * | ||
| * @return mixed|string|null | ||
| */ | ||
| private function getLogFilePath() |
Collaborator
There was a problem hiding this comment.
Is dit niet iets eenvoudiger en zonder gebruik van env vars:
/**
* The default dirname(ABSPATH) resolves to the public webroot when WordPress
* is installed in a subdirectory (e.g. Bedrock), so allow overriding it.
* Returns null when the directory is invalid, in which case file logging is skipped.
*/
private function getLogDirectory(): ?string
{
$directory = defined('PREFILL_GRAVITY_FORMS_LOG_DIR') ? PREFILL_GRAVITY_FORMS_LOG_DIR : dirname(ABSPATH);
$directory = apply_filters('pg::logger/log_directory', $directory);
if (! is_string($directory) || '' === $directory || ! is_dir($directory) || ! is_writable($directory)) {
/** This action is documented in src/PrefillGravityForms/Traits/Logger.php */
do_action('pg::exception/intercept', new Exception(sprintf('Log directory "%s" does not exist or is not writable, file logging is disabled.', is_string($directory) ? $directory : gettype($directory)), 300), 'warning');
return null;
}
return untrailingslashit($directory);
}
Contributor
Author
|
Als jullie een betere/mooiere oplossing hebben, ga je gang :) als ik/we uiteindelijk die files maar buiten de webroot kunnen plaatsen :) Dank je wel. |
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.
Issue on composer based websites, probably also applicable on other plugins.
The default log file location
dirname(ABSPATH)resolves topublic_htmlwhen WordPress is installed in a subdirectory, as is normal when installing with composer.This patch allows 3 methods of moving the log files to a secure location.