• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WooCommerce a2z

WooCommerce a2z

WooCommerce

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / 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.

You appear to be a bot. Output may be restricted

Description

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.

Usage

$void = ActionScheduler_HybridStore::set_autoincrement( $table_name, $table_suffix );

Parameters

$table_name
( string ) required –
$table_suffix
( string ) required –

Returns

void

Source

File name: woocommerce/packages/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php


Lines:

1 to 39 of 39
  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();
      }
      
/** @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},
        [
          '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},
          [ 'action_id' => $this->demarkation_id ]
        );
      }
    }
  }
 

 View on GitHub View on Trac

Published: 6th April 2020 | Last updated: 6th May 2020

Primary Sidebar

Information

Function name: ActionScheduler_HybridStore::set_autoincrement
Class ref: ActionScheduler_HybridStore
Plugin ref: WooCommerce
Version: 5.2.2
Sourcefile: packages/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php
File ref: packages/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php
Deprecated?: No
API Letters: A,H,S

Footer

WooCommerce a2z
WooCommerce a2z
WooCommerce
WordPress 5.7.1
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  woocommerce.wp-a2z.org
© Copyright WooCommerce a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites