ewels / Labrador

A web based tool to manage and automate the processing of publicly available datasets.
https://www.bioinformatics.babraham.ac.uk/projects/labrador/
GNU General Public License v3.0
37 stars 9 forks source link

Ajax test fails if labrador webroot is accessed via a symlink #18

Closed s-andrews closed 5 years ago

s-andrews commented 5 years ago

Just wanted to share the fruits of my painful morning :-)

On a newly built server an otherwise fully functional labrador wouldn't look up data in the SRA to add new datasets. The javascript function was triggered but the data returned from sra_get_datasets.php was null so it all just hung.

I eventually worked out that nothing was being called in sra_get_datasets.phpbecause of the test there to see if the file was being called as part of an ajax call. The test was:

if(__FILE__ == $_SERVER['SCRIPT_FILENAME']) {

On our system Labrador was installed at /srv/Labrador-0.2 and then there was a symlink linking this to /srv/labrador, and this was the webroot.

On this system the value of __FILE__ was /srv/Labrador-0.2/ajax/sra_get_datasets.php and $_SERVER['SCRIPT_FILENAME'] was /srv/labrador/ajax/sra_get_datasets.php so the test which should have passed actually failed, and stuff went bad from there on.

Not sure what the correct fix is supposed to be but I'll do some more digging.

s-andrews commented 5 years ago

OK, found it. Merge request incoming...

ewels commented 5 years ago

Thanks for the fix! 👍