public static function execute( $params ) { // Set progress Ai1wm_Status::info( __( 'Connecting to Google Drive...', AI1WMGE_PLUGIN_NAME ) ); // Open achive file $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) ); // Append EOF block $archive->close( true ); // Set Gdrive client $gdrive = new ServMaskGdriveClient( get_option( 'ai1wmge_gdrive_token' ), get_option( 'ai1wmge_gdrive_ssl', true ) ); // Get or Create folder $folder = $gdrive->listFolder( ai1wm_archive_folder() ); if ( isset( $folder['items'] ) && ( $item = array_shift( $folder['items'] ) ) ) { $folder = $item; } else { $folder = $gdrive->createFolder( ai1wm_archive_folder() ); } // Upload resumable $params['uploadUrl'] = $gdrive->uploadResumable( ai1wm_archive_name( $params ), ai1wm_archive_bytes( $params ), $folder['id'] ); return $params; }