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

New parameter %rootDir% #61

Closed
fprochazka opened this issue Feb 26, 2015 · 2 comments
Closed

New parameter %rootDir% #61

fprochazka opened this issue Feb 26, 2015 · 2 comments

Comments

@fprochazka
Copy link
Contributor

@fprochazka fprochazka commented Feb 26, 2015

One of the very few things that prevents Nette application from beeing compiled before deployment (and therefore using it on readonly filesystems) are hardcoded absolute paths in DI Container.

Now imagine if you were to tell the container the root directory of the project.

// this ofcourse could be autoresolved by default, but the setter should be available
$configurator->setRootDir(dirname(__DIR__)); //  dirname(%appDir%)

Now that we have the absolute path, we can set the value "dynamically"

class SystemContainer
{
    public function __construct()
    {
        parent::__construct(array(
            // ....
            'rootDir' => __DIR__ . '/../..',
        ));
    }
}

and the strings in generated container that contain the rootDir string can be replaced with the dynamic value

"/var/www/hosts/kdyby.org/app/../www/images"
$this->parameters['rootDir'] . "/app/../www/images"

This is merely a concept and there are other obstacles, but IMHO this is the main one. Composer uses the same concept for the generated autoloader. I think we should do it similarly.

@Majkl578

This comment has been minimized.

Copy link
Contributor

@Majkl578 Majkl578 commented Feb 26, 2015

👍
One of the blockers for HHVM RepoAuthoritative.

@f3l1x

This comment has been minimized.

Copy link
Member

@f3l1x f3l1x commented Dec 19, 2016

I like it! 👍

dg added a commit that referenced this issue Jan 29, 2017
dg added a commit that referenced this issue Jan 30, 2017
dg added a commit that referenced this issue Jan 30, 2017
@dg dg closed this Jan 30, 2017
dg added a commit that referenced this issue Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.