Unzip file in functions.php, and add it to cron

I have a file in the root folder of my wordpress installation (myfolder, wp-content, wp-config, and all other).

I want unzip a test.zip archive in my myfolder folder in root directory.

I try this function on my theme functions.php :

add_action( 'test_unzip', 'unzip_folder' );
function unzip_folder() {
    WP_Filesystem();
    $destination = '../myfolder/';
    $destination_path = $destination['path'];
    unzip_file( $destination_path.'/test.zip', $destination_path);
}

I add the action in cron to do it every 3 hours, and also to try my code. It's not work and I can't find where I failed :)

Topic functions cron php Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.