Skip to content

fix: checkVarDir warnings only fired in --quiet mode after #1643#1

Open
ashtriggs wants to merge 1 commit into
OpenMage:developfrom
ashtriggs:fix/check-var-dir-verbosity
Open

fix: checkVarDir warnings only fired in --quiet mode after #1643#1
ashtriggs wants to merge 1 commit into
OpenMage:developfrom
ashtriggs:fix/check-var-dir-verbosity

Conversation

@ashtriggs

Copy link
Copy Markdown

Problem

netz98#1643 fixed the spurious Folder /tmp/magento/var found, but not used warning firing at normal verbosity even when the directory doesn't exist (good — see netz98#1642, netz98#1648, and my earlier duplicate PR netz98#1646 against the now-archived netz98/n98-magerun).

However, it also wrapped both checkVarDir() warning writeln() calls in:

if (OutputInterface::VERBOSITY_NORMAL > $output->getVerbosity()) {

Since VERBOSITY_QUIET (16) < VERBOSITY_NORMAL (32), this condition is only true when verbosity is below normal — i.e. only in --quiet mode. At normal or verbose verbosity the condition is always false, so neither warning can ever fire under everyday usage. That's the inverse of the intended behaviour: a warning about a real filesystem misconfiguration should be visible by default, not hidden unless you pass --quiet.

Fix

Drop the redundant/inverted verbosity gate. OutputInterface::writeln() already respects the output's verbosity setting on its own — the extra condition wasn't needed and was backwards. This restores both warnings (fallback-folder-in-use and folder-found-but-not-used) to firing at normal verbosity as before netz98#1643, while keeping netz98#1643's real fix (the early is_dir() return) intact.

Testing

php -l src/N98/Magento/Application.php passes. No existing unit tests cover checkVarDir() (none were added in netz98#1643 either).

…rbose

PR netz98#1643 moved the tempVarDir existence check earlier (good — fixes the
spurious warning when /tmp/magento/var doesn't exist) but also wrapped
both writeln() calls in `if (OutputInterface::VERBOSITY_NORMAL >
$output->getVerbosity())`. Since VERBOSITY_QUIET (16) < VERBOSITY_NORMAL
(32), that condition is only true in --quiet mode, so the warnings never
fire at normal or verbose verbosity — the opposite of the intended
behaviour. writeln() already respects verbosity on its own, so the extra
gate is both redundant and inverted; drop it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant