HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: /home/mirz4654/public_html/wp-content/plugins/imagify/inc/admin/custom-folders.php
<?php
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );

add_filter( 'upgrader_post_install', 'imagify_sync_theme_plugin_files_on_update', IMAGIFY_INT_MAX, 3 );
/**
 * Sync files right after a theme or plugin has been updated.
 *
 * @since  1.7
 * @author Grégory Viguier
 *
 * @param  bool  $response   Installation response.
 * @param  array $hook_extra Extra arguments passed to hooked filters.
 * @param  array $result     Installation result data.
 * @return bool
 */
function imagify_sync_theme_plugin_files_on_update( $response, $hook_extra, $result ) {
	global $wpdb;

	if ( ( empty( $hook_extra['plugin'] ) && empty( $hook_extra['theme'] ) ) || empty( $result['destination'] ) ) {
		return $response;
	}

	$folders_to_sync = get_site_transient( 'imagify_themes_plugins_to_sync' );
	$folders_to_sync = is_array( $folders_to_sync ) ? $folders_to_sync : array();

	$folders_to_sync[] = $result['destination'];

	set_site_transient( 'imagify_themes_plugins_to_sync', $folders_to_sync, DAY_IN_SECONDS );

	return $response;
}

add_action( 'admin_init', 'imagify_sync_theme_plugin_files_after_update' );
/**
 * Sync files after some themes or plugins have been updated.
 *
 * @since  1.7.1.2
 * @author Grégory Viguier
 */
function imagify_sync_theme_plugin_files_after_update() {
	global $wpdb;

	$folders_to_sync = get_site_transient( 'imagify_themes_plugins_to_sync' );

	if ( ! $folders_to_sync || ! is_array( $folders_to_sync ) ) {
		return;
	}

	delete_site_transient( 'imagify_themes_plugins_to_sync' );

	$folders_db = Imagify_Folders_DB::get_instance();
	$files_db   = Imagify_Files_DB::get_instance();

	if ( ! $folders_db->can_operate() || ! $files_db->can_operate() ) {
		return;
	}

	foreach ( $folders_to_sync as $folder_path ) {
		$folder_path = trailingslashit( $folder_path );

		if ( Imagify_Files_Scan::is_path_forbidden( $folder_path ) ) {
			// This theme or plugin must not be optimized.
			continue;
		}

		// Get the related folder.
		$placeholder = Imagify_Files_Scan::add_placeholder( $folder_path );
		$folder      = Imagify_Folders_DB::get_instance()->get_in( 'path', $placeholder );

		if ( ! $folder ) {
			// This theme or plugin is not in the database.
			continue;
		}

		// Sync the folder files.
		Imagify_Custom_Folders::synchronize_files_from_folders( array(
			$folder['folder_id'] => array(
				'folder_id'   => $folder['folder_id'],
				'path'        => $placeholder,
				'active'      => $folder['active'],
				'folder_path' => $folder_path,
			),
		) );
	}
}