• hi again. i’m indonesia and not well in english. i’ve many times googling and didn’t found any ways. i’ve develop a plugin, simple plugin, same as before but different problem.

    i’ve put a code to create table when plugin install and drop it when uninstall, and the question is there any ways to create or generate plugin table into sql.zip before it dropped and available for download?

    thanks and again, sorry for my bad english.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    If you can call exec() on your server, run mysqldump then use the ZipArchive class to add the .sql file to a .zip archive.

    If not, you could create a CSV file using the SELECT … INTO OUTFILE syntax and zip that. To create a .sql file without exec(), I believe you would need a good understanding of the format specification and then create your own script to generate the output. This may be fairly easy if the script only needs to work for one specific table, nothing changes except the CSV portion.

    Thread Starter Rahendra Putra K?

    (@rahendz)

    when in my server has phpmyadmin that actually can export into .sql or .zip is there any possible that exec() could be called?

    Moderator bcworkz

    (@bcworkz)

    There is no relationship between the two, though the presence of myPhpAdmin likely means mysqldump is available. The exec() function is often disabled in shared hosting environments for security reasons.

    Try a simple test (assuming ‘whoami’ is a valid command on your server, it should be on Linux systems). Save the following script in a .php file on your server, then request the file from your browser:

    <?php
    // outputs the username that owns the running php/httpd process
    // (on a system with the "whoami" executable in the path)
    echo exec('whoami');
    ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘generate sql.zip from db when deactivating’ is closed to new replies.