Font Awesome Icons - Version 4.1.1

Version Description

  • Simplified upgrade logic: makes the upgrade process on the first page load after upgrade quicker and smoother.
Download this release

Release Info

Developer mlwilkerson
Plugin Icon 128x128 Font Awesome Icons
Version 4.1.1
Comparing to
See all releases

Code changes from version 4.1.0 to 4.1.1

Files changed (3) hide show
  1. includes/class-fontawesome.php +61 -16
  2. index.php +1 -1
  3. readme.txt +6 -2
includes/class-fontawesome.php CHANGED
@@ -126,7 +126,7 @@ class FontAwesome {
126
  *
127
  * @since 4.0.0
128
  */
129
- const PLUGIN_VERSION = '4.1.0';
130
  /**
131
  * The namespace for this plugin's REST API.
132
  *
@@ -439,6 +439,7 @@ class FontAwesome {
439
  * @throws ApiRequestException
440
  * @throws ApiResponseException
441
  * @throws ReleaseProviderStorageException
 
442
  * @throws ConfigCorruptionException if options are invalid
443
  * @internal
444
  * @ignore
@@ -491,7 +492,9 @@ class FontAwesome {
491
  if ( $should_upgrade ) {
492
  $this->validate_options( $options );
493
 
494
- $this->reset_releases_metadata_for_upgrade();
 
 
495
 
496
  /**
497
  * Delete the main option to make sure it's removed entirely, including
@@ -511,28 +514,70 @@ class FontAwesome {
511
  }
512
 
513
  /**
 
 
 
 
 
 
 
 
 
514
  * Internal use only.
515
  *
 
516
  * @ignore
517
  * @internal
518
  */
519
- private function reset_releases_metadata_for_upgrade() {
520
- /**
521
- * Delete the old release metadata transient, if it exists,
522
- * which would not yet have been a site transient.
523
- */
524
- delete_transient( 'font-awesome-releases' );
 
 
 
 
 
525
 
526
- // Delete the current site transients.
527
- delete_site_transient( FontAwesome_Release_Provider::OPTIONS_KEY );
528
- delete_site_transient( FontAwesome_Release_Provider::LAST_USED_RELEASE_TRANSIENT );
 
529
 
530
  /**
531
- * This is one exception to the rule about not loading release metadata
532
- * on front end page loads. But this would only happen on the first page
533
- * load after upgrading from a particular range of earlier versions.
 
 
534
  */
535
- FontAwesome_Release_Provider::load_releases();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
536
  }
537
 
538
  /**
@@ -1663,7 +1708,7 @@ class FontAwesome {
1663
  $action,
1664
  function () {
1665
  try {
1666
- $current_screen = get_current_screen();
1667
  $should_enable_icon_chooser = $this->should_icon_chooser_be_enabled( $current_screen );
1668
 
1669
  $this->enqueue_admin_js_assets( $should_enable_icon_chooser );
126
  *
127
  * @since 4.0.0
128
  */
129
+ const PLUGIN_VERSION = '4.1.1';
130
  /**
131
  * The namespace for this plugin's REST API.
132
  *
439
  * @throws ApiRequestException
440
  * @throws ApiResponseException
441
  * @throws ReleaseProviderStorageException
442
+ * @throws ReleaseMetadataMissingException
443
  * @throws ConfigCorruptionException if options are invalid
444
  * @internal
445
  * @ignore
492
  if ( $should_upgrade ) {
493
  $this->validate_options( $options );
494
 
495
+ $this->maybe_update_last_used_release_schema_for_upgrade();
496
+
497
+ $this->maybe_move_release_metadata_for_upgrade();
498
 
499
  /**
500
  * Delete the main option to make sure it's removed entirely, including
514
  }
515
 
516
  /**
517
+ * Some upgrades have involved changing how we store release metadata.
518
+ *
519
+ * If the plugin's backing data was in a valid sate before upgrade, then
520
+ * it should always be possible to apply any fixups to how the release
521
+ * metadata are stored without issuing a request to the API server for
522
+ * fresh metadata. Since issuing such a blocking request upon upgrade
523
+ * is known to cause load problems and request timeouts, let's never
524
+ * do it on upgrade.
525
+ *
526
  * Internal use only.
527
  *
528
+ * @throws ReleaseMetadataMissingException
529
  * @ignore
530
  * @internal
531
  */
532
+ private function maybe_move_release_metadata_for_upgrade() {
533
+ if ( boolval( get_option( FontAwesome_Release_Provider::OPTIONS_KEY ) ) ) {
534
+ // If this option is set, then we're all caught up.
535
+ return;
536
+ }
537
+
538
+ // It used to be stored in one of these.
539
+ $release_metadata = get_site_transient( 'font-awesome-releases' );
540
+ if ( ! $release_metadata ) {
541
+ $release_metadata = get_transient( 'font-awesome-releases' );
542
+ }
543
 
544
+ // Move it into where it belongs now.
545
+ if ( boolval( $release_metadata ) ) {
546
+ update_option( FontAwesome_Release_Provider::OPTIONS_KEY, $release_metadata, false );
547
+ }
548
 
549
  /**
550
+ * Now we'll reset the release provider.
551
+ *
552
+ * If we've fallen through to this point, and we haven't found the release
553
+ * metadata stored in one of the previous locations, then this will throw an
554
+ * exception.
555
  */
556
+ FontAwesome_Release_Provider::reset();
557
+ }
558
+
559
+ /**
560
+ * With 4.1.0, the name of one of the keys in the LAST_USED_RELEASE_TRANSIENT changed.
561
+ * We can fix it up.
562
+ *
563
+ * Internal use only.
564
+ *
565
+ * @throws ReleaseMetadataMissingException
566
+ * @ignore
567
+ * @internal
568
+ */
569
+ private function maybe_update_last_used_release_schema_for_upgrade() {
570
+ $last_used_transient = get_site_transient( FontAwesome_Release_Provider::LAST_USED_RELEASE_TRANSIENT );
571
+ if ( ! $last_used_transient ) {
572
+ $last_used_transient = get_transient( FontAwesome_Release_Provider::LAST_USED_RELEASE_TRANSIENT );
573
+ }
574
+
575
+ if ( $last_used_transient && isset( $last_used_transient['use_shim'] ) ) {
576
+ $compat = $last_used_transient['use_shim'];
577
+ unset( $last_used_transient['use_shim'] );
578
+ $last_used_transient['use_compatibility'] = $compat;
579
+ set_site_transient( FontAwesome_Release_Provider::LAST_USED_RELEASE_TRANSIENT, $last_used_transient, FontAwesome_Release_Provider::LAST_USED_RELEASE_TRANSIENT_EXPIRY );
580
+ }
581
  }
582
 
583
  /**
1708
  $action,
1709
  function () {
1710
  try {
1711
+ $current_screen = get_current_screen();
1712
  $should_enable_icon_chooser = $this->should_icon_chooser_be_enabled( $current_screen );
1713
 
1714
  $this->enqueue_admin_js_assets( $should_enable_icon_chooser );
index.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Font Awesome
4
  * Plugin URI: https://fontawesome.com/how-to-use/on-the-web/using-with/wordpress
5
  * Description: The official way to use Font Awesome Free or Pro icons on your site, brought to you by the Font Awesome team.
6
- * Version: 4.1.0
7
  * Author: Font Awesome
8
  * Author URI: https://fontawesome.com/
9
  * License: GPLv2 (or later)
3
  * Plugin Name: Font Awesome
4
  * Plugin URI: https://fontawesome.com/how-to-use/on-the-web/using-with/wordpress
5
  * Description: The official way to use Font Awesome Free or Pro icons on your site, brought to you by the Font Awesome team.
6
+ * Version: 4.1.1
7
  * Author: Font Awesome
8
  * Author URI: https://fontawesome.com/
9
  * License: GPLv2 (or later)
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Font Awesome ===
2
  Contributors: fontawesome, mlwilkerson, robmadole, frrrances, deathnfudge
3
- Stable tag: 4.1.0
4
  Tags: font, awesome, fontawesome, font-awesome, icon, svg, webfont
5
  Requires at least: 4.7
6
- Tested up to: 5.9
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -161,6 +161,10 @@ You can get more information about all the available settings and troubleshootin
161
 
162
  == Changelog ==
163
 
 
 
 
 
164
  = 4.1.0 =
165
  * Added support for using Font Awesome Version 6 Free with CDN. In order to use
166
  Version 6 Pro with this plugin, it's still necessary to use a Kit,
1
  === Font Awesome ===
2
  Contributors: fontawesome, mlwilkerson, robmadole, frrrances, deathnfudge
3
+ Stable tag: 4.1.1
4
  Tags: font, awesome, fontawesome, font-awesome, icon, svg, webfont
5
  Requires at least: 4.7
6
+ Tested up to: 6.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
161
 
162
  == Changelog ==
163
 
164
+ = 4.1.1 =
165
+ * Simplified upgrade logic: makes the upgrade process on the first page load
166
+ after upgrade quicker and smoother.
167
+
168
  = 4.1.0 =
169
  * Added support for using Font Awesome Version 6 Free with CDN. In order to use
170
  Version 6 Pro with this plugin, it's still necessary to use a Kit,