BossBey File Manager
PHP:
8.2.30
OS:
Linux
User:
imagivibe
Root
/
home
/
imagivibe
/
www
/
wp-content
/
plugins
/
robin-image-optimizer
/
admin
/
ajax
π€ Upload
π New File
π New Folder
Close
Editing: backup.php
<?php /** * Back-up related filters. * * @version 1.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } /** * AJAX ΠΎΠ±ΡΠ°Π±ΠΎΡΡΠΈΠΊ Π²ΠΎΡΡΡΠ°Π½ΠΎΠ²Π»Π΅Π½ΠΈΡ ΠΈΠ· ΡΠ΅Π·Π΅ΡΠ²Π½ΠΎΠΉ ΠΊΠΎΠΏΠΈΠΈ */ add_action( 'wp_ajax_wio_restore_backup', function () { check_admin_referer( 'wio-iph' ); if ( ! current_user_can( 'manage_options' ) ) { wp_die( - 1 ); } $max_process_per_request = 25; // $blog_id = WRIO_Plugin::app()->request->post( 'blog_id', null, true ); /* if ( $blog_id !== null ) { switch_to_blog( $blog_id ); }*/ // Total number of remained images to restore $remane_count = 0; $total = 0; $filter_results = apply_filters( 'wbcr/rio/backup/restore_filter', $max_process_per_request ); if ( isset( $filter_results['remane'] ) ) { $remane_count += $filter_results['remane']; } if ( isset( $filter_results['total'] ) ) { $total += $filter_results['total']; } $media_library = WRIO_Media_Library::get_instance(); $total += $media_library->getOptimizedCount(); $restored_data = $media_library->restoreAllFromBackup( $max_process_per_request ); if ( isset( $restored_data['remain'] ) ) { $remane_count += $restored_data['remain']; } /* if ( $blog_id !== null ) { restore_current_blog(); }*/ $restored_data['total'] = $total; if ( $total > 0 ) { $restored_data['percent'] = 100 - ( $remane_count * 100 / $total ); } else { $restored_data['percent'] = 0; } // Π΅ΡΠ»ΠΈ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡ Π·Π°ΠΊΠΎΠ½ΡΠΈΠ»ΠΈΡΡ - ΠΏΠΎΡΡΠ»Π°Π΅ΠΌ ΠΊΠΎΠΌΠ°Π½Π΄Ρ Π·Π°Π²Π΅ΡΡΠ΅Π½ΠΈΡ if ( $remane_count <= 0 ) { $restored_data['end'] = true; } wp_send_json( $restored_data ); } ); /** * AJAX ΠΎΠ±ΡΠ°Π±ΠΎΡΡΠΈΠΊ ΠΎΡΠΈΡΡΠΊΠΈ ΠΏΠ°ΠΏΠΊΠΈ Ρ Π±Π΅ΠΊΠ°ΠΏΠ°ΠΌΠΈ */ add_action( 'wp_ajax_wio_clear_backup', function () { check_admin_referer( 'wio-iph' ); if ( ! current_user_can( 'manage_options' ) ) { wp_die( - 1 ); } $backup = WIO_Backup::get_instance(); $blogs = WRIO_Plugin::app()->request->post( 'blogs', [], true ); if ( ! empty( $blogs ) ) { foreach ( $blogs as $blog_id ) { switch_to_blog( intval( $blog_id ) ); $backup->removeBlogBackupDir(); restore_current_blog(); } } else { $backup->removeBackupDir(); } wp_send_json( true ); } );
Save
Cancel