ActionScheduler_HybridStore::set_autoincrement
When the actions table is created, set its autoincrement value to be one higher than the posts table to ensure that there are no ID collisions.
Метод класса: ActionScheduler_HybridStore{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$ActionScheduler_HybridStore = new ActionScheduler_HybridStore(); $ActionScheduler_HybridStore->set_autoincrement( $table_name, $table_suffix );
- $table_name(строка) (обязательный)
- Table name.
- $table_suffix(строка) (обязательный)
- Suffix of table name.
Код ActionScheduler_HybridStore::set_autoincrement() ActionScheduler HybridStore::set autoincrement WC 11.0.1
public function set_autoincrement( $table_name, $table_suffix ) {
if ( ActionScheduler_StoreSchema::ACTIONS_TABLE === $table_suffix ) {
if ( empty( $this->demarkation_id ) ) {
$this->demarkation_id = $this->set_demarkation_id();
}
/**
* Global.
*
* @var \wpdb $wpdb
*/
global $wpdb;
/**
* A default date of '0000-00-00 00:00:00' is invalid in MySQL 5.7 when configured with
* sql_mode including both STRICT_TRANS_TABLES and NO_ZERO_DATE.
*/
$default_date = new DateTime( 'tomorrow' );
$null_action = new ActionScheduler_NullAction();
$date_gmt = $this->get_scheduled_date_string( $null_action, $default_date );
$date_local = $this->get_scheduled_date_string_local( $null_action, $default_date );
$row_count = $wpdb->insert(
$wpdb->{ActionScheduler_StoreSchema::ACTIONS_TABLE},
array(
'action_id' => $this->demarkation_id,
'hook' => '',
'status' => '',
'scheduled_date_gmt' => $date_gmt,
'scheduled_date_local' => $date_local,
'last_attempt_gmt' => $date_gmt,
'last_attempt_local' => $date_local,
)
);
if ( $row_count > 0 ) {
$wpdb->delete(
$wpdb->{ActionScheduler_StoreSchema::ACTIONS_TABLE},
array( 'action_id' => $this->demarkation_id )
);
}
}
}