/** * Copyright (C) 2014-2020 ServMask Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ */ if ( ! defined( 'ABSPATH' ) ) { die( 'Kangaroos cannot jump here' ); } class Ai1wm_Export_Content { public static function execute( $params ) { // Set archive bytes offset if ( isset( $params['archive_bytes_offset'] ) ) { $archive_bytes_offset = (int) $params['archive_bytes_offset']; } else { $archive_bytes_offset = ai1wm_archive_bytes( $params ); } // Set file bytes offset if ( isset( $params['file_bytes_offset'] ) ) { $file_bytes_offset = (int) $params['file_bytes_offset']; } else { $file_bytes_offset = 0; } // Set content bytes offset if ( isset( $params['content_bytes_offset'] ) ) { $content_bytes_offset = (int) $params['content_bytes_offset']; } else { $content_bytes_offset = 0; } // Get processed files size if ( isset( $params['processed_files_size'] ) ) { $processed_files_size = (int) $params['processed_files_size']; } else { $processed_files_size = 0; } // Get total content files size if ( isset( $params['total_content_files_size'] ) ) { $total_content_files_size = (int) $params['total_content_files_size']; } else { $total_content_files_size = 1; } // Get total content files count if ( isset( $params['total_content_files_count'] ) ) { $total_content_files_count = (int) $params['total_content_files_count']; } else { $total_content_files_count = 1; } // What percent of files have we processed? $progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 ); // Set progress Ai1wm_Status::info( sprintf( __( 'Archiving %d content files...
%d%% complete', AI1WM_PLUGIN_NAME ), $total_content_files_count, $progress ) ); // Flag to hold if file data has been processed $completed = true; // Start time $start = microtime( true ); // Get content list file $content_list = ai1wm_open( ai1wm_content_list_path( $params ), 'r' ); // Set the file pointer at the current index if ( fseek( $content_list, $content_bytes_offset ) !== -1 ) { // Open the archive file for writing $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) ); // Set the file pointer to the one that we have saved $archive->set_file_pointer( $archive_bytes_offset ); // Loop over files while ( list( $file_abspath, $file_relpath, $file_size, $file_mtime ) = fgetcsv( $content_list ) ) { $file_bytes_written = 0; // Add file to archive if ( ( $completed = $archive->add_file( $file_abspath, $file_relpath, $file_bytes_written, $file_bytes_offset ) ) ) { $file_bytes_offset = 0; // Get content bytes offset $content_bytes_offset = ftell( $content_list ); } // Increment processed files size $processed_files_size += $file_bytes_written; // What percent of files have we processed? $progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 ); // Set progress Ai1wm_Status::info( sprintf( __( 'Archiving %d content files...
%d%% complete', AI1WM_PLUGIN_NAME ), $total_content_files_count, $progress ) ); // More than 10 seconds have passed, break and do another request if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) { if ( ( microtime( true ) - $start ) > $timeout ) { $completed = false; break; } } } // Get archive bytes offset $archive_bytes_offset = $archive->get_file_pointer(); // Truncate the archive file $archive->truncate(); // Close the archive file $archive->close(); } // End of the content list? if ( feof( $content_list ) ) { // Unset archive bytes offset unset( $params['archive_bytes_offset'] ); // Unset file bytes offset unset( $params['file_bytes_offset'] ); // Unset content bytes offset unset( $params['content_bytes_offset'] ); // Unset processed files size unset( $params['processed_files_size'] ); // Unset total content files size unset( $params['total_content_files_size'] ); // Unset total content files count unset( $params['total_content_files_count'] ); // Unset completed flag unset( $params['completed'] ); } else { // Set archive bytes offset $params['archive_bytes_offset'] = $archive_bytes_offset; // Set file bytes offset $params['file_bytes_offset'] = $file_bytes_offset; // Set content bytes offset $params['content_bytes_offset'] = $content_bytes_offset; // Set processed files size $params['processed_files_size'] = $processed_files_size; // Set total content files size $params['total_content_files_size'] = $total_content_files_size; // Set total content files count $params['total_content_files_count'] = $total_content_files_count; // Set completed flag $params['completed'] = $completed; } // Close the content list file ai1wm_close( $content_list ); return $params; } } Kiến Thức Kinh Tế - Trang 8 trên 32 - Vay Tài Chính 247

Category Archives: Kiến Thức Kinh Tế

Bảo hành máy giặt Panasonic– Chính sách, thời gian, quy trình

Máy giặt Panasonic là dòng sản phẩm được nhiều người tiêu dùng Việt Nam ưa chuộng bởi chất lượng tốt, độ bền cao và giá cả phải chăng. Khi mua máy giặt Panasonic, khách hàng sẽ được hưởng chính sách bảo hành chu đáo từ nhà sản xuất. Thời gian bảo hành máy giặt Panasonic […]

Bảo hành máy giặt Aqua– Chính sách, thời gian, quy trình

Chính sách bảo hành máy giặt Aqua Máy giặt Aqua là dòng sản phẩm máy giặt được ưa chuộng tại Việt Nam. Với thiết kế đẹp mắt, nhiều tính năng hiện đại và chất lượng hoạt động ổn định, máy giặt Aqua đã chiếm được niềm tin của nhiều khách hàng. Đi kèm với sản […]

Cách sử dụng điều khiển điều hòa và khắc phục sự cố

Cách sử dụng điều khiển điều hòa hiệu quả Điều khiển điều hòa là thiết bị điều chỉnh nhiệt độ trong phòng, giúp tạo môi trường dễ chịu cho người sử dụng. Để vận hành điều hòa hiệu quả, ta cần nắm rõ các chức năng trên điều khiển và sử dụng đúng cách. Trước […]

Pivot Table là gì? Lợi ích trong phân tích dữ liệu?

Pivot Table là một công cụ quan trọng trong phân tích dữ liệu, được sử dụng rộng rãi trong bộ Microsoft Excel. Đây là một công cụ đơn giản, nhưng rất mạnh mẽ, giúp người dùng tạo báo cáo tóm tắt và phân loại dữ liệu một cách hiệu quả. Pivot Table giúp người dùng […]

Power BI là gì? Power bi Data Analyst là gì? Lợi ích, sử dụng

Power bi là gì? Power bi là một công cụ phân tích dữ liệu và khai thác thông tin mạnh mẽ được phát triển bởi Microsoft. Được phân loại là một trong những công cụ Business Intelligence hàng đầu, Power bi cho phép người dùng kết nối và tổ chức dữ liệu từ nhiều nguồn […]

Tableau là gì trong phân tích dữ liệu? Lợi ích, cách sử dụng

Tác dụng của Tableau trong phân tích dữ liệu Tableau có nhiều tác dụng quan trọng trong việc phân tích dữ liệu. Dưới đây là một số tác dụng chính của Tableau: Trực quan hóa dữ liệu Tableau cho phép bạn trực quan hóa dữ liệu một cách dễ dàng và nhanh chóng. Bằng cách […]

Query dữ liệu là gì? Các lỗi thường khi thực hiện và cách khắc phục

Query dữ liệu là gì? Query dữ liệu là quá trình truy vấn và lấy thông tin từ cơ sở dữ liệu. Đây là một công việc quan trọng trong phân tích dữ liệu và xử lý dữ liệu. Khi làm việc với dữ liệu, việc truy vấn và lấy thông tin chính xác và […]

Các bước cơ bản để sử dụng Python trong phân tích dữ liệu

Python trong phân tích dữ liệu là gì? Python trong phân tích dữ liệu là một chủ đề được quan tâm bởi nhiều người trong lĩnh vực khoa học dữ liệu và phân tích dữ liệu. Python là một ngôn ngữ lập trình mạnh mẽ và phổ biến được sử dụng để xử lý và […]

Dặm và kilômét là gì? 1 dặm bằng bao nhiêu km

Dặm và kilômét là gì? Dặm và kilômét là hai đơn vị đo chiều dài hoặc khoảng cách phổ biến trên thế giới. Dặm (mile) là một đơn vị đo lường khá phổ biến ở các nước sử dụng hệ đo Anh. Một dặm bằng khoảng 1,6 kilômét. Kilômét (kilometer) là đơn vị đo lường […]

1 tấn bằng bao nhiêu kg, tạ, yến, gam, pound, ounce, lượng vàng, chỉ vàng

Tấn là gì? Tấn là một đơn vị đo khối lượng, được sử dụng rộng rãi trong đời sống kinh tế, khoa học và công nghệ. Theo Từ điển Bách khoa Việt Nam, tấn được định nghĩa là một đơn vị khối lượng, bằng 1000 kg. Tấn còn được gọi là tân, là một đơn […]