Нет описания

Upgrade.php 986B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /*******************************************************************************
  3. * Copyright (c) 2019, Code Atlantic LLC
  4. ******************************************************************************/
  5. if ( ! defined( 'ABSPATH' ) ) {
  6. exit;
  7. }
  8. /**
  9. * Implements a basic upgrade process.
  10. *
  11. * Handles marking complete and resume management.
  12. *
  13. * @since 1.7.0
  14. */
  15. abstract class PUM_Abstract_Upgrade extends PUM_Abstract_Batch_Process {
  16. /**
  17. * Store the current upgrade args in case we need to redo somehting
  18. *
  19. * @param int $step
  20. */
  21. public function __construct( $step = 1 ) {
  22. update_option( 'pum_doing_upgrade', array(
  23. 'upgrade_id' => $this->batch_id,
  24. 'step' => $step,
  25. ) );
  26. parent::__construct( $step );
  27. }
  28. /**
  29. * Defines logic to execute once batch processing is complete.
  30. */
  31. public function finish() {
  32. /**
  33. * Clear the doing upgrade flag to prevent issues later.
  34. */
  35. delete_option( 'pum_doing_upgrade' );
  36. parent::finish();
  37. }
  38. }