| @@ -6,8 +6,13 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace MainWP\Dashboard; |
| 9 | 9 | |
| 10 | +// Exit if accessed directly. | |
| 11 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 12 | + exit; | |
| 13 | +} | |
| 14 | + | |
| 10 | 15 | /** |
| 11 | 16 | * Class MainWP_Updates_Handler |
| 12 | 17 | * |
| 13 | 18 | * @package MainWP\Dashboard |
| @@ -44,31 +49,56 @@ | ||
| 44 | 49 | |
| 45 | 50 | $website = MainWP_DB::instance()->get_website_by_id( $id ); |
| 46 | 51 | |
| 47 | 52 | if ( MainWP_System_Utility::is_suspended_site( $website ) ) { |
| 48 | - throw new MainWP_Exception( 'ERROR', '<i class="pause circular yellow inverted icon"></i> ' . esc_html__( 'Suspended site.', 'mainwp' ) ); //phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped | |
| 53 | + throw new MainWP_Exception( 'ERROR', '<i class="pause circular yellow inverted icon"></i> ' . esc_html__( 'Suspended site.', 'mainwp' ), 'SUSPENDED_SITE' ); //phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped | |
| 49 | 54 | } |
| 50 | 55 | |
| 51 | 56 | $information = static::upgrade_website( $website ); |
| 52 | 57 | |
| 53 | 58 | if ( is_array( $information ) ) { |
| 54 | - if ( isset( $information['upgrade'] ) && ( 'SUCCESS' === $information['upgrade'] ) ) { | |
| 59 | + $thrw_error = ''; | |
| 60 | + $thrw_extra = ''; | |
| 61 | + $success = false; | |
| 62 | + if ( isset( $information['upgrade'] ) && 'SUCCESS' === $information['upgrade'] ) { | |
| 55 | 63 | MainWP_DB::instance()->update_website_option( $website, 'wp_upgrades', wp_json_encode( array() ) ); |
| 56 | 64 | do_action( 'mainwp_after_upgrade_wp_success', $website, $information ); |
| 57 | - return '<i class="green check icon"></i>'; | |
| 65 | + // Get Icon for the largest change scope of ext regression testing. | |
| 66 | + $html_regression_icon = apply_filters( 'mainwp_html_regression_largest_change_scope', $website->id, true ) ?: ''; // phpcs:ignore -- NOSONAR | |
| 67 | + if ( $website->id === $html_regression_icon ) { | |
| 68 | + $html_regression_icon = ''; | |
| 69 | + } | |
| 70 | + $raw_msg = esc_html__( 'Update successful', 'mainwp' ); | |
| 71 | + $msg_success = '<span data-inverted="" data-position="left center" data-tooltip="' . esc_html__( 'Update successful', 'mainwp' ) . '"><i class="green check icon"></i></span>' . $html_regression_icon; | |
| 72 | + $success = true; | |
| 58 | 73 | } elseif ( isset( $information['upgrade'] ) ) { |
| 59 | 74 | $errorMsg = ''; |
| 60 | 75 | if ( 'LOCALIZATION' === $information['upgrade'] ) { |
| 76 | + $raw_msg = esc_html__( 'No update found for the set locale.', 'mainwp' ); | |
| 61 | 77 | $errorMsg = '<i class="red times icon"></i> ' . esc_html__( 'No update found for the set locale.', 'mainwp' ); |
| 62 | 78 | } elseif ( 'NORESPONSE' === $information['upgrade'] ) { |
| 79 | + $raw_msg = esc_html__( 'No response from the child site server.', 'mainwp' ); | |
| 63 | 80 | $errorMsg = '<i class="red times icon"></i> ' . esc_html__( 'No response from the child site server.', 'mainwp' ); |
| 64 | 81 | } |
| 65 | - throw new MainWP_Exception( 'WPERROR', $errorMsg ); //phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped | |
| 82 | + $thrw_error = 'WPERROR'; | |
| 83 | + $thrw_extra = $errorMsg; | |
| 66 | 84 | } elseif ( isset( $information['error'] ) ) { |
| 67 | - throw new MainWP_Exception( 'WPERROR', esc_html( $information['error'] ) ); | |
| 85 | + $thrw_error = 'WPERROR'; | |
| 86 | + $thrw_extra = esc_html( $information['error'] ); | |
| 87 | + $raw_msg = esc_html( $information['error'] ); | |
| 68 | 88 | } else { |
| 69 | - throw new MainWP_Exception( 'ERROR', '<i class="red times icon"></i> ' . esc_html__( 'Invalid response from child site.', 'mainwp' ) ); | |
| 89 | + $thrw_error = 'ERROR'; | |
| 90 | + $thrw_extra = '<i class="red times icon"></i> ' . esc_html__( 'Invalid response from child site.', 'mainwp' ); | |
| 91 | + $raw_msg = esc_html__( 'Invalid response from child site.', 'mainwp' ); | |
| 70 | 92 | } |
| 93 | + | |
| 94 | + do_action( 'mainwp_after_upgrade_wp_core', $website, $information, $success, $raw_msg ); | |
| 95 | + | |
| 96 | + if ( ! empty( $thrw_error ) ) { | |
| 97 | + throw new MainWP_Exception( $thrw_error, $thrw_extra ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- NOSONAR -escaped. | |
| 98 | + } elseif ( ! empty( $msg_success ) ) { | |
| 99 | + return $msg_success; | |
| 100 | + } | |
| 71 | 101 | } |
| 72 | 102 | } |
| 73 | 103 | |
| 74 | 104 | throw new MainWP_Exception( 'ERROR', '<i class="red times icon"></i> ' . esc_html__( 'Site ID not found. Please reload the page and try again.', 'mainwp' ) ); |
| @@ -103,36 +133,10 @@ | ||
| 103 | 133 | do_action( 'mainwp_before_wp_update', $website ); |
| 104 | 134 | |
| 105 | 135 | $information = MainWP_Connect::fetch_url_authed( $website, 'upgrade' ); |
| 106 | 136 | |
| 107 | - // logging feature. | |
| 108 | - $error = ''; | |
| 109 | - $success = false; | |
| 137 | + static::activity_log_upgrade( $website, $information ); | |
| 110 | 138 | |
| 111 | - if ( is_array( $information ) ) { | |
| 112 | - if ( isset( $information['upgrade'] ) && ( 'SUCCESS' === $information['upgrade'] ) ) { | |
| 113 | - $success = true; | |
| 114 | - } elseif ( isset( $information['upgrade'] ) ) { | |
| 115 | - if ( 'LOCALIZATION' === $information['upgrade'] ) { | |
| 116 | - $error = esc_html__( 'No update found for the set locale.', 'mainwp' ); | |
| 117 | - } elseif ( 'NORESPONSE' === $information['upgrade'] ) { | |
| 118 | - $error = esc_html__( 'No response from the child site server.', 'mainwp' ); | |
| 119 | - } | |
| 120 | - } elseif ( isset( $information['error'] ) ) { | |
| 121 | - $error = esc_html( $information['error'] ); | |
| 122 | - } else { | |
| 123 | - $error = esc_html__( 'Invalid response from child site.', 'mainwp' ); | |
| 124 | - } | |
| 125 | - } | |
| 126 | - | |
| 127 | - $output_array = array( | |
| 128 | - 'old_version' => isset( $information['old_version'] ) ? $information['old_version'] : '', | |
| 129 | - 'version' => isset( $information['version'] ) ? $information['version'] : '', | |
| 130 | - 'success' => $success ? 1 : 0, | |
| 131 | - 'error' => $error, | |
| 132 | - ); | |
| 133 | - mainwp_get_actions_handler_instance()->do_action_mainwp_install_actions( $website, 'updated', $output_array, 'core' ); | |
| 134 | - | |
| 135 | 139 | /** |
| 136 | 140 | * Action: mainwp_after_wp_update |
| 137 | 141 | * |
| 138 | 142 | * Fires after WP update. |
| @@ -146,14 +150,60 @@ | ||
| 146 | 150 | return false; |
| 147 | 151 | } |
| 148 | 152 | |
| 149 | 153 | /** |
| 154 | + * Log upgrade activities. | |
| 155 | + * | |
| 156 | + * @param object $website Child site object. | |
| 157 | + * @param array $information Upgrade information. | |
| 158 | + * @param bool $is_auto_update Whether the update is automatic. | |
| 159 | + */ | |
| 160 | + public static function activity_log_upgrade( $website, $information, $is_auto_update = false ) { // phpcs:ignore -- NOSONAR - complex. | |
| 161 | + // Implementation for logging upgrade activities. | |
| 162 | + $error = ''; | |
| 163 | + $success = false; | |
| 164 | + | |
| 165 | + if ( is_array( $information ) ) { | |
| 166 | + if ( isset( $information['upgrade'] ) && ( 'SUCCESS' === $information['upgrade'] ) ) { | |
| 167 | + $success = true; | |
| 168 | + } elseif ( isset( $information['upgrade'] ) ) { | |
| 169 | + if ( 'LOCALIZATION' === $information['upgrade'] ) { | |
| 170 | + $error = esc_html__( 'No update found for the set locale.', 'mainwp' ); | |
| 171 | + } elseif ( 'NORESPONSE' === $information['upgrade'] ) { | |
| 172 | + $error = esc_html__( 'No response from the child site server.', 'mainwp' ); | |
| 173 | + } | |
| 174 | + } elseif ( isset( $information['error'] ) ) { | |
| 175 | + $error = esc_html( $information['error'] ); | |
| 176 | + } else { | |
| 177 | + $error = esc_html__( 'Invalid response from child site.', 'mainwp' ); | |
| 178 | + } | |
| 179 | + } | |
| 180 | + | |
| 181 | + $output_array = array( | |
| 182 | + 'old_version' => is_array( $information ) && isset( $information['old_version'] ) ? $information['old_version'] : '', | |
| 183 | + 'version' => is_array( $information ) && isset( $information['version'] ) ? $information['version'] : '', | |
| 184 | + 'success' => $success ? 1 : 0, | |
| 185 | + 'error' => $error, | |
| 186 | + ); | |
| 187 | + | |
| 188 | + if ( $is_auto_update ) { | |
| 189 | + MainWP_Updates_Report_Manager::save_update_info( $website, $output_array, 'core' ); | |
| 190 | + } | |
| 191 | + | |
| 192 | + $actions_handler = mainwp_get_actions_handler_instance(); | |
| 193 | + if ( is_object( $actions_handler ) ) { | |
| 194 | + $actions_handler->do_action_mainwp_install_actions( $website, 'updated', $output_array, 'core' ); | |
| 195 | + } | |
| 196 | + } | |
| 197 | + | |
| 198 | + /** | |
| 150 | 199 | * Add a plugin or theme to the ignor list. |
| 151 | 200 | * |
| 152 | - * @param mixed $type plugin|theme. | |
| 153 | - * @param mixed $slug Plugin or Theme Slug. | |
| 154 | - * @param mixed $name Plugin or Theme Name. | |
| 155 | - * @param mixed $id Child Site ID. | |
| 201 | + * @param mixed $type plugin|theme. | |
| 202 | + * @param mixed $slug Plugin or Theme Slug. | |
| 203 | + * @param mixed $name Plugin or Theme Name. | |
| 204 | + * @param mixed $id Child Site ID. | |
| 205 | + * @param string $ver version ignore. | |
| 156 | 206 | * |
| 157 | 207 | * @return string success. |
| 158 | 208 | * |
| 159 | 209 | * @uses \MainWP\Dashboard\MainWP_DB::get_website_by_id() |
| @@ -160,9 +210,9 @@ | ||
| 160 | 210 | * @uses \MainWP\Dashboard\MainWP_DB::update_website_values() |
| 161 | 211 | * @uses \MainWP\Dashboard\MainWP_System_Utility::can_edit_website() |
| 162 | 212 | * @uses \MainWP\Dashboard\MainWP_Utility::ctype_digit() |
| 163 | 213 | */ |
| 164 | - public static function ignore_plugin_theme( $type, $slug, $name, $id ) { // phpcs:ignore -- NOSONAR - complex. | |
| 214 | + public static function ignore_plugin_theme( $type, $slug, $name, $id, $ver = '' ) { // phpcs:ignore -- NOSONAR - complex. | |
| 165 | 215 | if ( isset( $id ) && MainWP_Utility::ctype_digit( $id ) ) { |
| 166 | 216 | $website = MainWP_DB::instance()->get_website_by_id( $id ); |
| 167 | 217 | if ( MainWP_System_Utility::can_edit_website( $website ) ) { |
| 168 | 218 | $slug = urldecode( $slug ); |
| @@ -167,69 +217,107 @@ | ||
| 167 | 217 | if ( MainWP_System_Utility::can_edit_website( $website ) ) { |
| 168 | 218 | $slug = urldecode( $slug ); |
| 169 | 219 | if ( 'plugin' === $type ) { |
| 170 | 220 | $decodedIgnoredPlugins = json_decode( $website->ignored_plugins, true ); |
| 171 | - if ( ! isset( $decodedIgnoredPlugins[ $slug ] ) ) { | |
| 221 | + /** | |
| 222 | + * Action: mainwp_before_plugin_ignore | |
| 223 | + * | |
| 224 | + * Fires before plugin ignore. | |
| 225 | + * | |
| 226 | + * @since 4.1 | |
| 227 | + */ | |
| 228 | + do_action( 'mainwp_before_plugin_ignore', $decodedIgnoredPlugins, $website ); | |
| 172 | 229 | |
| 173 | - /** | |
| 174 | - * Action: mainwp_before_plugin_ignore | |
| 175 | - * | |
| 176 | - * Fires before plugin ignore. | |
| 177 | - * | |
| 178 | - * @since 4.1 | |
| 179 | - */ | |
| 180 | - do_action( 'mainwp_before_plugin_ignore', $decodedIgnoredPlugins, $website ); | |
| 230 | + $ignored_info = is_array( $decodedIgnoredPlugins ) && isset( $decodedIgnoredPlugins[ $slug ] ) ? $decodedIgnoredPlugins[ $slug ] : array(); | |
| 231 | + if ( ! is_array( $ignored_info ) ) { | |
| 232 | + $ignored_info = array(); | |
| 233 | + } | |
| 181 | 234 | |
| 182 | - $decodedIgnoredPlugins[ $slug ] = urldecode( $name ); | |
| 183 | - MainWP_DB::instance()->update_website_values( $website->id, array( 'ignored_plugins' => wp_json_encode( $decodedIgnoredPlugins ) ) ); | |
| 235 | + $ignored_info['Name'] = urldecode( $name ); | |
| 184 | 236 | |
| 185 | - /** | |
| 186 | - * Action: mainwp_after_plugin_ignore | |
| 187 | - * | |
| 188 | - * Fires after plugin ignore. | |
| 189 | - * | |
| 190 | - * @since 4.1 | |
| 191 | - */ | |
| 192 | - do_action( 'mainwp_after_plugin_ignore', $decodedIgnoredPlugins, $website ); | |
| 237 | + $ignored_vers = is_array( $ignored_info ) && isset( $ignored_info['ignored_versions'] ) ? $ignored_info['ignored_versions'] : array(); | |
| 238 | + if ( ! is_array( $ignored_vers ) ) { | |
| 239 | + $ignored_vers = array(); | |
| 240 | + } | |
| 241 | + if ( empty( $ver ) || 'all_versions' === $ver ) { // ignore all. | |
| 242 | + $ignored_vers = array( 'all_versions' ); | |
| 243 | + } else { | |
| 244 | + $ver = urldecode( $ver ); | |
| 245 | + if ( ! in_array( $ver, $ignored_vers ) ) { | |
| 246 | + $ignored_vers[] = $ver; | |
| 247 | + } | |
| 248 | + } | |
| 249 | + $ignored_info['ignored_versions'] = $ignored_vers; | |
| 193 | 250 | |
| 194 | - } | |
| 251 | + $decodedIgnoredPlugins[ $slug ] = $ignored_info; | |
| 252 | + | |
| 253 | + MainWP_DB::instance()->update_website_values( $website->id, array( 'ignored_plugins' => wp_json_encode( $decodedIgnoredPlugins ) ) ); | |
| 254 | + | |
| 255 | + /** | |
| 256 | + * Action: mainwp_after_plugin_ignore | |
| 257 | + * | |
| 258 | + * Fires after plugin ignore. | |
| 259 | + * | |
| 260 | + * @since 4.1 | |
| 261 | + */ | |
| 262 | + do_action( 'mainwp_after_plugin_ignore', $decodedIgnoredPlugins, $website ); | |
| 263 | + | |
| 195 | 264 | } elseif ( 'theme' === $type ) { |
| 196 | 265 | $decodedIgnoredThemes = json_decode( $website->ignored_themes, true ); |
| 197 | - if ( ! isset( $decodedIgnoredThemes[ $slug ] ) ) { | |
| 198 | - /** | |
| 199 | - * Action: mainwp_before_theme_ignore | |
| 200 | - * | |
| 201 | - * Fires before theme ignore. | |
| 202 | - * | |
| 203 | - * @since 4.1 | |
| 204 | - */ | |
| 205 | - do_action( 'mainwp_before_theme_ignore', $decodedIgnoredThemes, $website ); | |
| 206 | 266 | |
| 207 | - $decodedIgnoredThemes[ $slug ] = urldecode( $name ); | |
| 208 | - MainWP_DB::instance()->update_website_values( $website->id, array( 'ignored_themes' => wp_json_encode( $decodedIgnoredThemes ) ) ); | |
| 267 | + /** | |
| 268 | + * Action: mainwp_before_theme_ignore | |
| 269 | + * | |
| 270 | + * Fires before theme ignore. | |
| 271 | + * | |
| 272 | + * @since 4.1 | |
| 273 | + */ | |
| 274 | + do_action( 'mainwp_before_theme_ignore', $decodedIgnoredThemes, $website ); | |
| 209 | 275 | |
| 210 | - /** | |
| 211 | - * Action: mainwp_after_theme_ignore | |
| 212 | - * | |
| 213 | - * Fires after theme ignore. | |
| 214 | - * | |
| 215 | - * @since 4.1 | |
| 216 | - */ | |
| 217 | - do_action( 'mainwp_after_theme_ignore', $website, $decodedIgnoredThemes ); | |
| 276 | + $ignored_info = is_array( $decodedIgnoredThemes ) && isset( $decodedIgnoredThemes[ $slug ] ) ? $decodedIgnoredThemes[ $slug ] : array(); | |
| 277 | + if ( ! is_array( $ignored_info ) ) { | |
| 278 | + $ignored_info = array(); | |
| 218 | 279 | } |
| 280 | + $ignored_info['Name'] = urldecode( $name ); | |
| 281 | + | |
| 282 | + $ignored_vers = is_array( $ignored_info ) && isset( $ignored_info['ignored_versions'] ) ? $ignored_info['ignored_versions'] : array(); | |
| 283 | + if ( ! is_array( $ignored_vers ) ) { | |
| 284 | + $ignored_vers = array(); | |
| 285 | + } | |
| 286 | + if ( empty( $ver ) || 'all_versions' === $ver ) { // ignore all. | |
| 287 | + $ignored_vers = array( 'all_versions' ); | |
| 288 | + } else { | |
| 289 | + $ver = urldecode( $ver ); | |
| 290 | + if ( ! in_array( $ver, $ignored_vers ) ) { | |
| 291 | + $ignored_vers[] = $ver; | |
| 292 | + } | |
| 293 | + } | |
| 294 | + $ignored_info['ignored_versions'] = $ignored_vers; | |
| 295 | + | |
| 296 | + $decodedIgnoredThemes[ $slug ] = $ignored_info; | |
| 297 | + MainWP_DB::instance()->update_website_values( $website->id, array( 'ignored_themes' => wp_json_encode( $decodedIgnoredThemes ) ) ); | |
| 298 | + /** | |
| 299 | + * Action: mainwp_after_theme_ignore | |
| 300 | + * | |
| 301 | + * Fires after theme ignore. | |
| 302 | + * | |
| 303 | + * @since 4.1 | |
| 304 | + */ | |
| 305 | + do_action( 'mainwp_after_theme_ignore', $website, $decodedIgnoredThemes ); | |
| 219 | 306 | } |
| 220 | 307 | } |
| 221 | 308 | } |
| 222 | - | |
| 223 | 309 | return 'success'; |
| 224 | 310 | } |
| 225 | 311 | |
| 312 | + | |
| 226 | 313 | /** |
| 227 | 314 | * Remove a plugin or theme from the ignore list. |
| 228 | 315 | * |
| 229 | - * @param mixed $type plugin|theme. | |
| 230 | - * @param mixed $slug Plugin or Theme slug. | |
| 231 | - * @param mixed $id Plugin or Theme name. | |
| 316 | + * @param mixed $type plugin|theme. | |
| 317 | + * @param mixed $slug Plugin or Theme slug. | |
| 318 | + * @param mixed $id Plugin or Theme name. | |
| 319 | + * @param string $ver Plugin or Theme version. | |
| 232 | 320 | * |
| 233 | 321 | * @return string success. |
| 234 | 322 | * |
| 235 | 323 | * @uses \MainWP\Dashboard\MainWP_DB::query() |
| @@ -240,9 +328,9 @@ | ||
| 240 | 328 | * @uses \MainWP\Dashboard\MainWP_DB::free_result() |
| 241 | 329 | * @uses \MainWP\Dashboard\MainWP_System_Utility::can_edit_website() |
| 242 | 330 | * @uses \MainWP\Dashboard\MainWP_Utility::ctype_digit() |
| 243 | 331 | */ |
| 244 | - public static function unignore_plugin_theme( $type, $slug, $id ) { // phpcs:ignore -- NOSONAR - complex. | |
| 332 | + public static function unignore_plugin_theme( $type, $slug, $id, $ver ) { // phpcs:ignore -- NOSONAR - complex. | |
| 245 | 333 | if ( ! empty( $id ) ) { |
| 246 | 334 | |
| 247 | 335 | /** |
| 248 | 336 | * Action: mainwp_before_plugin_theme_unignore |
| @@ -306,9 +394,8 @@ | ||
| 306 | 394 | $slug = urldecode( $slug ); |
| 307 | 395 | if ( 'plugin' === $type ) { |
| 308 | 396 | $decodedIgnoredPlugins = json_decode( $website->ignored_plugins, true ); |
| 309 | 397 | if ( isset( $decodedIgnoredPlugins[ $slug ] ) ) { |
| 310 | - | |
| 311 | 398 | /** |
| 312 | 399 | * Action: mainwp_before_plugin_unignore |
| 313 | 400 | * |
| 314 | 401 | * Fires before plugin unignore. |
| @@ -316,11 +403,34 @@ | ||
| 316 | 403 | * @since 4.1 |
| 317 | 404 | */ |
| 318 | 405 | do_action( 'mainwp_before_plugin_unignore', $decodedIgnoredPlugins, $website ); |
| 319 | 406 | |
| 320 | - unset( $decodedIgnoredPlugins[ $slug ] ); | |
| 407 | + if ( is_string( $decodedIgnoredPlugins[ $slug ] ) ) { // old ignored info. | |
| 408 | + unset( $decodedIgnoredPlugins[ $slug ] ); | |
| 409 | + } elseif ( is_array( $decodedIgnoredPlugins[ $slug ] ) ) { | |
| 410 | + $ignored_info = $decodedIgnoredPlugins[ $slug ]; | |
| 411 | + $ignored_vers = is_array( $ignored_info ) && isset( $ignored_info['ignored_versions'] ) ? $ignored_info['ignored_versions'] : array(); | |
| 412 | + | |
| 413 | + if ( ! is_array( $ignored_vers ) ) { | |
| 414 | + $ignored_vers = array(); | |
| 415 | + } | |
| 416 | + | |
| 417 | + if ( empty( $ver ) || 'all_versions' === $ver ) { // ignore all. | |
| 418 | + unset( $decodedIgnoredPlugins[ $slug ] ); | |
| 419 | + } else { | |
| 420 | + $ver = urldecode( $ver ); | |
| 421 | + if ( in_array( $ver, $ignored_vers ) ) { | |
| 422 | + $ignored_vers = array_diff( $ignored_vers, array( $ver ) ); | |
| 423 | + } | |
| 424 | + $ignored_info['ignored_versions'] = $ignored_vers; | |
| 425 | + if ( empty( $ignored_vers ) ) { | |
| 426 | + unset( $decodedIgnoredPlugins[ $slug ] ); | |
| 427 | + } else { | |
| 428 | + $decodedIgnoredPlugins[ $slug ] = $ignored_info; | |
| 429 | + } | |
| 430 | + } | |
| 431 | + } | |
| 321 | 432 | MainWP_DB::instance()->update_website_values( $website->id, array( 'ignored_plugins' => wp_json_encode( $decodedIgnoredPlugins ) ) ); |
| 322 | - | |
| 323 | 433 | /** |
| 324 | 434 | * Action: mainwp_after_plugin_unignore |
| 325 | 435 | * |
| 326 | 436 | * Fires after plugin unignore. |
| @@ -341,9 +451,34 @@ | ||
| 341 | 451 | * @since 4.1 |
| 342 | 452 | */ |
| 343 | 453 | do_action( 'mainwp_before_theme_unignore', $decodedIgnoredThemes, $website ); |
| 344 | 454 | |
| 345 | - unset( $decodedIgnoredThemes[ $slug ] ); | |
| 455 | + if ( is_string( $decodedIgnoredThemes[ $slug ] ) ) { // old ignored info. | |
| 456 | + unset( $decodedIgnoredThemes[ $slug ] ); | |
| 457 | + } elseif ( is_array( $decodedIgnoredThemes[ $slug ] ) ) { | |
| 458 | + $ignored_info = $decodedIgnoredThemes[ $slug ]; | |
| 459 | + $ignored_vers = is_array( $ignored_info ) && isset( $ignored_info['ignored_versions'] ) ? $ignored_info['ignored_versions'] : array(); | |
| 460 | + | |
| 461 | + if ( ! is_array( $ignored_vers ) ) { | |
| 462 | + $ignored_vers = array(); | |
| 463 | + } | |
| 464 | + | |
| 465 | + if ( empty( $ver ) || 'all_versions' === $ver ) { // ignore all. | |
| 466 | + unset( $decodedIgnoredThemes[ $slug ] ); | |
| 467 | + } else { | |
| 468 | + $ver = urldecode( $ver ); | |
| 469 | + if ( in_array( $ver, $ignored_vers ) ) { | |
| 470 | + $ignored_vers = array_diff( $ignored_vers, array( $ver ) ); | |
| 471 | + } | |
| 472 | + $ignored_info['ignored_versions'] = $ignored_vers; | |
| 473 | + if ( empty( $ignored_vers ) ) { | |
| 474 | + unset( $decodedIgnoredThemes[ $slug ] ); | |
| 475 | + } else { | |
| 476 | + $decodedIgnoredThemes[ $slug ] = $ignored_info; | |
| 477 | + } | |
| 478 | + } | |
| 479 | + } | |
| 480 | + | |
| 346 | 481 | MainWP_DB::instance()->update_website_values( $website->id, array( 'ignored_themes' => wp_json_encode( $decodedIgnoredThemes ) ) ); |
| 347 | 482 | |
| 348 | 483 | /** |
| 349 | 484 | * Action: mainwp_after_theme_unignore |
| @@ -361,9 +496,140 @@ | ||
| 361 | 496 | |
| 362 | 497 | return 'success'; |
| 363 | 498 | } |
| 364 | 499 | |
| 500 | + | |
| 365 | 501 | /** |
| 502 | + * Remove WP from the ignore list. | |
| 503 | + * | |
| 504 | + * @param mixed $id Plugin or Theme name. | |
| 505 | + * @param string $ver Plugin or Theme version. | |
| 506 | + * | |
| 507 | + * @return string success. | |
| 508 | + */ | |
| 509 | + public static function unignore_core_updates( $id, $ver ) { // phpcs:ignore -- NOSONAR - complex. | |
| 510 | + if ( ! empty( $id ) ) { | |
| 511 | + | |
| 512 | + if ( '_ALL_' === $id ) { | |
| 513 | + $params = array( | |
| 514 | + 'view' => 'updates_view', | |
| 515 | + 'others_fields' => array( 'premium_upgrades' ), | |
| 516 | + ); | |
| 517 | + $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user_by_params( $params ) ); | |
| 518 | + while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) { | |
| 519 | + | |
| 520 | + /** | |
| 521 | + * Action: mainwp_before_core_unignore | |
| 522 | + * | |
| 523 | + * Fires before plugin unignore. | |
| 524 | + * | |
| 525 | + * @since 5.2 | |
| 526 | + */ | |
| 527 | + do_action( 'mainwp_before_core_unignore', '_ALL_', $website ); | |
| 528 | + | |
| 529 | + MainWP_DB::instance()->update_website_option( $website->id, 'ignored_wp_upgrades', wp_json_encode( array() ) ); | |
| 530 | + /** | |
| 531 | + * Action: mainwp_after_core_unignore | |
| 532 | + * | |
| 533 | + * Fires after plugin unignore. | |
| 534 | + * | |
| 535 | + * @since 5.2 | |
| 536 | + */ | |
| 537 | + do_action( 'mainwp_before_core_unignore', '_ALL_', $website ); | |
| 538 | + | |
| 539 | + } | |
| 540 | + MainWP_DB::free_result( $websites ); | |
| 541 | + return 'success'; | |
| 542 | + } elseif ( MainWP_Utility::ctype_digit( $id ) ) { | |
| 543 | + $website = MainWP_DB::instance()->get_website_by_id( $id, false, array( 'ignored_wp_upgrades' ) ); | |
| 544 | + if ( MainWP_System_Utility::can_edit_website( $website ) ) { | |
| 545 | + $ignored_info = ! empty( $website->ignored_wp_upgrades ) ? json_decode( $website->ignored_wp_upgrades, true ) : array(); | |
| 546 | + | |
| 547 | + if ( ! is_array( $ignored_info ) ) { | |
| 548 | + $ignored_info = array(); | |
| 549 | + } | |
| 550 | + /** | |
| 551 | + * Action: mainwp_before_core_unignore | |
| 552 | + * | |
| 553 | + * Fires before plugin unignore. | |
| 554 | + * | |
| 555 | + * @since 5.2 | |
| 556 | + */ | |
| 557 | + do_action( 'mainwp_before_core_unignore', $ignored_info, $website ); | |
| 558 | + | |
| 559 | + $ignored_vers = isset( $ignored_info['ignored_versions'] ) ? $ignored_info['ignored_versions'] : array(); | |
| 560 | + | |
| 561 | + if ( ! is_array( $ignored_vers ) ) { | |
| 562 | + $ignored_vers = array(); | |
| 563 | + } | |
| 564 | + | |
| 565 | + if ( empty( $ver ) || 'all_versions' === $ver ) { // unignore all. | |
| 566 | + $ignored_vers = array(); | |
| 567 | + } elseif ( in_array( $ver, $ignored_vers ) ) { | |
| 568 | + $ignored_vers = array_diff( $ignored_vers, array( $ver ) ); | |
| 569 | + } | |
| 570 | + $ignored_info['ignored_versions'] = $ignored_vers; | |
| 571 | + MainWP_DB::instance()->update_website_option( $website->id, 'ignored_wp_upgrades', wp_json_encode( $ignored_info ) ); | |
| 572 | + /** | |
| 573 | + * Action: mainwp_after_core_unignore | |
| 574 | + * | |
| 575 | + * Fires after plugin unignore. | |
| 576 | + * | |
| 577 | + * @since 5.2 | |
| 578 | + */ | |
| 579 | + do_action( 'mainwp_after_core_unignore', $ignored_info, $website ); | |
| 580 | + return 'success'; | |
| 581 | + } | |
| 582 | + } | |
| 583 | + } | |
| 584 | + return 'failed'; | |
| 585 | + } | |
| 586 | + | |
| 587 | + /** | |
| 588 | + * Unignore Plugins or Themes. | |
| 589 | + * | |
| 590 | + * @param string $slug _ALL_|empty. | |
| 591 | + * @param string $ver version info. | |
| 592 | + * | |
| 593 | + * @return string success. | |
| 594 | + * | |
| 595 | + * @uses \MainWP\Dashboard\MainWP_DB_Common::get_user_extension() | |
| 596 | + * @uses \MainWP\Dashboard\MainWP_DB_Common::update_user_extension() | |
| 597 | + */ | |
| 598 | + public static function unignore_global_cores( $slug, $ver ) { // phpcs:ignore -- NOSONAR - complex. | |
| 599 | + $userExtension = MainWP_DB_Common::instance()->get_user_extension(); | |
| 600 | + if ( '_ALL_' === $slug ) { | |
| 601 | + $decodedIgnoredCores = array(); | |
| 602 | + } else { | |
| 603 | + $decodedIgnoredCores = json_decode( $userExtension->ignored_plugins, true ); | |
| 604 | + if ( ! is_array( $decodedIgnoredCores ) ) { | |
| 605 | + $decodedIgnoredCores = array(); | |
| 606 | + } | |
| 607 | + if ( 'all_versions' === $ver ) { | |
| 608 | + $decodedIgnoredCores = array(); | |
| 609 | + } else { | |
| 610 | + $ignored_vers = is_array( $decodedIgnoredCores ) && isset( $decodedIgnoredCores['ignored_versions'] ) ? $decodedIgnoredCores['ignored_versions'] : array(); | |
| 611 | + if ( is_array( $ignored_vers ) && in_array( $ver, $ignored_vers ) ) { | |
| 612 | + $ignored_vers = array_diff( $ignored_vers, array( $ver ) ); | |
| 613 | + if ( empty( $ignored_vers ) ) { | |
| 614 | + $decodedIgnoredCores = array(); | |
| 615 | + } else { | |
| 616 | + $decodedIgnoredCores['ignored_versions'] = $ignored_vers; | |
| 617 | + } | |
| 618 | + } | |
| 619 | + } | |
| 620 | + } | |
| 621 | + MainWP_DB_Common::instance()->update_user_extension( | |
| 622 | + array( | |
| 623 | + 'userid' => null, | |
| 624 | + 'ignored_wp_upgrades' => wp_json_encode( $decodedIgnoredCores ), | |
| 625 | + ) | |
| 626 | + ); | |
| 627 | + | |
| 628 | + return 'success'; | |
| 629 | + } | |
| 630 | + | |
| 631 | + /** | |
| 366 | 632 | * Method ignore_plugins_themes() |
| 367 | 633 | * |
| 368 | 634 | * Ignore Plugins or Themes. |
| 369 | 635 | * |
| @@ -369,8 +635,9 @@ | ||
| 369 | 635 | * |
| 370 | 636 | * @param string $type Plugin or theme. |
| 371 | 637 | * @param string $slug Plugin or tempheme slug. |
| 372 | 638 | * @param string $name Plugin or theme name. |
| 639 | + * @param string $ver Plugin or theme version. | |
| 373 | 640 | * |
| 374 | 641 | * @return string 'success'. |
| 375 | 642 | * |
| 376 | 643 | * @uses \MainWP\Dashboard\MainWP_DB_Common::get_user_extension() |
| @@ -375,9 +642,9 @@ | ||
| 375 | 642 | * |
| 376 | 643 | * @uses \MainWP\Dashboard\MainWP_DB_Common::get_user_extension() |
| 377 | 644 | * @uses \MainWP\Dashboard\MainWP_DB_Common::update_user_extension() |
| 378 | 645 | */ |
| 379 | - public static function ignore_plugins_themes( $type, $slug, $name ) { | |
| 646 | + public static function ignore_plugins_themes( $type, $slug, $name, $ver = '' ) { //phpcs:ignore -- NOSONAR complex function. | |
| 380 | 647 | $slug = urldecode( $slug ); |
| 381 | 648 | $userExtension = MainWP_DB_Common::instance()->get_user_extension(); |
| 382 | 649 | if ( 'plugin' === $type ) { |
| 383 | 650 | $decodedIgnoredPlugins = json_decode( $userExtension->ignored_plugins, true ); |
| @@ -383,9 +650,33 @@ | ||
| 383 | 650 | $decodedIgnoredPlugins = json_decode( $userExtension->ignored_plugins, true ); |
| 384 | 651 | if ( ! is_array( $decodedIgnoredPlugins ) ) { |
| 385 | 652 | $decodedIgnoredPlugins = array(); |
| 386 | 653 | } |
| 387 | - $decodedIgnoredPlugins[ $slug ] = urldecode( $name ); | |
| 654 | + | |
| 655 | + $ignored_info = is_array( $decodedIgnoredPlugins ) && isset( $decodedIgnoredPlugins[ $slug ] ) ? $decodedIgnoredPlugins[ $slug ] : array(); | |
| 656 | + if ( ! is_array( $ignored_info ) ) { | |
| 657 | + $ignored_info = array(); | |
| 658 | + } | |
| 659 | + | |
| 660 | + $ignored_info['Name'] = urldecode( $name ); | |
| 661 | + | |
| 662 | + $ignored_vers = is_array( $ignored_info ) && isset( $ignored_info['ignored_versions'] ) ? $ignored_info['ignored_versions'] : array(); | |
| 663 | + if ( ! is_array( $ignored_vers ) ) { | |
| 664 | + $ignored_vers = array(); | |
| 665 | + } | |
| 666 | + | |
| 667 | + if ( empty( $ver ) || 'all_versions' === $ver ) { // ignore all. | |
| 668 | + $ignored_vers = array( 'all_versions' ); | |
| 669 | + } else { | |
| 670 | + $ver = urldecode( $ver ); | |
| 671 | + if ( ! in_array( $ver, $ignored_vers ) ) { | |
| 672 | + $ignored_vers[] = $ver; | |
| 673 | + } | |
| 674 | + } | |
| 675 | + | |
| 676 | + $ignored_info['ignored_versions'] = $ignored_vers; | |
| 677 | + $decodedIgnoredPlugins[ $slug ] = $ignored_info; | |
| 678 | + | |
| 388 | 679 | MainWP_DB_Common::instance()->update_user_extension( |
| 389 | 680 | array( |
| 390 | 681 | 'userid' => null, |
| 391 | 682 | 'ignored_plugins' => wp_json_encode( $decodedIgnoredPlugins ), |
| @@ -395,9 +686,31 @@ | ||
| 395 | 686 | $decodedIgnoredThemes = json_decode( $userExtension->ignored_themes, true ); |
| 396 | 687 | if ( ! is_array( $decodedIgnoredThemes ) ) { |
| 397 | 688 | $decodedIgnoredThemes = array(); |
| 398 | 689 | } |
| 399 | - $decodedIgnoredThemes[ $slug ] = urldecode( $name ); | |
| 690 | + | |
| 691 | + $ignored_info = is_array( $decodedIgnoredThemes ) && isset( $decodedIgnoredThemes[ $slug ] ) ? $decodedIgnoredThemes[ $slug ] : array(); | |
| 692 | + if ( ! is_array( $ignored_info ) ) { | |
| 693 | + $ignored_info = array(); | |
| 694 | + } | |
| 695 | + | |
| 696 | + $ignored_info['Name'] = urldecode( $name ); | |
| 697 | + | |
| 698 | + $ignored_vers = is_array( $ignored_info ) && isset( $ignored_info['ignored_versions'] ) ? $ignored_info['ignored_versions'] : array(); | |
| 699 | + if ( ! is_array( $ignored_vers ) ) { | |
| 700 | + $ignored_vers = array(); | |
| 701 | + } | |
| 702 | + if ( empty( $ver ) || 'all_versions' === $ver ) { // ignore all. | |
| 703 | + $ignored_vers = array( 'all_versions' ); | |
| 704 | + } else { | |
| 705 | + $ver = urldecode( $ver ); | |
| 706 | + if ( ! in_array( $ver, $ignored_vers ) ) { | |
| 707 | + $ignored_vers[] = $ver; | |
| 708 | + } | |
| 709 | + } | |
| 710 | + $ignored_info['ignored_versions'] = $ignored_vers; | |
| 711 | + $decodedIgnoredThemes[ $slug ] = $ignored_info; | |
| 712 | + | |
| 400 | 713 | MainWP_DB_Common::instance()->update_user_extension( |
| 401 | 714 | array( |
| 402 | 715 | 'userid' => null, |
| 403 | 716 | 'ignored_themes' => wp_json_encode( $decodedIgnoredThemes ), |
| @@ -410,10 +723,11 @@ | ||
| 410 | 723 | |
| 411 | 724 | /** |
| 412 | 725 | * Unignore Plugins or Themes. |
| 413 | 726 | * |
| 414 | - * @param mixed $type plugin|themes. | |
| 415 | - * @param mixed $slug Plugin or Themes slug. | |
| 727 | + * @param mixed $type plugin|themes. | |
| 728 | + * @param mixed $slug Plugin or Themes slug. | |
| 729 | + * @param string $ver Plugin or Themes version. | |
| 416 | 730 | * |
| 417 | 731 | * @return string success. |
| 418 | 732 | * |
| 419 | 733 | * @uses \MainWP\Dashboard\MainWP_DB_Common::get_user_extension() |
| @@ -418,9 +732,9 @@ | ||
| 418 | 732 | * |
| 419 | 733 | * @uses \MainWP\Dashboard\MainWP_DB_Common::get_user_extension() |
| 420 | 734 | * @uses \MainWP\Dashboard\MainWP_DB_Common::update_user_extension() |
| 421 | 735 | */ |
| 422 | - public static function unignore_plugins_themes( $type, $slug ) { // phpcs:ignore -- NOSONAR - complex. | |
| 736 | + public static function unignore_global_plugins_themes( $type, $slug, $ver ) { // phpcs:ignore -- NOSONAR - complex. | |
| 423 | 737 | $slug = urldecode( $slug ); |
| 424 | 738 | $userExtension = MainWP_DB_Common::instance()->get_user_extension(); |
| 425 | 739 | if ( 'plugin' === $type ) { |
| 426 | 740 | if ( '_ALL_' === $slug ) { |
| @@ -430,9 +744,21 @@ | ||
| 430 | 744 | if ( ! is_array( $decodedIgnoredPlugins ) ) { |
| 431 | 745 | $decodedIgnoredPlugins = array(); |
| 432 | 746 | } |
| 433 | 747 | if ( isset( $decodedIgnoredPlugins[ $slug ] ) ) { |
| 434 | - unset( $decodedIgnoredPlugins[ $slug ] ); | |
| 748 | + if ( 'all_versions' === $ver ) { | |
| 749 | + unset( $decodedIgnoredPlugins[ $slug ] ); | |
| 750 | + } else { | |
| 751 | + $ignored_vers = is_array( $decodedIgnoredPlugins[ $slug ] ) && isset( $decodedIgnoredPlugins[ $slug ]['ignored_versions'] ) ? $decodedIgnoredPlugins[ $slug ]['ignored_versions'] : array(); | |
| 752 | + if ( is_array( $ignored_vers ) && in_array( $ver, $ignored_vers ) ) { | |
| 753 | + $ignored_vers = array_diff( $ignored_vers, array( $ver ) ); | |
| 754 | + if ( empty( $ignored_vers ) ) { | |
| 755 | + unset( $decodedIgnoredPlugins[ $slug ] ); | |
| 756 | + } else { | |
| 757 | + $decodedIgnoredPlugins[ $slug ]['ignored_versions'] = $ignored_vers; | |
| 758 | + } | |
| 759 | + } | |
| 760 | + } | |
| 435 | 761 | } |
| 436 | 762 | } |
| 437 | 763 | MainWP_DB_Common::instance()->update_user_extension( |
| 438 | 764 | array( |
| @@ -443,14 +769,26 @@ | ||
| 443 | 769 | } elseif ( 'theme' === $type ) { |
| 444 | 770 | if ( '_ALL_' === $slug ) { |
| 445 | 771 | $decodedIgnoredThemes = array(); |
| 446 | 772 | } else { |
| 447 | - $decodedIgnoredThemes = json_decode( $userExtension->ignored_plugins, true ); | |
| 773 | + $decodedIgnoredThemes = json_decode( $userExtension->ignored_themes, true ); | |
| 448 | 774 | if ( ! is_array( $decodedIgnoredThemes ) ) { |
| 449 | 775 | $decodedIgnoredThemes = array(); |
| 450 | 776 | } |
| 451 | 777 | if ( isset( $decodedIgnoredThemes[ $slug ] ) ) { |
| 452 | - unset( $decodedIgnoredThemes[ $slug ] ); | |
| 778 | + if ( 'all_versions' === $ver ) { | |
| 779 | + unset( $decodedIgnoredThemes[ $slug ] ); | |
| 780 | + } else { | |
| 781 | + $ignored_vers = is_array( $decodedIgnoredThemes[ $slug ] ) && isset( $decodedIgnoredThemes[ $slug ]['ignored_versions'] ) ? $decodedIgnoredThemes[ $slug ]['ignored_versions'] : array(); | |
| 782 | + if ( is_array( $ignored_vers ) && in_array( $ver, $ignored_vers ) ) { | |
| 783 | + $ignored_vers = array_diff( $ignored_vers, array( $ver ) ); | |
| 784 | + if ( empty( $ignored_vers ) ) { | |
| 785 | + unset( $decodedIgnoredThemes[ $slug ] ); | |
| 786 | + } else { | |
| 787 | + $decodedIgnoredThemes[ $slug ]['ignored_versions'] = $ignored_vers; | |
| 788 | + } | |
| 789 | + } | |
| 790 | + } | |
| 453 | 791 | } |
| 454 | 792 | } |
| 455 | 793 | MainWP_DB_Common::instance()->update_user_extension( |
| 456 | 794 | array( |
| @@ -704,8 +1042,19 @@ | ||
| 704 | 1042 | } |
| 705 | 1043 | |
| 706 | 1044 | $undefined = true; |
| 707 | 1045 | |
| 1046 | + // Keep this for backward compatibility. | |
| 1047 | + if ( ! empty( $result['upgrades_started'] ) && is_array( $result['upgrades_started'] ) ) { | |
| 1048 | + foreach ( $result['upgrades_started'] as $k => $v ) { | |
| 1049 | + if ( empty( $v ) ) { | |
| 1050 | + $return_results['result_error'][ rawurlencode( $k ) ] = esc_html__( 'Premium action request failed. Please try again later.', 'mainwp' ); | |
| 1051 | + } else { | |
| 1052 | + $return_results['result_started'][ rawurlencode( $k ) ] = esc_html( $v ); | |
| 1053 | + } | |
| 1054 | + } | |
| 1055 | + } | |
| 1056 | + | |
| 708 | 1057 | if ( isset( $result['upgrades_error'] ) ) { |
| 709 | 1058 | foreach ( $result['upgrades_error'] as $k => $v ) { |
| 710 | 1059 | $return_results['result_error'][ rawurlencode( $k ) ] = esc_html( $v ); |
| 711 | 1060 | } |
| @@ -775,8 +1124,9 @@ | ||
| 775 | 1124 | } |
| 776 | 1125 | } |
| 777 | 1126 | |
| 778 | 1127 | if ( 'plugin' === $type ) { |
| 1128 | + $website = MainWP_DB::instance()->get_website_by_id( $id, false ); // Call new data the before a updated. | |
| 779 | 1129 | if ( ! empty( $website->plugin_upgrades ) ) { |
| 780 | 1130 | $plugin_upgrades = json_decode( $website->plugin_upgrades, true ); |
| 781 | 1131 | if ( is_array( $plugin_upgrades ) ) { |
| 782 | 1132 | $updated = false; |
| @@ -814,9 +1164,24 @@ | ||
| 814 | 1164 | } |
| 815 | 1165 | } |
| 816 | 1166 | return $return_results; |
| 817 | 1167 | } elseif ( isset( $result['error'] ) ) { |
| 818 | - throw new MainWP_Exception( 'WPERROR', esc_html( $result['error'] ) ); | |
| 1168 | + $error_message = esc_html( $result['error'] ); | |
| 1169 | + | |
| 1170 | + if ( ! empty( $result['http_code'] ) ) { | |
| 1171 | + $error_message .= ' HTTP code: ' . esc_html( $result['http_code'] ) . '.'; | |
| 1172 | + } | |
| 1173 | + | |
| 1174 | + if ( ! empty( $result['rep_error'] ) ) { | |
| 1175 | + $error_message .= ' Connection error: ' . esc_html( $result['rep_error'] ) . '.'; | |
| 1176 | + } | |
| 1177 | + | |
| 1178 | + if ( ! empty( $result['rep_error_code'] ) ) { | |
| 1179 | + $error_message .= ' Error code: ' . esc_html( $result['rep_error_code'] ) . '.'; | |
| 1180 | + } | |
| 1181 | + | |
| 1182 | + throw new MainWP_Exception( 'WPERROR', $error_message ); // phpcs:ignore --NOSONAR - escaped. | |
| 1183 | + | |
| 819 | 1184 | } elseif ( isset( $result['notices'] ) ) { |
| 820 | 1185 | $noti = $result['notices']; |
| 821 | 1186 | if ( ! empty( $noti ) && is_string( $noti ) ) { |
| 822 | 1187 | throw new MainWP_Exception( $noti, '', 'MAINWP_NOTICE' ); //phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped |
| @@ -926,14 +1291,16 @@ | ||
| 926 | 1291 | } |
| 927 | 1292 | |
| 928 | 1293 | $ignored_plugins = json_decode( $website->ignored_plugins, true ); |
| 929 | 1294 | if ( is_array( $ignored_plugins ) ) { |
| 930 | - $plugin_upgrades = array_diff_key( $plugin_upgrades, $ignored_plugins ); | |
| 1295 | + $plugin_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $plugin_upgrades, $ignored_plugins ); | |
| 1296 | + | |
| 931 | 1297 | } |
| 932 | 1298 | |
| 933 | 1299 | $ignored_plugins = json_decode( $userExtension->ignored_plugins, true ); |
| 934 | 1300 | if ( is_array( $ignored_plugins ) ) { |
| 935 | - $plugin_upgrades = array_diff_key( $plugin_upgrades, $ignored_plugins ); | |
| 1301 | + $plugin_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $plugin_upgrades, $ignored_plugins ); | |
| 1302 | + | |
| 936 | 1303 | } |
| 937 | 1304 | |
| 938 | 1305 | if ( is_array( $plugin_upgrades ) ) { |
| 939 | 1306 | foreach ( $plugin_upgrades as $slug => $plugin_upgrade ) { |
| @@ -964,14 +1331,14 @@ | ||
| 964 | 1331 | } |
| 965 | 1332 | |
| 966 | 1333 | $ignored_themes = json_decode( $website->ignored_themes, true ); |
| 967 | 1334 | if ( is_array( $ignored_themes ) ) { |
| 968 | - $theme_upgrades = array_diff_key( $theme_upgrades, $ignored_themes ); | |
| 1335 | + $theme_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $theme_upgrades, $ignored_themes ); | |
| 969 | 1336 | } |
| 970 | 1337 | |
| 971 | 1338 | $ignored_themes = json_decode( $userExtension->ignored_themes, true ); |
| 972 | 1339 | if ( is_array( $ignored_themes ) ) { |
| 973 | - $theme_upgrades = array_diff_key( $theme_upgrades, $ignored_themes ); | |
| 1340 | + $theme_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $theme_upgrades, $ignored_themes ); | |
| 974 | 1341 | } |
| 975 | 1342 | |
| 976 | 1343 | if ( is_array( $theme_upgrades ) ) { |
| 977 | 1344 | foreach ( $theme_upgrades as $slug => $theme_upgrade ) { |