how do i avoid exec()

Permalink
I uploaded my add-on package.

Screen said,

'exec("lha e ken_all.lzh")' on line 11 in xxxxx/controllers/dashboard/xxxxx/upload.php

"lha" is a Japanese popular file archive tool command, it likes zip/unzip

I want to execute on concrete5. How should I make code?

tomoac
 
goutnet replied on at Permalink Reply
Is there any lha binding for PHP instead?
tomoac replied on at Permalink Reply
tomoac
No, It is only linux command.
JohntheFish replied on at Permalink Reply
JohntheFish
If a php binding is not available and lha is absolutely necessary, an exemption can be granted.

A more important question is: How can you be sure lha is available on the web host? whether through exec or through a php binding.
tomoac replied on at Permalink Reply
tomoac
Lha command install by myself to my server.
I want to execute by exec() etc. as shell.
It can execute by shell and can get file, it is very good.
However, when I uploaded this package, i met that message.
JohntheFish replied on at Permalink Reply
JohntheFish
For a marketplace addon, the requirement for lha to be installed on the server will need to be made very very clear on the marketplace and docs pages. We wouldn't want sites installing an addon that subsequently fails because lha is not installed on their server.

This is irrespective of whether exec or a php binding is used to interface to lha.

With such precautions in place, the PRB may grant an exemption to the automated test if there is no other solution other than using exec().

For the PRB you would need to justify:
- That there was no alternative to exec().
- Why lha rather than a more universally supported format such as zip.
- If lha, is it in addition to zip or instead of zip?
- What happens to sites that do not have lha available?
goutnet replied on at Permalink Reply
Well, the main point is that

1. that package would only work on Linux
2. and only if you install manually the command.

Two arguments to make that one bleeding edge to me.

Beside that, we can grant an exception if needed.
tomoac replied on at Permalink Reply
tomoac
ok! I will give up to use.

How do I use zip/unzip on concrete5?
JohntheFish replied on at Permalink Reply
JohntheFish
You can call direct from php

http://php.net/manual/en/book.zip.php...
tomoac replied on at Permalink Reply
tomoac
Thank you very much.

I want to know next.
After unziped file that is .csv, I want to insert to the database.
How do I read csv file on concrete5?
JohntheFish replied on at Permalink Reply
JohntheFish
See
http://php.net/manual/en/function.fgetcsv.php...

To use that on a file, you may need an exception to the automated tests as the tests expect use of the c5 file helper.
tomoac replied on at Permalink Reply
tomoac
I want to use helper where url on specification can I see?