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

scan root fix #12

Closed
wants to merge 1 commit into from
Closed

scan root fix #12

wants to merge 1 commit into from

Conversation

Konrad90
Copy link

I actually wanted to fix windows by splitting at slashes and backslashes:

$directories = preg_split("/(\\\\|\\/)/", Yii::getAlias($this->module->root));

But why even go to parent directory?

I actually wanted to fix windows by doing preg_split("/(\\\\|\\/)/" instead of explode.
But why even go to parent directory?
@lajax
Copy link
Owner

lajax commented Feb 27, 2015

I would have preferred to fix this error long ago, but since the optimizer deletes non-detected language elements (it would be quite problematic if translations would be lost just because I change some core components of the system), I decided to release the fix with version 2.0 only.

One good workaround in the current version is to set @web as 'root'.

The reason I stepped back to the parent directory is because in the case of the advanced version, there isn't a single alias that points to the 'root' of the whole project.
In the case of the basic version, @app practically equals 'root'. In the case of the advanced version, @app (which is the default 'root' of the TranslateManager module) is only the 'root' of the current application. To make the whole project scannable in a single cycle, I stepped back to the parent directory.

In version 2.0 the 'root' will become 'roots' and will expect an array.

'roots' => [
    '@frontend',
    '@backend',
    '@common',
    '@vendor',
    '@app',
    // ...
]

Thank you for the fix.

@Konrad90
Copy link
Author

Okay, thanks for your clarification.

@Konrad90 Konrad90 closed this Feb 27, 2015
lajax added a commit that referenced this pull request Feb 27, 2015
@lajax lajax mentioned this pull request Sep 10, 2015
@moltam moltam mentioned this pull request Nov 22, 2015
@dantux
Copy link

dantux commented Apr 4, 2016

Hey lajax, does the "root" take only aliases? Can't I just give it a hard coded path?
I am using a modified advanced Yii2 template with the structure like this:

/home/me/mywww/_appProtected
/home/me/mywww/public_html/app

So my protected folder is outside the public web folder.

I have an alias set up like this in /home/me/mywww/_appProtected/config/main.php
Yii::setAlias('appPath', dirname(dirname(__DIR__)));
which is confirmed to point to /home/me/mywww/_appProtected. If I could scan that directory, I would be happy; but if I set the 'root' to '@apppath' in common/config/main.php, it goes to the parent directory (/home/me/mywww/) where I have other projects. If I set it to '@frontend' (which is under /home/me/mywww/_appProtected/frontend), is not finding anything except a few items in the "language" and "arrray" categories. :(
What am I doing wrong?
And when is version 2 coming out? As you can see, I will need to scan two different locations for this app.

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 this pull request may close these issues.

3 participants