private function download_and_activate_new_version($zip_url) { if (!One_And_One_Utility::check_credentials('plugins.php', null)) { return false; } $response_body = One_And_One_Utility::get_remote_response_body($zip_url); if (empty($response_body)) { return false; } $zip_file_path = One_And_One_Wizard::get_plugin_dir_path() . 'plugin.zip'; global $wp_filesystem; $wp_filesystem->put_contents($zip_file_path, $response_body, FS_CHMOD_FILE); // delete all transient data $transience_manager = new One_And_One_Transience_Manager(); $transience_manager->erase_transient_data(); $unzip = unzip_file($zip_file_path, WP_PLUGIN_DIR); @unlink($zip_file_path); activate_plugin(One_And_One_Wizard::get_plugin_file_path()); }