Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override temporrary directory #28

Closed
josephdpurcell opened this issue Apr 4, 2019 · 7 comments
Closed

Override temporrary directory #28

josephdpurcell opened this issue Apr 4, 2019 · 7 comments
Labels
needs more information Further information is requested

Comments

@josephdpurcell
Copy link
Collaborator

josephdpurcell commented Apr 4, 2019

Problem

After running phpstan, it tries to write it’s cache to the temporary directory, which is by default sys_get_temp_dir() . '/phpstan'. This may be an issue on filesystems that only have specific directories that are writable.

Proposed Resolution

Allow overriding the phpstan tmp directory.

@josephdpurcell
Copy link
Collaborator Author

Note: this is where phpstan looks for the tmpdir: https://github.com/phpstan/phpstan/blob/master/src/Command/CommandHelper.php#L104

@josephdpurcell
Copy link
Collaborator Author

You can set the tmpDir by modifying phpstan/base_config.neon and adding this line:

parameters:
    tmpDir: '/my/directory'

However, this requires modifying the drupal-check source, which not super flexbile.

Given that PHPSTan wants a single project file config (see CommandHelper), it would be difficult to expose a parameter to the drupal-check CLI that lets someone pass their own config file. The user would need to know what configs to put in their neon file.

@mglaman mglaman added the needs more information Further information is requested label Apr 27, 2019
@mglaman
Copy link
Owner

mglaman commented Apr 27, 2019

What was the use case for this? Did people not have a writeable tmp directory?

@josephdpurcell
Copy link
Collaborator Author

I believe it had to do with containers and not having /tmp available. One suggestion was to use the temp directory of the Drupal install being inspected.

@mglaman mglaman added this to Needs triage in Issue triage May 3, 2019
@adamfranco
Copy link

I have a need to change the temp path as well from the default of /tmp/phpStan/. I use drupal-check on a multi-user linux dev machine. When one of my teammates runs drupal-check it causes /tmp/phpStan/ to be filled with files owned by them. When I later go to run drupal-check I get permission errors due to ownership of the files in /tmp/phpStan/ and need to use the root account to delete the other user's temporary files before I can run it.

I'd like to be able to pass a temporary directory specific to my user account (either in my home directory or just /tmp/username-phpStan/ so that my execution of drupal-check isn't blocked by others'.

@mglaman
Copy link
Owner

mglaman commented Feb 22, 2021

@adamfranco you should use phpstan directly probably and not use drupal-check to have more customization.

@mglaman
Copy link
Owner

mglaman commented Feb 3, 2022

I've decided that this problem will not be fixed in drupal-check. Use PHPStan directly.

@mglaman mglaman closed this as completed Feb 3, 2022
Issue triage automation moved this from Needs triage to Closed Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more information Further information is requested
Projects
Issue triage
  
Closed
Development

No branches or pull requests

3 participants