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

Make joomlatools-console home configurable #120

Closed
Hermsi1337 opened this issue May 11, 2020 · 1 comment · Fixed by #123
Closed

Make joomlatools-console home configurable #120

Hermsi1337 opened this issue May 11, 2020 · 1 comment · Fixed by #123
Milestone

Comments

@Hermsi1337
Copy link
Contributor

Hermsi1337 commented May 11, 2020

Describe your environment

  • OS: Linux
  • Joomla version: 3
  • Joomlatools Console version: v1.5.6
  • Are you working on the Joomlatools Vagrant box: no

Describe the problem:

The joomlatools-console determines it's home directory by using the pre-defined $HOME variable, which is okay in most cases.
In our case, we're running the console in a managed-hosting environment, where the $HOME-directory is NOT writable, which results in an error when running the joomla command.

It would be great, if there is a way to configure the home directory for joomlatools-console by using a variable equivalent to COMPOSER_HOME. Maybe JOOMLATOOLS_CONSOLE_HOME?

I'm thinking about adjusting the getConsoleHome()-function like that:

    /**
     * Get the home directory path
     *
     * @return string Path to the Joomlatools Console home directory
     */
    public function getConsoleHome()
    {
        $home = getenv('HOME');
        if (getenv("JOOMLATOOLS_CONSOLE_HOME") !== "") {
            $home = getenv("JOOMLATOOLS_CONSOLE_HOME");
        }
        return rtrim($home, '/') . '/.joomlatools/console';
    }

Doing it that way we should also ensure backwards-comaptibility.
Since I'm not very familiar with best-practice-php-programming I'm open for suggestions.

Steps to reproduce:

  1. Install joomlatools-console to a managed-hosting environment, e.g. mittwald
  2. Run any command

Observed Results:

  • Error: /path/to/home is not writable

Expected Results:

  • That it's possible to override the default home for joomlatools-console.
@stevenrombauts
Copy link
Member

@Hermsi1337 This is a great suggestion and would make a lot of sense to be able to overwrite the default HOME directory. The fix you suggest should work great! Feel free to send that in as a PR.

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 a pull request may close this issue.

3 participants