mailpoet
/
vendor
/
woocommerce
/
action-scheduler
/
classes
/
migration
/
ActionScheduler_DBStoreMigrator.php
ActionMigrator.php
1 year ago
ActionScheduler_DBStoreMigrator.php
1 year ago
BatchFetcher.php
1 year ago
Config.php
4 years ago
Controller.php
1 year ago
DryRun_ActionMigrator.php
1 year ago
DryRun_LogMigrator.php
1 year ago
LogMigrator.php
1 year ago
Runner.php
1 year ago
Scheduler.php
1 year ago
index.php
3 years ago
ActionScheduler_DBStoreMigrator.php
22 lines
| 1 | <?php |
| 2 | if (!defined('ABSPATH')) exit; |
| 3 | class ActionScheduler_DBStoreMigrator extends ActionScheduler_DBStore { |
| 4 | public function save_action( ActionScheduler_Action $action, ?DateTime $scheduled_date = null, ?DateTime $last_attempt_date = null ) { |
| 5 | try { |
| 6 | global $wpdb; |
| 7 | $action_id = parent::save_action( $action, $scheduled_date ); |
| 8 | if ( null !== $last_attempt_date ) { |
| 9 | $data = array( |
| 10 | 'last_attempt_gmt' => $this->get_scheduled_date_string( $action, $last_attempt_date ), |
| 11 | 'last_attempt_local' => $this->get_scheduled_date_string_local( $action, $last_attempt_date ), |
| 12 | ); |
| 13 | $wpdb->update( $wpdb->actionscheduler_actions, $data, array( 'action_id' => $action_id ), array( '%s', '%s' ), array( '%d' ) ); |
| 14 | } |
| 15 | return $action_id; |
| 16 | } catch ( \Exception $e ) { |
| 17 | // translators: %s is an error message. |
| 18 | throw new \RuntimeException( sprintf( __( 'Error saving action: %s', 'action-scheduler' ), $e->getMessage() ), 0 ); |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 |