Skip to content

Disable application cache with APP_CACHE_DIR and APP_LOG_DIR ? #3517

@drupol

Description

@drupol

Hello,

I'm in the process of integrating phpDocumentor into Nix. While a detailed explanation of how Nix functions isn't necessary for this discussion, don't hesitate to ask any questions in the thread if this is not the case, I'll be glad to answer them.

When phpDocumentor is installed using Nix, the files are placed into an immutable (read-only) store. This results in all files and directories of the application being read-only.

As phpDocumentor is a Symfony-based application, it necessitates the creation of a var/ directory to store cache when running.

Users can modify the cache directory by altering the APP_CACHE_DIR environment variable, and the log directory by changing the APP_LOG_DIR variable.

I've attempted to run phpDocumentor while adjusting the location of these variables. However, it persistently defaults to using var/.

This make sense since it is hardcoded in kernel.php.

In the default Symfony kernel, those environment variables are not ignored.

I guess adding a very simple condition should fix the issue.

Expected behavior

The application should use APP_CACHE_DIR and APP_CACHE_LOG.

Actual behavior

The application keeps writing in its own var/ directory and ignore APP_CACHE_DIR and APP_CACHE_LOG.

Steps to reproduce the problem

You can test by yourself by doing:

APP_CACHE_DIR=/tmp/foo/cache APP_LOG_DIR=/tmp/foo/log ./bin/phpdoc

Your environment

Linux

  • Version used: 3.3.1
  • Install method: git clone
  • PHP version: 8.1
  • Operating system and version (e.g. Ubuntu 20.04, Windows 10): NixOS 23.05

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions