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/components/ |
Upload File : |
<?php namespace ImageOptimization\Modules\Backups\Components; use ImageOptimization\Classes\Async_Operation\Async_Operation_Hook; use ImageOptimization\Classes\Image\{ Image_Meta, Image_Restore, Image_Status, }; use ImageOptimization\Classes\Logger; use Throwable; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Restore_Images { /** @async */ public function restore_image( int $image_id ) { try { Image_Restore::restore( $image_id ); } catch ( Throwable $t ) { Logger::log( Logger::LEVEL_ERROR, 'Image restoring error: ' . $t->getMessage() ); ( new Image_Meta( $image_id ) ) ->set_status( Image_Status::RESTORING_FAILED ) ->save(); throw $t; } } /** @async */ public function restore_many_images( array $attachment_ids ) { Image_Restore::restore_many( $attachment_ids ); } public function __construct() { add_action( Async_Operation_Hook::RESTORE_SINGLE_IMAGE, [ $this, 'restore_image' ] ); add_action( Async_Operation_Hook::RESTORE_MANY_IMAGES, [ $this, 'restore_many_images' ] ); } }