PluginProbe ʕ •ᴥ•ʔ
Hostinger Reach – AI-Powered Email Marketing for WordPress / 1.7.0
Hostinger Reach – AI-Powered Email Marketing for WordPress v1.7.0
1.7.2 1.7.1 1.7.0 1.6.0 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 trunk 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6
hostinger-reach / vendor / woocommerce / action-scheduler / classes / migration / ActionScheduler_DBStoreMigrator.php
hostinger-reach / vendor / woocommerce / action-scheduler / classes / migration Last commit date
ActionMigrator.php 10 months ago ActionScheduler_DBStoreMigrator.php 10 months ago BatchFetcher.php 10 months ago Config.php 10 months ago Controller.php 10 months ago DryRun_ActionMigrator.php 10 months ago DryRun_LogMigrator.php 10 months ago LogMigrator.php 10 months ago Runner.php 10 months ago Scheduler.php 10 months ago
ActionScheduler_DBStoreMigrator.php
53 lines
1 <?php
2
3 /**
4 * Class ActionScheduler_DBStoreMigrator
5 *
6 * A class for direct saving of actions to the table data store during migration.
7 *
8 * @since 3.0.0
9 */
10 class ActionScheduler_DBStoreMigrator extends ActionScheduler_DBStore {
11
12 /**
13 * Save an action with optional last attempt date.
14 *
15 * Normally, saving an action sets its attempted date to 0000-00-00 00:00:00 because when an action is first saved,
16 * it can't have been attempted yet, but migrated completed actions will have an attempted date, so we need to save
17 * that when first saving the action.
18 *
19 * @param ActionScheduler_Action $action Action to migrate.
20 * @param null|DateTime $scheduled_date Optional date of the first instance to store.
21 * @param null|DateTime $last_attempt_date Optional date the action was last attempted.
22 *
23 * @return string The action ID
24 * @throws \RuntimeException When the action is not saved.
25 */
26 public function save_action( ActionScheduler_Action $action, ?DateTime $scheduled_date = null, ?DateTime $last_attempt_date = null ) {
27 try {
28 /**
29 * Global.
30 *
31 * @var \wpdb $wpdb
32 */
33 global $wpdb;
34
35 $action_id = parent::save_action( $action, $scheduled_date );
36
37 if ( null !== $last_attempt_date ) {
38 $data = array(
39 'last_attempt_gmt' => $this->get_scheduled_date_string( $action, $last_attempt_date ),
40 'last_attempt_local' => $this->get_scheduled_date_string_local( $action, $last_attempt_date ),
41 );
42
43 $wpdb->update( $wpdb->actionscheduler_actions, $data, array( 'action_id' => $action_id ), array( '%s', '%s' ), array( '%d' ) );
44 }
45
46 return $action_id;
47 } catch ( \Exception $e ) {
48 // translators: %s is an error message.
49 throw new \RuntimeException( sprintf( __( 'Error saving action: %s', 'action-scheduler' ), $e->getMessage() ), 0 );
50 }
51 }
52 }
53