Server : Apache System : Linux pod-100823:apache2_74:v0.5.7 5.4.0-1138-gcp #147~18.04.1-Ubuntu SMP Mon Oct 7 21:46:26 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33.7 Disable Function : apache_child_terminate,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,disk_free_space,disk_total_space,diskfreespace,dl,exec,fastcgi_finish_request,link,opcache_compile_file,opcache_get_configuration,opcache_invalidate,opcache_is_script_cached,opcache_reset,passthru,pclose,pcntl_exec,popen,posix_getpid,posix_getppid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,realpath_cache_get,shell_exec,show_source,symlink,system Directory : /nas/content/live/attorneyexperi/wp-content/plugins/imagify/inc/admin/ |
<?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, ), ) ); } }