diff options
author | Aleksander Machniak <alec@alec.pl> | 2021-10-24 16:53:47 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2021-10-24 16:53:47 +0300 |
commit | 8a4eecbcb00eea109c0bd24475e08036ae698eac (patch) | |
tree | cbbaf5437c9dce26439cf58e0169c3581a181b2a | |
parent | a9e096e87f006815a452e9a34ad07287f8e94088 (diff) |
Don't write stats info to console.log when in CLI
If the file was created by the web server user, user executing the CLI command
might have no permissions. This leads to an error, and e.g. when installing
a plugin/skin via composer is converted to an ugly exception. We want to prevent that.
Anyway, these stats are most useful for the webmail use not for CLI commands.
-rw-r--r-- | program/include/rcmail.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php index f88626570..f12fabc28 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1186,6 +1186,12 @@ class rcmail extends rcube $this->address_books = []; + // In CLI stop here, prevent from errors when the console.log might exist, + // but be not accessible + if (php_sapi_name() == 'cli') { + return; + } + // write performance stats to logs/console if ($this->config->get('devel_mode') || $this->config->get('performance_stats')) { // we have to disable per_user_logging to make sure stats end up in the main console log |