shannah / xataface

Framework for building data-driven web applications in PHP and MySQL
http://xataface.com
GNU General Public License v2.0
134 stars 57 forks source link

Add ability to override getModuleURL #85

Closed malaire closed 7 years ago

malaire commented 7 years ago

When creating a setup where I want to symlink module directories from DATAFACE_SITE_PATH/modules but keep the actual module directories outside of both DATAFACE_PATH and DATAFACE_SITE_PATH, I got error "Could not find URL for file $file in module tool" from https://github.com/shannah/xataface/blob/74489bab8391921b4cafd4ea6599d5e768afbb46/Dataface/ModuleTool.php#L159

It would be nice if I could override getModuleURL in Application Delegate Class for special setups like this.

shannah commented 7 years ago

Symlinking should work find. I'm pretty sure I've done that in the past myself. Perhaps there is a problem with permissions on the symlink, or some other aspect of how the symlink was created.

What OS are you using? If you can provide an example with precise steps of how/where symlinks were created, I might be able to comment further.

malaire commented 7 years ago

Checking the source code more closely I was able to find the problem:

I was linking DATAFACE_SITE_PATH/modules/tagger to /path-to-modules/tagger-VERSION

getModuleURL uses basename(dirname($file) which didn't work since tagger in link didn't match tagger-VERSION in real path.

What I want to do is to have central place for different modules and versions of modules, and then in each app link to what I need.

Easy fix to this was to add one extra directory and link to /path-to-modules/tagger-VERSION/tagger so the last component of real path matches module name.