Keine Beschreibung

class-upgrade-v1_8-themes.php 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /*******************************************************************************
  3. * Copyright (c) 2019, Code Atlantic LLC
  4. ******************************************************************************/
  5. if ( ! defined( 'ABSPATH' ) ) {
  6. exit;
  7. }
  8. /**
  9. * Implements a batch processor for migrating existing themes to new data structure.
  10. *
  11. * @since 1.8.0
  12. *
  13. * @see PUM_Abstract_Upgrade_Themes
  14. */
  15. class PUM_Upgrade_v1_8_Themes extends PUM_Abstract_Upgrade_Themes {
  16. /**
  17. * Batch process ID.
  18. *
  19. * @var string
  20. */
  21. public $batch_id = 'core-v1_8-themes';
  22. /**
  23. * Only load popups with specific meta keys.r
  24. *
  25. * @return array
  26. */
  27. public function custom_query_args() {
  28. return array(
  29. 'meta_query' => array(
  30. 'relation' => 'OR',
  31. array(
  32. 'key' => 'popup_theme_data_version',
  33. 'compare' => 'NOT EXISTS',
  34. 'value' => 'deprecated', // Here for WP 3.9 or less.
  35. ),
  36. array(
  37. 'key' => 'popup_theme_data_version',
  38. 'compare' => '<',
  39. 'value' => 3,
  40. ),
  41. ),
  42. );
  43. }
  44. /**
  45. * Process needed upgrades on each theme.
  46. *
  47. * @param int $theme_id
  48. */
  49. public function process_theme( $theme_id = 0 ) {
  50. $theme = pum_get_theme( $theme_id );
  51. /**
  52. * If the theme is using an out of date data version, process upgrades.
  53. */
  54. if ( $theme->data_version < $theme->model_version ) {
  55. $theme->passive_migration();
  56. }
  57. }
  58. public function finish() {
  59. // Clean up transient used to determine when updates are needed.
  60. delete_transient( 'pum_needs_1_8_theme_upgrades' );
  61. parent::finish(); // TODO: Change the autogenerated stub
  62. }
  63. }