Gossamer Forum
Quote Reply
User cgi directory?
Has anyone had any luck getting a plugin to extract a file into the users cgi directory?

If you select the user cgi directory with the Plugin Wizard it trys to extract the file to:
Code:
$CFG->{admin_root_path}/../
which errors out on my server. My next thought was to manually direct it there, however, unless I am totally missing something, Links is only saving the user cgi URL, not the path... Making an extraction to that directory impossible.

Am I missing something here?

AlexJ

Quote Reply
Re: User cgi directory? In reply to
The short answer is "yes"

The reason for doing:

"$CFG->{admin_root_path}/../"

Is that that is the _ONLY_ way to know where the file will go on other peoples system. That is the "admin" directory, one step up.

The "path" to the User CGI directory is not stored, only the URL as

< % db_cgi_url % >


I have files extracting on multiple servers. The biggest problem is permissions, since the User CGI directory is usually installed as the webmaster, not the server, the server can't install into it unless the permissions are changed.





PUGDOG Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: User cgi directory? In reply to
Pugdog,

Thanks for your reply. Apparently it was one of those cases of me either trying to work to late or too early... Crazy

Now that I've gotten some rest I can clearly see the logic here. I'll just trap that extraction with a 'check permissions on your user cgi directory' error message.

AlexJ

Quote Reply
Re: User cgi directory? In reply to
It's a good idea in the pre_install function in your Install.pm to check to see if the directory is writeable. You can do something:

if (! -w "$CFG->{admin_root_path}/../") {
$error .= "We are not able to write to your user cgi directory. Please set permissions to 777 temporairly so that installation can proceed.";
}
return $error;

Or somehow put the error notice into preinstall so the user can fix it before the installation.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: User cgi directory? In reply to
Great idea..... Thanks! In fact I've tested it all out now, and it works like a charm with a tiny change:
Code:
if (! -w "$CFG->{admin_root_path}/../") {
my $error .= "We are not able to write to your user cgi directory. Please set permissions to 777 temporairly so that installation can proceed.";
return $error;
}
AlexJ