Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/self/cwd/wp-content/plugins/image-optimization/modules/backups/classes/ |
Upload File : |
<?php namespace ImageOptimization\Modules\Backups\Classes; use ImageOptimization\Classes\Async_Operation\{ Async_Operation, Async_Operation_Hook, Async_Operation_Queue, }; use ImageOptimization\Classes\Image\Image_Query_Builder; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Remove_All_Backups { private const CHUNK_SIZE = 100; public static function find_and_schedule_removing(): void { $query = ( new Image_Query_Builder() ) ->return_images_only_with_backups() ->execute(); $attachment_ids = $query->posts; $chunks = array_chunk( $attachment_ids, self::CHUNK_SIZE ); foreach ( $chunks as $chunk ) { Async_Operation::create( Async_Operation_Hook::REMOVE_MANY_BACKUPS, [ 'attachment_ids' => $chunk ], Async_Operation_Queue::BACKUP ); } } }