Closed mrfatguy closed 11 years ago
Maybe, your directory structure is no problem. But perhaps, I guess that your protected directory doesn't have yiic* files. If so, please add their files (at least yiic.php).
Please see also https://github.com/nbphpcouncil/nb-yii-plugin/issues/23
Thanks!
Is it completely necessary? Your plugin is not configured to read Yii Framework location from index.php
and use yiic.php
from there?
I have all my projects configured to reference Yii that is stored not only outside project's files, but also outside web accessible directory. I consider keeping yiic*
files inside protected
directory as a security leak (small, but still).
If this is the issue (I'll be able to verify this tomorrow), you should strongly consider updating your plugin, so it read yiic*
files location from project's index.php
file.
yiic.php
is used with run command action.
And for checking yii framework project.
If it is really problem, I think that you should say not here but to yii framework because protected directory has yiic.php
with default.
If you need not "Run Command" action, put simply empty yiic.php
file to protected directory.
There are many things to discuss here, so let me write in points:
yiic.php
and other yiic*
files to protected
folder is only for your (developer) convenience. Your application will work just fine, even with these files removed. I don't use them at all (copy of these files from protected
folder, if I need yiic
command, I use files from framework's folder), so I removed them. And, of course my application works without any problems, even without these files. If you look into yiic.php
file contents, you'll see, that it is just a wrapper, that is actually refering to yiic.php
file inside framework folder.Run Command
, then I suggest you simply add check, if these files exists in protected
folder, and if not, then simply don't add Run Command
to menu or make it grayed (disabled, not available to user).yiic.php
is not the problem here. I can copy it (empty or original) to protected
folder and there is no effect (no branding, no extra functions). I think, yiic
file is the problem. When I copy it to protected
folder, as you advised me, I get branding and functions, but for some reason my Netbeans crashes, throws exception java.lang.NullPointerException
(details below) and I can't see project's contents, as the only child node of such project is Please Wait...
.I don't know, why this happens only on my projects -- i.e. those, where yiic
file were previously removed and now I copied them back to protected
folder. Anyway, problem seems to be in your plugin. Here you have a complete execption report:
java.lang.NullPointerException
at org.nbphpcouncil.modules.php.yii.YiiPhpFrameworkProvider.getConfigurationFiles(YiiPhpFrameworkProvider.java:142)
at org.netbeans.modules.php.project.PhpProject.hasConfigFiles(PhpProject.java:491)
at org.netbeans.modules.php.project.ui.logicalview.ImportantFilesNodeFactory$ImportantFilesChildrenList.keys(ImportantFilesNodeFactory.java:122)
at org.netbeans.spi.project.ui.support.NodeFactorySupport$DelegateChildren$1.run(NodeFactorySupport.java:202)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)
This happens everytime, if yiic
file is present in protected
folder, no matter, if it contains anything or is empty. There's always above exception and removing this file from protected
folder is currently the only option to be able to work with my projects. But -- of course -- without this file, I don't have branding and your plugin functionality.
To summarize everything, I think you should update your plugin, so it will not need yiic*
files in protected
folder. If these are only required for Run Command
menu option, then this option should be disabled or hidden, if these files are missing. But branding and plugin functionality should be available, even without these files.
At first, requests and proposals, e.t.c. are always welcome for us. Basically, we assume that user uses with default. If user has issues, we'll improve them as much as possible. Actually, I have improved many issues.
But you should consider way of speaking (your approach) again. Don't forget this plugin is not for a fee.
The reason for your NPE: Your protected directory doesn't have config directory (This is not default). I'll fix this NPE.
I'm sorry. I wrote "at least yiic.php
" . This is wrong. It is not yiic.php
but yiic
.
Sorry, if my approach or way of speaking offends you. That was not my point at all. I understand, that you're developing this plugin free (or in exchange for a donate, but this does not happens to often, right) and in your spare time.
Thank you for all the effort, you have already done for us (Yii community) with this plugin.
BTW: Yes, I have non-standard configuration
folder instead of config
, but I have updated yiic
and yiic.php
files to point to correct file (configuration/console.php
). Beside, you said, that I can use an empty yiic
file, so I thought that your plugin only needs to have this file in protected
, but is not using it (reading anything from it).
Anyway, as I said, all you have done is great and I'm very grateful for this and for your work. Thanks!
You are welcome! We just would like to improve user's issues :)
I have a idea about yiic* files.
I'll add a new option enabled
to project properties. You can be enabled manually if you don't have them.
If user has yiic* files, plugin will be enabled automatically. But please notice that the plugin might not work if you change folder names and structure. (You can't run Run Command
action if protected folder doesn't have yiic.php)
But I would like to avoid adding settings for config folder name. If we implement this, there might be people who think that would like to set other folder name. This will be more complex. Perhaps I think that it's no problem for you. The reason plugin uses config folder is for Important Files node. If plugin can't find config folder, perhaps, Important Files node is just empty.
There is the path to yiic.php
on Options (Tools > Options > PHP > Yii).
But plugin is using protected/yiic.php
for Run Command action since Yii version might be different each Yii project.
So, I'll try the followings:
Thanks for reporting!
If I understand you correctly, all yiic*
files as well as config
(default name) folder are only required for using Right-click project > Yii > Run Command
. All other functions, your plugin offers does not need these files. Am I right?
If yes, then why don't you simple (as I proposed) gray out (disable) this menu position, or not add them at all, if your plugin will not find yiic*
files or config
folder.
Current version of plugin requires that you have yiic
files inside your protected
folder and that your configuration folder is named by default config
. If developer change anything of that, he will not be able to use your plugin, even if he is not using console command at all. In worst scenario, plugin will crash.
I'm not sure if adding enabled
to project properties will solve this problem? Actually I don't understand, how you think this will help? Why don't you try the simplest way. In every part of your plugin source code, that requires protected/yiic*
files or protected/config
folder add a simple if
checking if these necessary elements exists. If not, simply not execute following code and don't add functionality that requires these files (currently only Run Command
, if I'm not mistaken). This way, plugin won't crash with NPE and other functions (that don't need these files) will be available.
I understand, that running console command might be very important to other users, but I believe that there is also a large group (like me), who doesn't use this functionality at all, but would like to use other things from your plugin.
As I wrote in one of first posts, I have noticed Tools > Options > PHP > Yii
and even set it for a correct location of yiic
file (inside yii
folder). But this does not changed anything. At least I haven't noticed any changes.
I wrote at the above.
Basically, we assume that user uses with default. If user has issues, we'll improve them as much as possible.
Sorry, I'm not sure what you want to say exactly. I haven't done anything yet. Why can't you wait?
I'm fixing and checking features.
User can't other config folder name instead of protected/config
.
i.e. User has to use protected/config
.
If user uses other folder name, probably, some features don't work.
(perhaps, can't go to a view file for theme)
I'll upload a new nbm for testing after I fixed.
I have uploaded a new nbm to the following: https://bitbucket.org/junichi11/nb-yii-plugin/downloads org-nbphpcouncil-modules-php-yii-0.4.1.2-for-testing-issue33-otherwise-please-don't-download.nbm
Try to test it.
If protected directory doesn't have yiic* files, you can be enabled by checking enabled
on project properties.
Run Command
when protected/yiic.php
file & PHP > Yii
script path don't exist (if protected/yiic.php
doesn't exit, uses Tools > Options > PHP > Yii > script path
for Run Command
action)I think, that everything is OK in tested version.
I did only a quick tests. I'll be able to do some more detailed on Monday, but right now I don't see any problems with updated version of your plugin.
Thanks for testing.
I'll add this feature to version 0.4.2.
I did exactly as advised to (downloaded and installed). And I can't reproduce any plugin features, nor I don't see Yii branding on my project name.
Upon further investigation, I noticed, that this could happen due to my application have source directory structure different than base-app, auto-generated, pure Yii application directory structure.
But in the readme.md you have wrote only about two cases:
a) Source Directory has structure exactly like base Yii application (and Webroot shouldn't be changed), b) Source Directory contains other directories (like foo, bar), but entire Yii application is put **inside subdirectory_ (
testdrive
in your example).What about third case, where Yii aplication is put into Source Directory, but it also contains other directories, directly in Yii app root? I have this case, and I'm pretty sure, that this is causing that I don't see your plugin (Yii) branding and that your plugin's functionality does not work for me in this case.
For example, I have this directory structure (Source Directory):
As you can see, my application is put directly under Source Directory, but it's directory structure differs from original Yii application. There is no
index-test.php
file nornbproject
directory (project's properties are kept outside application) and nothemes
directory (I don't use them at all). There are some additional dirs, likefiles
.If I'm not mistaken, this is main cause of the problem. But there also have to be some additional problem, because even when I have recreated original Yii app structure (temporarily removed extra files and added missing ones) and restared Netbeans, my project hasn't got Yii branding and functions provided by your plugin still doesn't work.
Do you have any idea, what can be wrong?