| @@ -24,9 +24,8 @@ | ||
| 24 | 24 | use RadiusTheme\SB\Controllers\Hooks\FilterHooks; |
| 25 | 25 | use RadiusTheme\SB\Controllers\Hooks\ActionHooks; |
| 26 | 26 | use RadiusTheme\SB\Controllers\Frontend\Ajax\AddToCart; |
| 27 | 27 | use RadiusTheme\SB\Controllers\Frontend\Ajax\AjaxLogin; |
| 28 | -use RadiusTheme\SB\Controllers\Frontend\OrderReviewQuantity; | |
| 29 | 28 | use RadiusTheme\SB\Controllers\Frontend\Ajax\UpdateCheckoutSection; |
| 30 | 29 | |
| 31 | 30 | // Do not allow directly accessing this file. |
| 32 | 31 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -86,14 +85,8 @@ | ||
| 86 | 85 | $this->current_theme = wp_get_theme()->get( 'Template' ) ? wp_get_theme()->get( 'Template' ) : ( wp_get_theme()->get( 'TextDomain' ) ? wp_get_theme()->get( 'TextDomain' ) : strtolower( str_replace( ' ', '', wp_get_theme()->get( 'Name' ) ) ) ); |
| 87 | 86 | add_action( 'plugins_loaded', [ $this, 'init' ], 15 ); |
| 88 | 87 | add_action( 'upgrader_process_complete', [ $this, 'maybe_run_after_update' ], 10, 2 ); |
| 89 | 88 | |
| 90 | - // Runs before anything reads or writes the object cache: Installation is | |
| 91 | - // on init:5 and ModuleManager on init:15. Registered here rather than in | |
| 92 | - // init() so version tracking stays accurate even while a dependency is | |
| 93 | - // missing and the rest of the plugin is dormant. | |
| 94 | - add_action( 'init', [ Cache::class, 'maybe_rotate_group' ], 1 ); | |
| 95 | - | |
| 96 | 89 | // Register Plugin Active Hook. |
| 97 | 90 | register_activation_hook( RTSB_FILE, [ Installation::class, 'activate' ] ); |
| 98 | 91 | |
| 99 | 92 | // Register Plugin Deactivate Hook. |
| @@ -185,11 +178,8 @@ | ||
| 185 | 178 | AddToCart::instance(); |
| 186 | 179 | AjaxLogin::instance(); |
| 187 | 180 | UpdateCheckoutSection::instance(); |
| 188 | 181 | |
| 189 | - // Checkout. | |
| 190 | - OrderReviewQuantity::instance(); | |
| 191 | - | |
| 192 | 182 | BuilderController::instance(); |
| 193 | 183 | FilterHooks::init_hooks(); |
| 194 | 184 | ActionHooks::init_hooks(); |
| 195 | 185 | |
| @@ -221,31 +211,23 @@ | ||
| 221 | 211 | if ( 'plugin' !== $options['type'] || ! in_array( $options['action'], [ 'install', 'update' ], true ) ) { |
| 222 | 212 | return; |
| 223 | 213 | } |
| 224 | 214 | |
| 225 | - $basename = plugin_basename( RTSB_FILE ); | |
| 226 | - $slug = dirname( $basename ); | |
| 227 | - | |
| 228 | - // Bulk update flow: WordPress passes every plugin in the batch. | |
| 215 | + // For normal update flow. | |
| 229 | 216 | if ( ! empty( $options['plugins'] ) ) { |
| 230 | - if ( in_array( $basename, (array) $options['plugins'], true ) ) { | |
| 231 | - Cache::clear_all_cache(); | |
| 217 | + foreach ( $options['plugins'] as $plugin ) { | |
| 218 | + if ( strpos( $plugin, 'shopbuilder' ) !== false ) { | |
| 219 | + Cache::clear_all_cache(); | |
| 220 | + break; | |
| 221 | + } | |
| 232 | 222 | } |
| 233 | 223 | return; |
| 234 | 224 | } |
| 235 | 225 | |
| 236 | - // Single update flow: WordPress passes the basename under `plugin`. | |
| 237 | - if ( ! empty( $options['plugin'] ) ) { | |
| 238 | - if ( $basename === $options['plugin'] ) { | |
| 239 | - Cache::clear_all_cache(); | |
| 240 | - } | |
| 241 | - return; | |
| 242 | - } | |
| 243 | - | |
| 244 | - // Upload-based installation: only the destination folder name is known. | |
| 226 | + // For upload-based installation. | |
| 245 | 227 | if ( |
| 246 | 228 | ! empty( $upgrader_object->result['destination_name'] ) && |
| 247 | - $slug === $upgrader_object->result['destination_name'] | |
| 229 | + strpos( $upgrader_object->result['destination_name'], 'shopbuilder' ) !== false | |
| 248 | 230 | ) { |
| 249 | 231 | Cache::clear_all_cache(); |
| 250 | 232 | } |
| 251 | 233 | } |