.
*
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
*/
if ( ! defined( 'ABSPATH' ) ) {
die( 'Kangaroos cannot jump here' );
}
class Ai1wm_Export_Download {
public static function execute( $params ) {
// Set progress
Ai1wm_Status::info( __( 'Renaming export file...', AI1WM_PLUGIN_NAME ) );
// Open the archive file for writing
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
// Append EOF block
$archive->close( true );
// Rename archive file
if ( rename( ai1wm_archive_path( $params ), ai1wm_backup_path( $params ) ) ) {
$blog_id = null;
// Get subsite Blog ID
if ( isset( $params['options']['sites'] ) && ( $sites = $params['options']['sites'] ) ) {
if ( count( $sites ) === 1 ) {
$blog_id = array_shift( $sites );
}
}
// Set archive details
$file = ai1wm_archive_name( $params );
$link = ai1wm_backup_url( $params );
$size = ai1wm_backup_size( $params );
$name = ai1wm_site_name( $blog_id );
// Set progress
if ( ai1wm_direct_download_supported() ) {
Ai1wm_Status::download(
sprintf(
__(
'' .
'Download %s' .
'Size: %s' .
'',
AI1WM_PLUGIN_NAME
),
$link,
$name,
$file,
$name,
$size
)
);
} else {
Ai1wm_Status::download(
sprintf(
__(
'' .
'Download %s' .
'Size: %s' .
'',
AI1WM_PLUGIN_NAME
),
$name,
$file,
$name,
$size
)
);
}
}
do_action( 'ai1wm_status_export_done', $params );
if ( isset( $params['ai1wm_manual_backup'] ) ) {
do_action( 'ai1wm_status_backup_created', $params );
}
return $params;
}
}