Changeset 2622003
- Timestamp:
- 10/29/2021 02:07:37 PM (4 years ago)
- Location:
- bigcommerce
- Files:
-
- 28 edited
- 1 copied
-
tags/4.19.1 (copied) (copied from bigcommerce/trunk)
-
tags/4.19.1/CHANGELOG.md (modified) (2 diffs)
-
tags/4.19.1/bigcommerce.php (modified) (1 diff)
-
tags/4.19.1/build-timestamp.php (modified) (1 diff)
-
tags/4.19.1/readme.txt (modified) (1 diff)
-
tags/4.19.1/src/BigCommerce/Import/Import_Type.php (modified) (3 diffs)
-
tags/4.19.1/src/BigCommerce/Import/Processors/Channel_Initializer.php (modified) (6 diffs)
-
tags/4.19.1/src/BigCommerce/Logging/Error_Log.php (modified) (3 diffs)
-
tags/4.19.1/src/BigCommerce/Plugin.php (modified) (1 diff)
-
tags/4.19.1/src/BigCommerce/Post_Types/Sync_Log/Sync_Log.php (modified) (22 diffs)
-
tags/4.19.1/src/BigCommerce/Settings/Sections/Troubleshooting_Diagnostics.php (modified) (3 diffs)
-
tags/4.19.1/src/BigCommerce/Taxonomies/Channel/Channel.php (modified) (1 diff)
-
tags/4.19.1/vendor/autoload.php (modified) (1 diff)
-
tags/4.19.1/vendor/composer/autoload_real.php (modified) (5 diffs)
-
tags/4.19.1/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/CHANGELOG.md (modified) (2 diffs)
-
trunk/bigcommerce.php (modified) (1 diff)
-
trunk/build-timestamp.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/src/BigCommerce/Import/Import_Type.php (modified) (3 diffs)
-
trunk/src/BigCommerce/Import/Processors/Channel_Initializer.php (modified) (6 diffs)
-
trunk/src/BigCommerce/Logging/Error_Log.php (modified) (3 diffs)
-
trunk/src/BigCommerce/Plugin.php (modified) (1 diff)
-
trunk/src/BigCommerce/Post_Types/Sync_Log/Sync_Log.php (modified) (22 diffs)
-
trunk/src/BigCommerce/Settings/Sections/Troubleshooting_Diagnostics.php (modified) (3 diffs)
-
trunk/src/BigCommerce/Taxonomies/Channel/Channel.php (modified) (1 diff)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (5 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bigcommerce/tags/4.19.1/CHANGELOG.md
r2617240 r2622003 1 1 # Changelog 2 3 ## [4.19.1] 4 5 ### Changed 6 - Added ability to set the max file size for the import log. Before each import starts the log size is measured and if the size exceeds the limit it will be truncated. The default log size is 25MB. In order to change defaults go to Setting > Diagnostics. Find and update the 'Log file max size' field 7 8 ### Fixed 9 10 - Fixed the 'New/Updated since last sync' import. The import will pull new products as well as update existing ones. Previously the 'New/Updated since last sync' updated existing products only 11 - Added ability to see product sync log errors description on the 'Diagnostic' tab 12 - Settings > Diagnostics > Product Sync Log sync statistics are displayed in the table separately for multiple channels 13 - Fixed 'Auto' sync behavior with enabled multichannel support. Added a filter bigcommerce/channels/map-products-to-all-channels filter defaulted to false 14 - When multi-channel is enabled and the filter is false, if the Auto sync is enabled, sync imports products that are connected to each channel only. 15 - When that multi-channel is enabled and that filter is true, if the Auto sync is enabled, newly added products to the catalog will be synced to all connected channels. 2 16 3 17 ## [4.19.0] … … 1628 1642 1629 1643 1644 [4.19.1]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/4.19.0...4.19.1 1630 1645 [4.19.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/4.18.0...4.19.0 1631 1646 [4.18.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/4.17.1...4.18.0 -
bigcommerce/tags/4.19.1/bigcommerce.php
r2617240 r2622003 4 4 Description: Scale your ecommerce business with WordPress on the front-end and BigCommerce on the back end. Free up server resources from things like catalog management, processing payments, and managing fulfillment logistics. 5 5 Author: BigCommerce 6 Version: 4.19. 06 Version: 4.19.1 7 7 Author URI: https://www.bigcommerce.com/wordpress 8 8 Requires PHP: 7.4.0 -
bigcommerce/tags/4.19.1/build-timestamp.php
r2617240 r2622003 1 1 <?php 2 define('BIGCOMMERCE_ASSETS_BUILD_TIMESTAMP', ' 5.23.10.19.2021');2 define('BIGCOMMERCE_ASSETS_BUILD_TIMESTAMP', '8.41.10.29.2021'); -
bigcommerce/tags/4.19.1/readme.txt
r2617240 r2622003 4 4 Requires at least: 5.2 5 5 Tested up to: 5.8.1 6 Stable tag: 4.19. 06 Stable tag: 4.19.1 7 7 Requires PHP: 7.4.0 8 8 License: GPLv2 or later -
bigcommerce/tags/4.19.1/src/BigCommerce/Import/Import_Type.php
r2574256 r2622003 30 30 /** 31 31 * @return array 32 * 32 * 33 33 * @filter bigcommerce_modified_product_ids 34 34 */ … … 59 59 /** 60 60 * Filter task list for partial imports 61 * 61 * 62 62 * @param array $task_list 63 63 * @return array 64 * 64 * 65 65 * @filter bigcommerce/import/task_list 66 66 */ … … 78 78 79 79 $task_state = $task->get_completion_state(); 80 if ( in_array( $task_state, $states ) || strpos( $task_state, Status::FETCHED_LISTINGS ) !== false ) { 80 81 $is_fetched_listings = strpos( $task_state, Status::FETCHED_LISTINGS ) !== false; 82 $is_initialized_channel = strpos( $task_state, Status::INITIALIZED_CHANNEL ) !== false; 83 84 if ( in_array( $task_state, $states ) || $is_fetched_listings || $is_initialized_channel ) { 81 85 return true; 82 86 } -
bigcommerce/tags/4.19.1/src/BigCommerce/Import/Processors/Channel_Initializer.php
r2342514 r2622003 12 12 use BigCommerce\Api\v3\Model\Variant; 13 13 use BigCommerce\Api\v3\ObjectSerializer; 14 use BigCommerce\Exceptions\Product_Not_Found_Exception; 15 use BigCommerce\Import\Import_Type; 14 16 use BigCommerce\Import\No_Cache_Options; 15 17 use BigCommerce\Import\Runner\Status; … … 17 19 use BigCommerce\Settings\Sections\Import; 18 20 use BigCommerce\Taxonomies\Channel\Channel; 21 use \BigCommerce\Post_Types\Product\Product as Product_Post_Type; 19 22 20 23 /** … … 63 66 } 64 67 68 /** 69 * Check if the product exists 70 * 71 * @param $product 72 * @param $channel_id 73 * 74 * @return bool 75 */ 76 private function is_existing_product( $product, $channel_id ): bool { 77 try { 78 $query_args = [ 'post_status' => [ 'publish', 'draft' ] ]; 79 Product_Post_Type::by_product_id( $product->getId(), $this->channel_term, $query_args ); 80 81 do_action( 'bigcommerce/log', Error_Log::DEBUG, __( 'Product entity exists. Skipping.', 'bigcommerce' ), [ 82 'product_id' => $product->getId(), 83 'channel_id' => $channel_id, 84 ] ); 85 86 return true; 87 } catch ( Product_Not_Found_Exception $e ) { 88 return false; 89 } 90 } 91 65 92 public function run() { 66 93 … … 73 100 74 101 return; 102 } 103 104 $listing_ids = []; 105 // Get the listings for this channel. 106 if ( $this->multichannel_sync_channel_listings() ) { 107 try { 108 $listings = $this->channels->listChannelListings( $channel_id ); 109 $listing_ids = array_map( function ( Listing $listing ) { 110 return $listing->getProductId(); 111 }, $listings->getData() ); 112 } catch ( ApiException $e ) { 113 do_action( 'bigcommerce/import/error', $e->getMessage(), [ 114 'response' => $e->getResponseBody(), 115 'headers' => $e->getResponseHeaders(), 116 ] ); 117 do_action( 'bigcommerce/log', Error_Log::DEBUG, $e->getTraceAsString(), [] ); 118 119 return; 120 } 75 121 } 76 122 … … 111 157 $id_map = $this->get_option( Listing_Fetcher::PRODUCT_LISTING_MAP, [] ) ?: []; 112 158 113 $listing_requests = array_values( array_filter( array_map( function ( Product $product ) use ( $channel_id, $id_map ) { 159 $import_type = get_option( Import_Type::IMPORT_TYPE ); 160 161 $listing_requests = array_values( array_filter( array_map( function ( Product $product ) use ( $channel_id, $id_map, $import_type, $listing_ids ) { 162 /** 163 * We will skip existing products listing creation for partial import 164 */ 165 if ( $import_type === Import_Type::IMPORT_TYPE_PARTIAL && $this->is_existing_product( $product, $channel_id ) ) { 166 return false; 167 } 168 114 169 if ( array_key_exists( $product->getId(), $id_map ) && array_key_exists( $this->channel_term->term_id, $id_map[ $product->getId() ] ) ) { 115 170 do_action( 'bigcommerce/log', Error_Log::DEBUG, __( 'Product already linked to channel. Skipping.', 'bigcommerce' ), [ 171 'product_id' => $product->getId(), 172 'channel_id' => $channel_id, 173 ] ); 174 175 return false; 176 } 177 178 // Return if this product should not be synced to this channel. 179 if ( $this->multichannel_sync_channel_listings() && ! in_array( $product->getId(), $listing_ids ) ) { 180 do_action( 'bigcommerce/log', Error_Log::DEBUG, __( 'Product does not belong in this channel. Skipping.', 'bigcommerce' ), [ 116 181 'product_id' => $product->getId(), 117 182 'channel_id' => $channel_id, … … 207 272 return sprintf( '%s-%d', self::STATE_OPTION, $this->channel_term->term_id ); 208 273 } 274 275 private function multichannel_sync_channel_listings() { 276 return ( Channel::multichannel_enabled() && ! Channel::multichannel_sync_to_all_channels() ); 277 } 209 278 } -
bigcommerce/tags/4.19.1/src/BigCommerce/Logging/Error_Log.php
r2034554 r2622003 4 4 5 5 use BigCommerce\Api\v3\Api\CatalogApi; 6 use BigCommerce\Settings\Sections\Troubleshooting_Diagnostics; 6 7 use Monolog\Logger; 7 8 use Monolog\Handler\StreamHandler; … … 13 14 */ 14 15 class Error_Log { 15 const EMERGENCY = 'emergency'; 16 const ALERT = 'alert'; 17 const CRITICAL = 'critical'; 18 const ERROR = 'error'; 19 const WARNING = 'warning'; 20 const NOTICE = 'notice'; 21 const INFO = 'info'; 22 const DEBUG = 'debug'; 16 const EMERGENCY = 'emergency'; 17 const ALERT = 'alert'; 18 const CRITICAL = 'critical'; 19 const ERROR = 'error'; 20 const WARNING = 'warning'; 21 const NOTICE = 'notice'; 22 const INFO = 'info'; 23 const DEBUG = 'debug'; 24 const MAX_SIZE = 25; 23 25 24 26 /** … … 168 170 169 171 /** 170 * Delete Log content172 * Clean log file if it has size more than set in Troubleshooting_Diagnostics::LOG_FILE_SIZE 171 173 */ 172 174 public function truncate_log() { 173 if ( file_exists( $this->log_path ) ) { 174 // Truncate file 175 $file = fopen( $this->log_path, "w" ); 176 fclose( $file ); 177 } 175 if ( ! file_exists( $this->log_path ) ) { 176 return; 177 } 178 179 $log_size = $this->get_log_size_mb(); 180 $max_allowed_size = (int) get_option( Troubleshooting_Diagnostics::LOG_FILE_SIZE, self::MAX_SIZE ); 181 182 /** 183 * Exit from function if file size lower than set in settings 184 */ 185 if ( $log_size < $max_allowed_size ) { 186 return; 187 } 188 189 /** 190 * Clean log file contents 191 */ 192 $file = fopen( $this->log_path, "w" ); 193 fclose( $file ); 194 } 195 196 /** 197 * Get log file size in MB 198 * @return float|int 199 */ 200 public function get_log_size_mb() { 201 if ( ! file_exists( $this->log_path ) ) { 202 return 0; 203 } 204 205 /** 206 * Get log size in bytes 207 */ 208 $file_size = filesize( $this->log_path ); 209 210 /** 211 * Return the size of log file in MB 212 */ 213 return round( $file_size / 1024 / 1024, 1 ); 178 214 } 179 215 -
bigcommerce/tags/4.19.1/src/BigCommerce/Plugin.php
r2617240 r2622003 5 5 6 6 class Plugin { 7 const VERSION = '4.19. 0';7 const VERSION = '4.19.1'; 8 8 9 9 protected static $_instance; -
bigcommerce/tags/4.19.1/src/BigCommerce/Post_Types/Sync_Log/Sync_Log.php
r2538746 r2622003 4 4 namespace BigCommerce\Post_Types\Sync_Log; 5 5 6 use BigCommerce\ Import\Runner\Status;6 use BigCommerce\Post_Types\Product\Product; 7 7 use BigCommerce\Settings\Import_Status; 8 use BigCommerce\Post_Types\Product\Product; 8 use BigCommerce\Taxonomies\Channel\Channel; 9 use BigCommerce\Taxonomies\Channel\Connections; 9 10 10 11 class Sync_Log { … … 12 13 const NAME = 'bigcommerce_sync_log'; 13 14 14 const META_STATUS = 'status'; 15 const META_EVENT = 'event'; 16 const META_ERRORS = 'errors'; 17 const META_SUMMARY = 'summary'; 18 const META_DURATION = 'duration'; 15 const META_STATUS = 'status'; 16 const META_EVENT = 'event'; 17 const META_ERRORS = 'errors'; 18 const META_SUMMARY = 'summary'; 19 const META_DURATION = 'duration'; 20 const MULTICHANNEL_SUMMARY = 'multichannel_summary'; 21 // We need to know if multichannel was active during this log session. 22 const MULTICHANNEL_ACTIVE = 'multichannel_active'; 23 24 // Track the sync_id so we don't have to get_posts mulitple times. 25 private $sync_id = 0; 19 26 20 27 /** … … 29 36 30 37 $post_id = wp_insert_post( [ 31 'post_title' => __( 'Sync in progress', 'bigcommerce' ),32 'post_type' => self::NAME,33 'post_status' => 'draft',38 'post_title' => __( 'Sync in progress', 'bigcommerce' ), 39 'post_type' => self::NAME, 40 'post_status' => 'draft', 34 41 ] ); 35 42 update_post_meta( $post_id, self::META_ERRORS, [] ); … … 37 44 'count_before' => wp_count_posts( Product::NAME )->publish, 38 45 ] ); 46 47 // Gather extra data for multichannel 48 if ( Channel::multichannel_enabled() ) { 49 update_post_meta( $post_id, self::MULTICHANNEL_ACTIVE, true ); 50 $connections = new Connections(); 51 52 // Get the existing meta 53 $multichannel_summary = get_post_meta( $post_id, self::MULTICHANNEL_SUMMARY, true ); 54 $multichannel_summary = is_array( $multichannel_summary ) ? $multichannel_summary : []; 55 56 foreach ( $connections->active() as $channel ) { 57 $multichannel_summary[ $channel->term_id ] = [ 58 'count_before' => $channel->count, 59 ]; 60 } 61 62 // And update the meta 63 update_post_meta( 64 $post_id, 65 self::MULTICHANNEL_SUMMARY, 66 $multichannel_summary 67 ); 68 } 39 69 } 40 70 … … 43 73 * 44 74 * @param array $log The current log 75 * 45 76 * @return void 46 77 * … … 83 114 update_post_meta( $post_id, self::META_SUMMARY, $summary ); 84 115 116 if ( Channel::multichannel_enabled() ) { 117 // Get the existing meta 118 $multichannel_summary = get_post_meta( $post_id, self::MULTICHANNEL_SUMMARY, true ); 119 $multichannel_summary = is_array( $multichannel_summary ) ? $multichannel_summary : []; 120 121 foreach ( $multichannel_summary as $term_id => $summary ) { 122 $summary['count_after'] = get_term( $term_id )->count; 123 $summary['channel_name'] = get_term( $term_id )->name; 124 125 $multichannel_summary[ $term_id ] = $summary; 126 } 127 128 // And update the meta 129 update_post_meta( 130 $post_id, 131 self::MULTICHANNEL_SUMMARY, 132 $multichannel_summary 133 ); 134 } 135 85 136 $this->remove_old_syncs( 'publish', 10 ); 86 137 } … … 102 153 $errors = get_post_meta( $post_id, self::META_ERRORS, true ); 103 154 104 if ( empty( $errors ) ) {155 if ( ! is_array ($errors) || empty( $errors ) ) { 105 156 $errors = []; 106 157 } … … 108 159 $errors[] = $error; 109 160 110 update_post_meta( $post_id, self::META_ERRORS, $error );161 update_post_meta( $post_id, self::META_ERRORS, $errors ); 111 162 } 112 163 … … 129 180 $sync_log_data = []; 130 181 foreach ( $sync_logs as $index => $sync_log ) { 131 $status = $sync_log->{self::META_STATUS};132 $errors = $sync_log->{self::META_ERRORS};182 $status = $sync_log->{self::META_STATUS}; 183 $errors = $sync_log->{self::META_ERRORS}; 133 184 134 185 $sync_log_data[] = sprintf( … … 143 194 $index + 1, 144 195 ucfirst( $status ), 145 $this->get_summary_formatted( $sync_log ), 196 $sync_log->{self::MULTICHANNEL_ACTIVE} 197 ? $this->get_multichannel_summary_formatted( $sync_log ) 198 : $this->get_summary_formatted( $sync_log ), 146 199 is_array( $errors ) && count( $errors ) ? implode( '<br>', $errors ) : __( 'None', 'bigcommerce' ), 147 200 $sync_log->{self::META_DURATION}, … … 151 204 152 205 $sync_log_data = sprintf( 153 '<table class="bc-product-sync-data-table"> 206 '<style> 207 .bc-product-sync-data-table tr:nth-child(odd) { 208 background-color: #f2f2f2; 209 } 210 </style> 211 <table class="bc-product-sync-data-table"> 154 212 <tr> 155 213 <th>#</th> … … 178 236 'label' => '', 179 237 'key' => 'sync_logs', 180 'value' => $sync_log_data 181 ] 238 'value' => $sync_log_data, 239 ], 182 240 ], 183 241 ]; … … 190 248 * 191 249 * @param \WP_Post $post 250 * 192 251 * @return string 193 252 */ 194 private function get_post_date_formatted( $post ) {253 private function get_post_date_formatted( $post ) { 195 254 $date_format = sprintf( 196 255 '%s %s', … … 198 257 get_option( 'time_format', 'H:i' ) 199 258 ); 259 200 260 return get_the_date( $date_format, $post ); 201 261 } … … 211 271 $timezone = 'UTC' . $timezone; 212 272 } 273 213 274 return $timezone; 214 275 } … … 220 281 */ 221 282 private function get_current_sync_id() { 283 // Track the sync id so we can write the error after post status update. 284 if ( $this->sync_id ) { 285 return $this->sync_id; 286 } 287 222 288 $draft = get_posts( [ 223 289 'post_type' => self::NAME, … … 227 293 ] ); 228 294 229 return reset( $draft ); 295 $this->sync_id = reset( $draft ); 296 297 return $this->sync_id; 230 298 } 231 299 … … 239 307 'post_type' => self::NAME, 240 308 'post_status' => $status, 241 'posts_per_page' => - 1,309 'posts_per_page' => - 1, 242 310 'fields' => 'ids', 243 311 ] ); … … 247 315 } 248 316 249 foreach ( $sync_logs as $index => $post_id ) {317 foreach ( $sync_logs as $index => $post_id ) { 250 318 if ( $index < $keep ) { 251 319 continue; … … 259 327 * 260 328 * @param \WP_Post $sync_log 329 * 261 330 * @return string 262 331 */ … … 286 355 287 356 $out = array_map( function ( $line ) { 288 return sprintf( '<span class="bc-sync-summary-meta">%s</span> ', $line );357 return sprintf( '<span class="bc-sync-summary-meta">%s</span><br />', $line ); 289 358 }, $out ); 290 359 … … 292 361 } 293 362 363 /** 364 * Get formatted summary 365 * 366 * @param \WP_Post $sync_log 367 * 368 * @return string 369 */ 370 private function get_multichannel_summary_formatted( $sync_log ) { 371 $multichannel_summary = $sync_log->{self::MULTICHANNEL_SUMMARY}; 372 373 $summary = []; 374 375 foreach ( $multichannel_summary as $channel ) { 376 $count_before = $channel['count_before'] ?? 0; 377 $count_after = $channel['count_after'] ?? 0; 378 $new = $count_after - $count_before; 379 380 $summary[] = sprintf( __( '<br /><b>%s</b>', 'bigcommerce' ), $channel['channel_name'] ); 381 $summary[] = sprintf( __( '%d Synced', 'bigcommerce' ), $channel['count_after'] ); 382 if ( $new > 0 ) { 383 $summary[] = sprintf( __( '%d Added', 'bigcommerce' ), $new ); 384 } 385 386 $summary = array_map( function ( $line ) { 387 return sprintf( '<span class="bc-sync-summary-meta">%s</span>', $line ); 388 }, $summary ); 389 } 390 391 return implode( '<br />', $summary ); 392 } 294 393 } -
bigcommerce/tags/4.19.1/src/BigCommerce/Settings/Sections/Troubleshooting_Diagnostics.php
r2617240 r2622003 28 28 const TEXTBOX_NAME = 'bigcommerce_diagnostics_output'; 29 29 const LOG_ERRORS = 'bigcommerce_diagnostics_log_import_errors'; 30 const LOG_FILE_SIZE = 'bigcommerce_diagnostics_log_file_size'; 30 31 const SYNC_SITE_URL = 'bigcommerce_diagnostics_sync_site_url'; 31 32 … … 90 91 ); 91 92 93 register_setting( 94 Settings_Screen::NAME, 95 self::LOG_FILE_SIZE 96 ); 97 98 add_settings_field( 99 self::LOG_FILE_SIZE, 100 esc_html( __( 'Log file max size(MB)', 'bigcommerce' ) ), 101 [ $this, 'render_log_file_size', ], 102 Settings_Screen::NAME, 103 self::NAME, 104 [ 105 'min' => 1, 106 'max' => 25, 107 'type' => 'number', 108 'option' => self::LOG_FILE_SIZE, 109 'label' => esc_html( __( 'Set log file size', 'bigcommerce' ) ), 110 'description' => esc_html( __( 'Set log file max size in MB. If log file exceeds the limit it will be cleaned before new import', 'bigcommerce' ) ), 111 ] 112 ); 113 92 114 add_settings_field( 93 115 self::DIAGNOSTICS_NAME, … … 136 158 } 137 159 160 public function render_log_file_size( $args ) { 161 $value = get_option( $args[ 'option' ], 25 ); 162 $min = isset( $args[ 'min' ] ) ? sprintf( 'min="%d"', $args[ 'min' ] ) : ''; 163 $max = isset( $args[ 'max' ] ) ? sprintf( 'max="%d"', $args[ 'max' ] ) : ''; 164 $field = sprintf( '<input type="%1$s" value="%2$s" name="%3$s" id="%3$s" %4$s %5$s />', esc_attr( $args[ 'type' ] ), esc_attr( $value ), esc_attr( $args[ 'option' ] ), $min, $max ); 165 printf( '%s<p class="description">%s</p>', $field, esc_html( $args[ 'description' ] ) ); 166 } 167 138 168 /** 139 169 * Sets a wp_send_json answer for the ajax call that holds -
bigcommerce/tags/4.19.1/src/BigCommerce/Taxonomies/Channel/Channel.php
r2141486 r2622003 37 37 38 38 /** 39 * Should product sync be to all channels? 40 * 41 * @return bool 42 */ 43 public static function multichannel_sync_to_all_channels() { 44 /** 45 * Filter whether multi-channel sync should sync to all channels. 46 * Enabling this feature allows site owners to 47 * connect to sync products to all channels or 48 * only the channel it is assigned to. 49 * 50 * @param bool $enabled 51 */ 52 return (bool) apply_filters( 'bigcommerce/channels/map-products-to-all-channels', false ); 53 } 54 55 /** 39 56 * @param int $channel_id 40 57 * -
bigcommerce/tags/4.19.1/vendor/autoload.php
r2617240 r2622003 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit 509873e0fe5d4df74a0ea698def2e38f::getLoader();7 return ComposerAutoloaderInit00d9fec88dbb4fdf0216f882209f6119::getLoader(); -
bigcommerce/tags/4.19.1/vendor/composer/autoload_real.php
r2617240 r2622003 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 509873e0fe5d4df74a0ea698def2e38f5 class ComposerAutoloaderInit00d9fec88dbb4fdf0216f882209f6119 6 6 { 7 7 private static $loader; … … 20 20 } 21 21 22 spl_autoload_register(array('ComposerAutoloaderInit 509873e0fe5d4df74a0ea698def2e38f', 'loadClassLoader'), true, true);22 spl_autoload_register(array('ComposerAutoloaderInit00d9fec88dbb4fdf0216f882209f6119', 'loadClassLoader'), true, true); 23 23 self::$loader = $loader = new \Composer\Autoload\ClassLoader(); 24 spl_autoload_unregister(array('ComposerAutoloaderInit 509873e0fe5d4df74a0ea698def2e38f', 'loadClassLoader'));24 spl_autoload_unregister(array('ComposerAutoloaderInit00d9fec88dbb4fdf0216f882209f6119', 'loadClassLoader')); 25 25 26 26 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 28 28 require_once __DIR__ . '/autoload_static.php'; 29 29 30 call_user_func(\Composer\Autoload\ComposerStaticInit 509873e0fe5d4df74a0ea698def2e38f::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInit00d9fec88dbb4fdf0216f882209f6119::getInitializer($loader)); 31 31 } else { 32 32 $classMap = require __DIR__ . '/autoload_classmap.php'; … … 40 40 41 41 if ($useStaticLoader) { 42 $includeFiles = Composer\Autoload\ComposerStaticInit 509873e0fe5d4df74a0ea698def2e38f::$files;42 $includeFiles = Composer\Autoload\ComposerStaticInit00d9fec88dbb4fdf0216f882209f6119::$files; 43 43 } else { 44 44 $includeFiles = require __DIR__ . '/autoload_files.php'; 45 45 } 46 46 foreach ($includeFiles as $fileIdentifier => $file) { 47 composerRequire 509873e0fe5d4df74a0ea698def2e38f($fileIdentifier, $file);47 composerRequire00d9fec88dbb4fdf0216f882209f6119($fileIdentifier, $file); 48 48 } 49 49 … … 52 52 } 53 53 54 function composerRequire 509873e0fe5d4df74a0ea698def2e38f($fileIdentifier, $file)54 function composerRequire00d9fec88dbb4fdf0216f882209f6119($fileIdentifier, $file) 55 55 { 56 56 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
bigcommerce/tags/4.19.1/vendor/composer/autoload_static.php
r2617240 r2622003 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 509873e0fe5d4df74a0ea698def2e38f7 class ComposerStaticInit00d9fec88dbb4fdf0216f882209f6119 8 8 { 9 9 public static $files = array ( … … 1124 1124 { 1125 1125 return \Closure::bind(function () use ($loader) { 1126 $loader->prefixLengthsPsr4 = ComposerStaticInit 509873e0fe5d4df74a0ea698def2e38f::$prefixLengthsPsr4;1127 $loader->prefixDirsPsr4 = ComposerStaticInit 509873e0fe5d4df74a0ea698def2e38f::$prefixDirsPsr4;1128 $loader->prefixesPsr0 = ComposerStaticInit 509873e0fe5d4df74a0ea698def2e38f::$prefixesPsr0;1129 $loader->classMap = ComposerStaticInit 509873e0fe5d4df74a0ea698def2e38f::$classMap;1126 $loader->prefixLengthsPsr4 = ComposerStaticInit00d9fec88dbb4fdf0216f882209f6119::$prefixLengthsPsr4; 1127 $loader->prefixDirsPsr4 = ComposerStaticInit00d9fec88dbb4fdf0216f882209f6119::$prefixDirsPsr4; 1128 $loader->prefixesPsr0 = ComposerStaticInit00d9fec88dbb4fdf0216f882209f6119::$prefixesPsr0; 1129 $loader->classMap = ComposerStaticInit00d9fec88dbb4fdf0216f882209f6119::$classMap; 1130 1130 1131 1131 }, null, ClassLoader::class); -
bigcommerce/trunk/CHANGELOG.md
r2617240 r2622003 1 1 # Changelog 2 3 ## [4.19.1] 4 5 ### Changed 6 - Added ability to set the max file size for the import log. Before each import starts the log size is measured and if the size exceeds the limit it will be truncated. The default log size is 25MB. In order to change defaults go to Setting > Diagnostics. Find and update the 'Log file max size' field 7 8 ### Fixed 9 10 - Fixed the 'New/Updated since last sync' import. The import will pull new products as well as update existing ones. Previously the 'New/Updated since last sync' updated existing products only 11 - Added ability to see product sync log errors description on the 'Diagnostic' tab 12 - Settings > Diagnostics > Product Sync Log sync statistics are displayed in the table separately for multiple channels 13 - Fixed 'Auto' sync behavior with enabled multichannel support. Added a filter bigcommerce/channels/map-products-to-all-channels filter defaulted to false 14 - When multi-channel is enabled and the filter is false, if the Auto sync is enabled, sync imports products that are connected to each channel only. 15 - When that multi-channel is enabled and that filter is true, if the Auto sync is enabled, newly added products to the catalog will be synced to all connected channels. 2 16 3 17 ## [4.19.0] … … 1628 1642 1629 1643 1644 [4.19.1]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/4.19.0...4.19.1 1630 1645 [4.19.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/4.18.0...4.19.0 1631 1646 [4.18.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/4.17.1...4.18.0 -
bigcommerce/trunk/bigcommerce.php
r2617240 r2622003 4 4 Description: Scale your ecommerce business with WordPress on the front-end and BigCommerce on the back end. Free up server resources from things like catalog management, processing payments, and managing fulfillment logistics. 5 5 Author: BigCommerce 6 Version: 4.19. 06 Version: 4.19.1 7 7 Author URI: https://www.bigcommerce.com/wordpress 8 8 Requires PHP: 7.4.0 -
bigcommerce/trunk/build-timestamp.php
r2617240 r2622003 1 1 <?php 2 define('BIGCOMMERCE_ASSETS_BUILD_TIMESTAMP', ' 5.23.10.19.2021');2 define('BIGCOMMERCE_ASSETS_BUILD_TIMESTAMP', '8.41.10.29.2021'); -
bigcommerce/trunk/readme.txt
r2617240 r2622003 4 4 Requires at least: 5.2 5 5 Tested up to: 5.8.1 6 Stable tag: 4.19. 06 Stable tag: 4.19.1 7 7 Requires PHP: 7.4.0 8 8 License: GPLv2 or later -
bigcommerce/trunk/src/BigCommerce/Import/Import_Type.php
r2574256 r2622003 30 30 /** 31 31 * @return array 32 * 32 * 33 33 * @filter bigcommerce_modified_product_ids 34 34 */ … … 59 59 /** 60 60 * Filter task list for partial imports 61 * 61 * 62 62 * @param array $task_list 63 63 * @return array 64 * 64 * 65 65 * @filter bigcommerce/import/task_list 66 66 */ … … 78 78 79 79 $task_state = $task->get_completion_state(); 80 if ( in_array( $task_state, $states ) || strpos( $task_state, Status::FETCHED_LISTINGS ) !== false ) { 80 81 $is_fetched_listings = strpos( $task_state, Status::FETCHED_LISTINGS ) !== false; 82 $is_initialized_channel = strpos( $task_state, Status::INITIALIZED_CHANNEL ) !== false; 83 84 if ( in_array( $task_state, $states ) || $is_fetched_listings || $is_initialized_channel ) { 81 85 return true; 82 86 } -
bigcommerce/trunk/src/BigCommerce/Import/Processors/Channel_Initializer.php
r2342514 r2622003 12 12 use BigCommerce\Api\v3\Model\Variant; 13 13 use BigCommerce\Api\v3\ObjectSerializer; 14 use BigCommerce\Exceptions\Product_Not_Found_Exception; 15 use BigCommerce\Import\Import_Type; 14 16 use BigCommerce\Import\No_Cache_Options; 15 17 use BigCommerce\Import\Runner\Status; … … 17 19 use BigCommerce\Settings\Sections\Import; 18 20 use BigCommerce\Taxonomies\Channel\Channel; 21 use \BigCommerce\Post_Types\Product\Product as Product_Post_Type; 19 22 20 23 /** … … 63 66 } 64 67 68 /** 69 * Check if the product exists 70 * 71 * @param $product 72 * @param $channel_id 73 * 74 * @return bool 75 */ 76 private function is_existing_product( $product, $channel_id ): bool { 77 try { 78 $query_args = [ 'post_status' => [ 'publish', 'draft' ] ]; 79 Product_Post_Type::by_product_id( $product->getId(), $this->channel_term, $query_args ); 80 81 do_action( 'bigcommerce/log', Error_Log::DEBUG, __( 'Product entity exists. Skipping.', 'bigcommerce' ), [ 82 'product_id' => $product->getId(), 83 'channel_id' => $channel_id, 84 ] ); 85 86 return true; 87 } catch ( Product_Not_Found_Exception $e ) { 88 return false; 89 } 90 } 91 65 92 public function run() { 66 93 … … 73 100 74 101 return; 102 } 103 104 $listing_ids = []; 105 // Get the listings for this channel. 106 if ( $this->multichannel_sync_channel_listings() ) { 107 try { 108 $listings = $this->channels->listChannelListings( $channel_id ); 109 $listing_ids = array_map( function ( Listing $listing ) { 110 return $listing->getProductId(); 111 }, $listings->getData() ); 112 } catch ( ApiException $e ) { 113 do_action( 'bigcommerce/import/error', $e->getMessage(), [ 114 'response' => $e->getResponseBody(), 115 'headers' => $e->getResponseHeaders(), 116 ] ); 117 do_action( 'bigcommerce/log', Error_Log::DEBUG, $e->getTraceAsString(), [] ); 118 119 return; 120 } 75 121 } 76 122 … … 111 157 $id_map = $this->get_option( Listing_Fetcher::PRODUCT_LISTING_MAP, [] ) ?: []; 112 158 113 $listing_requests = array_values( array_filter( array_map( function ( Product $product ) use ( $channel_id, $id_map ) { 159 $import_type = get_option( Import_Type::IMPORT_TYPE ); 160 161 $listing_requests = array_values( array_filter( array_map( function ( Product $product ) use ( $channel_id, $id_map, $import_type, $listing_ids ) { 162 /** 163 * We will skip existing products listing creation for partial import 164 */ 165 if ( $import_type === Import_Type::IMPORT_TYPE_PARTIAL && $this->is_existing_product( $product, $channel_id ) ) { 166 return false; 167 } 168 114 169 if ( array_key_exists( $product->getId(), $id_map ) && array_key_exists( $this->channel_term->term_id, $id_map[ $product->getId() ] ) ) { 115 170 do_action( 'bigcommerce/log', Error_Log::DEBUG, __( 'Product already linked to channel. Skipping.', 'bigcommerce' ), [ 171 'product_id' => $product->getId(), 172 'channel_id' => $channel_id, 173 ] ); 174 175 return false; 176 } 177 178 // Return if this product should not be synced to this channel. 179 if ( $this->multichannel_sync_channel_listings() && ! in_array( $product->getId(), $listing_ids ) ) { 180 do_action( 'bigcommerce/log', Error_Log::DEBUG, __( 'Product does not belong in this channel. Skipping.', 'bigcommerce' ), [ 116 181 'product_id' => $product->getId(), 117 182 'channel_id' => $channel_id, … … 207 272 return sprintf( '%s-%d', self::STATE_OPTION, $this->channel_term->term_id ); 208 273 } 274 275 private function multichannel_sync_channel_listings() { 276 return ( Channel::multichannel_enabled() && ! Channel::multichannel_sync_to_all_channels() ); 277 } 209 278 } -
bigcommerce/trunk/src/BigCommerce/Logging/Error_Log.php
r2034554 r2622003 4 4 5 5 use BigCommerce\Api\v3\Api\CatalogApi; 6 use BigCommerce\Settings\Sections\Troubleshooting_Diagnostics; 6 7 use Monolog\Logger; 7 8 use Monolog\Handler\StreamHandler; … … 13 14 */ 14 15 class Error_Log { 15 const EMERGENCY = 'emergency'; 16 const ALERT = 'alert'; 17 const CRITICAL = 'critical'; 18 const ERROR = 'error'; 19 const WARNING = 'warning'; 20 const NOTICE = 'notice'; 21 const INFO = 'info'; 22 const DEBUG = 'debug'; 16 const EMERGENCY = 'emergency'; 17 const ALERT = 'alert'; 18 const CRITICAL = 'critical'; 19 const ERROR = 'error'; 20 const WARNING = 'warning'; 21 const NOTICE = 'notice'; 22 const INFO = 'info'; 23 const DEBUG = 'debug'; 24 const MAX_SIZE = 25; 23 25 24 26 /** … … 168 170 169 171 /** 170 * Delete Log content172 * Clean log file if it has size more than set in Troubleshooting_Diagnostics::LOG_FILE_SIZE 171 173 */ 172 174 public function truncate_log() { 173 if ( file_exists( $this->log_path ) ) { 174 // Truncate file 175 $file = fopen( $this->log_path, "w" ); 176 fclose( $file ); 177 } 175 if ( ! file_exists( $this->log_path ) ) { 176 return; 177 } 178 179 $log_size = $this->get_log_size_mb(); 180 $max_allowed_size = (int) get_option( Troubleshooting_Diagnostics::LOG_FILE_SIZE, self::MAX_SIZE ); 181 182 /** 183 * Exit from function if file size lower than set in settings 184 */ 185 if ( $log_size < $max_allowed_size ) { 186 return; 187 } 188 189 /** 190 * Clean log file contents 191 */ 192 $file = fopen( $this->log_path, "w" ); 193 fclose( $file ); 194 } 195 196 /** 197 * Get log file size in MB 198 * @return float|int 199 */ 200 public function get_log_size_mb() { 201 if ( ! file_exists( $this->log_path ) ) { 202 return 0; 203 } 204 205 /** 206 * Get log size in bytes 207 */ 208 $file_size = filesize( $this->log_path ); 209 210 /** 211 * Return the size of log file in MB 212 */ 213 return round( $file_size / 1024 / 1024, 1 ); 178 214 } 179 215 -
bigcommerce/trunk/src/BigCommerce/Plugin.php
r2617240 r2622003 5 5 6 6 class Plugin { 7 const VERSION = '4.19. 0';7 const VERSION = '4.19.1'; 8 8 9 9 protected static $_instance; -
bigcommerce/trunk/src/BigCommerce/Post_Types/Sync_Log/Sync_Log.php
r2538746 r2622003 4 4 namespace BigCommerce\Post_Types\Sync_Log; 5 5 6 use BigCommerce\ Import\Runner\Status;6 use BigCommerce\Post_Types\Product\Product; 7 7 use BigCommerce\Settings\Import_Status; 8 use BigCommerce\Post_Types\Product\Product; 8 use BigCommerce\Taxonomies\Channel\Channel; 9 use BigCommerce\Taxonomies\Channel\Connections; 9 10 10 11 class Sync_Log { … … 12 13 const NAME = 'bigcommerce_sync_log'; 13 14 14 const META_STATUS = 'status'; 15 const META_EVENT = 'event'; 16 const META_ERRORS = 'errors'; 17 const META_SUMMARY = 'summary'; 18 const META_DURATION = 'duration'; 15 const META_STATUS = 'status'; 16 const META_EVENT = 'event'; 17 const META_ERRORS = 'errors'; 18 const META_SUMMARY = 'summary'; 19 const META_DURATION = 'duration'; 20 const MULTICHANNEL_SUMMARY = 'multichannel_summary'; 21 // We need to know if multichannel was active during this log session. 22 const MULTICHANNEL_ACTIVE = 'multichannel_active'; 23 24 // Track the sync_id so we don't have to get_posts mulitple times. 25 private $sync_id = 0; 19 26 20 27 /** … … 29 36 30 37 $post_id = wp_insert_post( [ 31 'post_title' => __( 'Sync in progress', 'bigcommerce' ),32 'post_type' => self::NAME,33 'post_status' => 'draft',38 'post_title' => __( 'Sync in progress', 'bigcommerce' ), 39 'post_type' => self::NAME, 40 'post_status' => 'draft', 34 41 ] ); 35 42 update_post_meta( $post_id, self::META_ERRORS, [] ); … … 37 44 'count_before' => wp_count_posts( Product::NAME )->publish, 38 45 ] ); 46 47 // Gather extra data for multichannel 48 if ( Channel::multichannel_enabled() ) { 49 update_post_meta( $post_id, self::MULTICHANNEL_ACTIVE, true ); 50 $connections = new Connections(); 51 52 // Get the existing meta 53 $multichannel_summary = get_post_meta( $post_id, self::MULTICHANNEL_SUMMARY, true ); 54 $multichannel_summary = is_array( $multichannel_summary ) ? $multichannel_summary : []; 55 56 foreach ( $connections->active() as $channel ) { 57 $multichannel_summary[ $channel->term_id ] = [ 58 'count_before' => $channel->count, 59 ]; 60 } 61 62 // And update the meta 63 update_post_meta( 64 $post_id, 65 self::MULTICHANNEL_SUMMARY, 66 $multichannel_summary 67 ); 68 } 39 69 } 40 70 … … 43 73 * 44 74 * @param array $log The current log 75 * 45 76 * @return void 46 77 * … … 83 114 update_post_meta( $post_id, self::META_SUMMARY, $summary ); 84 115 116 if ( Channel::multichannel_enabled() ) { 117 // Get the existing meta 118 $multichannel_summary = get_post_meta( $post_id, self::MULTICHANNEL_SUMMARY, true ); 119 $multichannel_summary = is_array( $multichannel_summary ) ? $multichannel_summary : []; 120 121 foreach ( $multichannel_summary as $term_id => $summary ) { 122 $summary['count_after'] = get_term( $term_id )->count; 123 $summary['channel_name'] = get_term( $term_id )->name; 124 125 $multichannel_summary[ $term_id ] = $summary; 126 } 127 128 // And update the meta 129 update_post_meta( 130 $post_id, 131 self::MULTICHANNEL_SUMMARY, 132 $multichannel_summary 133 ); 134 } 135 85 136 $this->remove_old_syncs( 'publish', 10 ); 86 137 } … … 102 153 $errors = get_post_meta( $post_id, self::META_ERRORS, true ); 103 154 104 if ( empty( $errors ) ) {155 if ( ! is_array ($errors) || empty( $errors ) ) { 105 156 $errors = []; 106 157 } … … 108 159 $errors[] = $error; 109 160 110 update_post_meta( $post_id, self::META_ERRORS, $error );161 update_post_meta( $post_id, self::META_ERRORS, $errors ); 111 162 } 112 163 … … 129 180 $sync_log_data = []; 130 181 foreach ( $sync_logs as $index => $sync_log ) { 131 $status = $sync_log->{self::META_STATUS};132 $errors = $sync_log->{self::META_ERRORS};182 $status = $sync_log->{self::META_STATUS}; 183 $errors = $sync_log->{self::META_ERRORS}; 133 184 134 185 $sync_log_data[] = sprintf( … … 143 194 $index + 1, 144 195 ucfirst( $status ), 145 $this->get_summary_formatted( $sync_log ), 196 $sync_log->{self::MULTICHANNEL_ACTIVE} 197 ? $this->get_multichannel_summary_formatted( $sync_log ) 198 : $this->get_summary_formatted( $sync_log ), 146 199 is_array( $errors ) && count( $errors ) ? implode( '<br>', $errors ) : __( 'None', 'bigcommerce' ), 147 200 $sync_log->{self::META_DURATION}, … … 151 204 152 205 $sync_log_data = sprintf( 153 '<table class="bc-product-sync-data-table"> 206 '<style> 207 .bc-product-sync-data-table tr:nth-child(odd) { 208 background-color: #f2f2f2; 209 } 210 </style> 211 <table class="bc-product-sync-data-table"> 154 212 <tr> 155 213 <th>#</th> … … 178 236 'label' => '', 179 237 'key' => 'sync_logs', 180 'value' => $sync_log_data 181 ] 238 'value' => $sync_log_data, 239 ], 182 240 ], 183 241 ]; … … 190 248 * 191 249 * @param \WP_Post $post 250 * 192 251 * @return string 193 252 */ 194 private function get_post_date_formatted( $post ) {253 private function get_post_date_formatted( $post ) { 195 254 $date_format = sprintf( 196 255 '%s %s', … … 198 257 get_option( 'time_format', 'H:i' ) 199 258 ); 259 200 260 return get_the_date( $date_format, $post ); 201 261 } … … 211 271 $timezone = 'UTC' . $timezone; 212 272 } 273 213 274 return $timezone; 214 275 } … … 220 281 */ 221 282 private function get_current_sync_id() { 283 // Track the sync id so we can write the error after post status update. 284 if ( $this->sync_id ) { 285 return $this->sync_id; 286 } 287 222 288 $draft = get_posts( [ 223 289 'post_type' => self::NAME, … … 227 293 ] ); 228 294 229 return reset( $draft ); 295 $this->sync_id = reset( $draft ); 296 297 return $this->sync_id; 230 298 } 231 299 … … 239 307 'post_type' => self::NAME, 240 308 'post_status' => $status, 241 'posts_per_page' => - 1,309 'posts_per_page' => - 1, 242 310 'fields' => 'ids', 243 311 ] ); … … 247 315 } 248 316 249 foreach ( $sync_logs as $index => $post_id ) {317 foreach ( $sync_logs as $index => $post_id ) { 250 318 if ( $index < $keep ) { 251 319 continue; … … 259 327 * 260 328 * @param \WP_Post $sync_log 329 * 261 330 * @return string 262 331 */ … … 286 355 287 356 $out = array_map( function ( $line ) { 288 return sprintf( '<span class="bc-sync-summary-meta">%s</span> ', $line );357 return sprintf( '<span class="bc-sync-summary-meta">%s</span><br />', $line ); 289 358 }, $out ); 290 359 … … 292 361 } 293 362 363 /** 364 * Get formatted summary 365 * 366 * @param \WP_Post $sync_log 367 * 368 * @return string 369 */ 370 private function get_multichannel_summary_formatted( $sync_log ) { 371 $multichannel_summary = $sync_log->{self::MULTICHANNEL_SUMMARY}; 372 373 $summary = []; 374 375 foreach ( $multichannel_summary as $channel ) { 376 $count_before = $channel['count_before'] ?? 0; 377 $count_after = $channel['count_after'] ?? 0; 378 $new = $count_after - $count_before; 379 380 $summary[] = sprintf( __( '<br /><b>%s</b>', 'bigcommerce' ), $channel['channel_name'] ); 381 $summary[] = sprintf( __( '%d Synced', 'bigcommerce' ), $channel['count_after'] ); 382 if ( $new > 0 ) { 383 $summary[] = sprintf( __( '%d Added', 'bigcommerce' ), $new ); 384 } 385 386 $summary = array_map( function ( $line ) { 387 return sprintf( '<span class="bc-sync-summary-meta">%s</span>', $line ); 388 }, $summary ); 389 } 390 391 return implode( '<br />', $summary ); 392 } 294 393 } -
bigcommerce/trunk/src/BigCommerce/Settings/Sections/Troubleshooting_Diagnostics.php
r2617240 r2622003 28 28 const TEXTBOX_NAME = 'bigcommerce_diagnostics_output'; 29 29 const LOG_ERRORS = 'bigcommerce_diagnostics_log_import_errors'; 30 const LOG_FILE_SIZE = 'bigcommerce_diagnostics_log_file_size'; 30 31 const SYNC_SITE_URL = 'bigcommerce_diagnostics_sync_site_url'; 31 32 … … 90 91 ); 91 92 93 register_setting( 94 Settings_Screen::NAME, 95 self::LOG_FILE_SIZE 96 ); 97 98 add_settings_field( 99 self::LOG_FILE_SIZE, 100 esc_html( __( 'Log file max size(MB)', 'bigcommerce' ) ), 101 [ $this, 'render_log_file_size', ], 102 Settings_Screen::NAME, 103 self::NAME, 104 [ 105 'min' => 1, 106 'max' => 25, 107 'type' => 'number', 108 'option' => self::LOG_FILE_SIZE, 109 'label' => esc_html( __( 'Set log file size', 'bigcommerce' ) ), 110 'description' => esc_html( __( 'Set log file max size in MB. If log file exceeds the limit it will be cleaned before new import', 'bigcommerce' ) ), 111 ] 112 ); 113 92 114 add_settings_field( 93 115 self::DIAGNOSTICS_NAME, … … 136 158 } 137 159 160 public function render_log_file_size( $args ) { 161 $value = get_option( $args[ 'option' ], 25 ); 162 $min = isset( $args[ 'min' ] ) ? sprintf( 'min="%d"', $args[ 'min' ] ) : ''; 163 $max = isset( $args[ 'max' ] ) ? sprintf( 'max="%d"', $args[ 'max' ] ) : ''; 164 $field = sprintf( '<input type="%1$s" value="%2$s" name="%3$s" id="%3$s" %4$s %5$s />', esc_attr( $args[ 'type' ] ), esc_attr( $value ), esc_attr( $args[ 'option' ] ), $min, $max ); 165 printf( '%s<p class="description">%s</p>', $field, esc_html( $args[ 'description' ] ) ); 166 } 167 138 168 /** 139 169 * Sets a wp_send_json answer for the ajax call that holds -
bigcommerce/trunk/src/BigCommerce/Taxonomies/Channel/Channel.php
r2141486 r2622003 37 37 38 38 /** 39 * Should product sync be to all channels? 40 * 41 * @return bool 42 */ 43 public static function multichannel_sync_to_all_channels() { 44 /** 45 * Filter whether multi-channel sync should sync to all channels. 46 * Enabling this feature allows site owners to 47 * connect to sync products to all channels or 48 * only the channel it is assigned to. 49 * 50 * @param bool $enabled 51 */ 52 return (bool) apply_filters( 'bigcommerce/channels/map-products-to-all-channels', false ); 53 } 54 55 /** 39 56 * @param int $channel_id 40 57 * -
bigcommerce/trunk/vendor/autoload.php
r2617240 r2622003 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit 509873e0fe5d4df74a0ea698def2e38f::getLoader();7 return ComposerAutoloaderInit00d9fec88dbb4fdf0216f882209f6119::getLoader(); -
bigcommerce/trunk/vendor/composer/autoload_real.php
r2617240 r2622003 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 509873e0fe5d4df74a0ea698def2e38f5 class ComposerAutoloaderInit00d9fec88dbb4fdf0216f882209f6119 6 6 { 7 7 private static $loader; … … 20 20 } 21 21 22 spl_autoload_register(array('ComposerAutoloaderInit 509873e0fe5d4df74a0ea698def2e38f', 'loadClassLoader'), true, true);22 spl_autoload_register(array('ComposerAutoloaderInit00d9fec88dbb4fdf0216f882209f6119', 'loadClassLoader'), true, true); 23 23 self::$loader = $loader = new \Composer\Autoload\ClassLoader(); 24 spl_autoload_unregister(array('ComposerAutoloaderInit 509873e0fe5d4df74a0ea698def2e38f', 'loadClassLoader'));24 spl_autoload_unregister(array('ComposerAutoloaderInit00d9fec88dbb4fdf0216f882209f6119', 'loadClassLoader')); 25 25 26 26 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 28 28 require_once __DIR__ . '/autoload_static.php'; 29 29 30 call_user_func(\Composer\Autoload\ComposerStaticInit 509873e0fe5d4df74a0ea698def2e38f::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInit00d9fec88dbb4fdf0216f882209f6119::getInitializer($loader)); 31 31 } else { 32 32 $classMap = require __DIR__ . '/autoload_classmap.php'; … … 40 40 41 41 if ($useStaticLoader) { 42 $includeFiles = Composer\Autoload\ComposerStaticInit 509873e0fe5d4df74a0ea698def2e38f::$files;42 $includeFiles = Composer\Autoload\ComposerStaticInit00d9fec88dbb4fdf0216f882209f6119::$files; 43 43 } else { 44 44 $includeFiles = require __DIR__ . '/autoload_files.php'; 45 45 } 46 46 foreach ($includeFiles as $fileIdentifier => $file) { 47 composerRequire 509873e0fe5d4df74a0ea698def2e38f($fileIdentifier, $file);47 composerRequire00d9fec88dbb4fdf0216f882209f6119($fileIdentifier, $file); 48 48 } 49 49 … … 52 52 } 53 53 54 function composerRequire 509873e0fe5d4df74a0ea698def2e38f($fileIdentifier, $file)54 function composerRequire00d9fec88dbb4fdf0216f882209f6119($fileIdentifier, $file) 55 55 { 56 56 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
bigcommerce/trunk/vendor/composer/autoload_static.php
r2617240 r2622003 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 509873e0fe5d4df74a0ea698def2e38f7 class ComposerStaticInit00d9fec88dbb4fdf0216f882209f6119 8 8 { 9 9 public static $files = array ( … … 1124 1124 { 1125 1125 return \Closure::bind(function () use ($loader) { 1126 $loader->prefixLengthsPsr4 = ComposerStaticInit 509873e0fe5d4df74a0ea698def2e38f::$prefixLengthsPsr4;1127 $loader->prefixDirsPsr4 = ComposerStaticInit 509873e0fe5d4df74a0ea698def2e38f::$prefixDirsPsr4;1128 $loader->prefixesPsr0 = ComposerStaticInit 509873e0fe5d4df74a0ea698def2e38f::$prefixesPsr0;1129 $loader->classMap = ComposerStaticInit 509873e0fe5d4df74a0ea698def2e38f::$classMap;1126 $loader->prefixLengthsPsr4 = ComposerStaticInit00d9fec88dbb4fdf0216f882209f6119::$prefixLengthsPsr4; 1127 $loader->prefixDirsPsr4 = ComposerStaticInit00d9fec88dbb4fdf0216f882209f6119::$prefixDirsPsr4; 1128 $loader->prefixesPsr0 = ComposerStaticInit00d9fec88dbb4fdf0216f882209f6119::$prefixesPsr0; 1129 $loader->classMap = ComposerStaticInit00d9fec88dbb4fdf0216f882209f6119::$classMap; 1130 1130 1131 1131 }, null, ClassLoader::class);
Note: See TracChangeset
for help on using the changeset viewer.