Changeset 3674640
- Timestamp:
- 08/31/2026 04:43:27 PM (3 months ago)
- Location:
- label-grid-tools/trunk
- Files:
-
- 5 edited
-
README.txt (modified) (1 diff)
-
admin/class-sync-content-data.php (modified) (3 diffs)
-
admin/traits/sync-page.php (modified) (1 diff)
-
labelgrid-tools.php (modified) (2 diffs)
-
public/js/labelgrid-tools-public-gate.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
label-grid-tools/trunk/README.txt
r3569187 r3674640 82 82 == Changelog == 83 83 84 = 1.4.15 = 85 * Fix: Catalog sync froze at the "Processing genres" step and no genres were ever imported. Genres are now imported correctly, a sync that returns no data reports the error instead of hanging, and a failure in one section no longer stops the rest of the scheduled sync from running. 86 * Fix: Pre-save could fail silently on slow connections ‚ the session was not always ready before the pre-save was submitted, and errors were never shown. Sessions now wait properly and any failure is reported instead of failing quietly. 87 84 88 = 1.4.14 = 85 89 * Fix: A WordPress "critical error" could appear on the LabelGrid Tools settings page when the saved API token contained stray spaces or line breaks (for example when the key is copied from the dashboard, where it wraps across several lines). The token is now cleaned before use and connection errors are handled gracefully instead of crashing the page. -
label-grid-tools/trunk/admin/class-sync-content-data.php
r3569163 r3674640 91 91 else { 92 92 LabelGrid_Tools::log_event('Update - No data retrieved', 'error', 'sync-catalog'); 93 exit(); 93 // A bare exit() answered an AJAX request expecting JSON with an 94 // empty body, so the progress bar hung on "DO NOT CLOSE THIS 95 // WINDOW" forever. Hand the failure back to the caller instead. 96 return array( 97 'more' => false, 98 'error' => sprintf( 99 /* translators: %s: catalog section being imported, e.g. genres */ 100 esc_html__('No data was returned by LabelGrid for "%s". The import has been stopped.', 'label-grid-tools'), 101 esc_html($this->actions[0]) 102 ) 103 ); 94 104 } 95 105 … … 137 147 else { 138 148 LabelGrid_Tools::log_event('Silent Update - No data retrieved || Action: ' . $action . ' feed: ' . print_r($feed->data, true), 'error', 'sync-catalog'); 139 exit(); 149 // Skip only this action: exit() aborted the whole run, so every 150 // later action (releases included) was never synced. 151 continue; 140 152 } 141 153 … … 878 890 $the_post_id = 0; 879 891 880 if ($genre->active == 'off') 892 // `active` arrives from the API as a real JSON boolean, and comparing a 893 // boolean against the non-empty string 'off' casts the string to true, so 894 // the old test skipped every ACTIVE genre and kept the inactive ones. 895 // Accept both the boolean and the legacy 'on'/'off' string form; anything 896 // unrecognised, empty or missing is treated as active, so an unexpected 897 // payload can never silently stop the import again. 898 $genre_active = (isset($genre->active) && $genre->active !== '') 899 ? filter_var($genre->active, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) 900 : null; 901 902 if ($genre_active === false) 881 903 $skip = true; 882 904 -
label-grid-tools/trunk/admin/traits/sync-page.php
r3179042 r3674640 27 27 $percentage = $import->lgt_get_percentage_complete(); 28 28 29 if (! empty($ret['error'])) { 30 // The admin JS reads `error` and `message` at the TOP level and always 31 // dereferences data.step, so all three keys have to be present or the 32 // progress bar hangs instead of showing the failure. 33 wp_send_json(array( 34 'success' => false, 35 'error' => true, 36 'message' => $ret['error'], 37 'data' => array( 38 'step' => 'done' 39 ) 40 )); 41 } 42 29 43 if ($ret['more']) { 30 44 $step += 1; -
label-grid-tools/trunk/labelgrid-tools.php
r3569187 r3674640 15 15 * Plugin Name: LabelGrid Tools 16 16 * Description: LabelGrid Tools is an advanced plugin for Record Labels, Artists, and Distributors that allow to showcase music releases with ease providing advanced promotional and pre-release tools. 17 * Version: 1.4.1 417 * Version: 1.4.15 18 18 * Author: LabelGrid 19 19 * Author URI: https://labelgrid.com … … 34 34 * Rename this for your plugin and update it as you release new versions. 35 35 */ 36 define('LGT_PLUGIN_VERSION', '1.4.1 4');36 define('LGT_PLUGIN_VERSION', '1.4.15'); 37 37 38 38 /** -
label-grid-tools/trunk/public/js/labelgrid-tools-public-gate.js
r2503487 r3674640 97 97 function(reason) { 98 98 console.error('Something went wrong', reason); 99 lg_gate_show_error('#modalwindow-freedownload', __('We could not start your session. Please check your connection and try again.', 'labelgrid-tools')); 99 100 }); 100 101 … … 128 129 function(reason) { 129 130 console.error('Something went wrong', reason); 131 lg_gate_show_error('#modalwindow-presave', __('We could not start your session. Please check your connection and try again.', 'labelgrid-tools')); 130 132 }); 131 133 … … 324 326 } 325 327 328 // Per-request timeout for the gate session calls (ms). 329 var LGT_GATE_REQUEST_TIMEOUT = 15000; 330 331 // Show a failure inside the open modal instead of only logging to console. 332 function lg_gate_show_error(windowid, message) { 333 $(windowid + ' #popdescription').html(message); 334 $(windowid + ' #content').html(''); 335 } 336 326 337 function open_session(is_presave = false) { 327 338 return new Promise( 328 339 function(resolve, reject) { 340 // The wall-clock setTimeout that used to live here rejected after 5s 341 // while add-session could still be in flight, and the flow then ran 342 // get-playlists/add-presave against a session that did not exist yet. 343 // Each request now carries its own timeout, so a slow call is ABORTED 344 // and reported through error() - the promise can only settle once, 345 // and never while a request is still running. 329 346 $.ajax({ 330 347 url: lgt_install_url + '/wp-json/lgt-gate-api/v1/check-session', 331 348 type: 'GET', 349 timeout: LGT_GATE_REQUEST_TIMEOUT, 332 350 success: function(response) { 333 351 352 if (!response || !response.session) { 353 reject(new Error('check-session returned no session')); 354 return; 355 } 334 356 335 357 lg_set_session(response.session); … … 346 368 data: data_session, 347 369 type: 'POST', 370 timeout: LGT_GATE_REQUEST_TIMEOUT, 348 371 success: function(data) { 372 if (data && data.message == 'ko') { 373 reject(new Error('add-session refused')); 374 return; 375 } 349 376 resolve(); 377 }, 378 error: function(xhr, status) { 379 reject(new Error('add-session failed: ' + status)); 350 380 } 351 381 }); 352 382 353 383 384 }, 385 error: function(xhr, status) { 386 reject(new Error('check-session failed: ' + status)); 354 387 } 355 388 }); 356 357 setTimeout(() => reject(new Error()), 5000);358 389 }); 359 390 } … … 576 607 type: 'POST', 577 608 success: function(response) { 578 if (response.message == 'ok' && playlist_id != null) alert(__('Track/s will be added to the selected playlist on ', 'labelgrid-tools') + lgt_release_date); 579 else if (playlist_id != null) alert(__('Error scheduling the pre-save. Please contact an Administrator.', 'labelgrid-tools')); 609 // A failure has to be reported whether or not a playlist was chosen: 610 // both branches used to be gated on playlist_id != null, so the 611 // track/album pre-save failed completely silently. 612 if (response && response.message == 'ok') { 613 if (playlist_id != null) alert(__('Track/s will be added to the selected playlist on ', 'labelgrid-tools') + lgt_release_date); 614 } 615 else alert(__('Error scheduling the pre-save. Please contact an Administrator.', 'labelgrid-tools')); 616 }, 617 error: function(xhr, status) { 618 console.error('add-presave failed', status); 619 alert(__('Error scheduling the pre-save. Please contact an Administrator.', 'labelgrid-tools')); 580 620 } 581 621 }); … … 637 677 success: function(data) { 638 678 //console.log(data); 679 // The endpoint answers HTTP 200 with a bare `false` (or `true`) when 680 // the gate call failed or returned nothing - e.g. the 422 "Session 681 // Null" case - so error() alone would never see it. 682 if (!data || typeof data !== 'object' || !data.playlists) { 683 console.error('get-playlists returned no playlists', data); 684 lg_gate_show_error('#modalwindow-presave', __('We could not load your playlists. Please close this window and try again.', 'labelgrid-tools')); 685 return; 686 } 639 687 callbacks['get_playlist_save'](data); 688 }, 689 error: function(xhr, status) { 690 console.error('get-playlists failed', status); 691 lg_gate_show_error('#modalwindow-presave', __('We could not load your playlists. Please close this window and try again.', 'labelgrid-tools')); 640 692 } 641 693 });
Note:
See TracChangeset
for help on using the changeset viewer.